Browse Source

Update docs on urlParams

shalvah 5 years ago
parent
commit
b7aad444e3
5 changed files with 25 additions and 7 deletions
  1. 5 0
      CHANGELOG.md
  2. BIN
      body_params.png
  3. BIN
      body_params_1.png
  4. BIN
      body_params_2.png
  5. 20 7
      docs/documenting.md

+ 5 - 0
CHANGELOG.md

@@ -13,6 +13,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
 
 
 ### Removed
 ### Removed
 
 
+## [4.0.0] 
+### Added
+- `bindings` replaced by `@urlParam` annotation (https://github.com/mpociot/laravel-apidoc-generator/pull/599)
+- Better support for arrays and objects in bodyParams (https://github.com/mpociot/laravel-apidoc-generator/pull/597)
+
 ## [3.17.1] - Thursday, 12 September 2019
 ## [3.17.1] - Thursday, 12 September 2019
 ### Fixed
 ### Fixed
 - ResponseCalls: Call Lumen application correctly since it does not use HttpKernel (https://github.com/mpociot/laravel-apidoc-generator/pull/585)
 - ResponseCalls: Call Lumen application correctly since it does not use HttpKernel (https://github.com/mpociot/laravel-apidoc-generator/pull/585)

BIN
body_params.png


BIN
body_params_1.png


BIN
body_params_2.png


+ 20 - 7
docs/documenting.md

@@ -49,7 +49,7 @@ class UserController extends Controller
 
 
 ## Specifying request parameters
 ## Specifying request parameters
 To specify a list of valid parameters your API route accepts, use the `@urlParam`, `@bodyParam` and `@queryParam` annotations.
 To specify a list of valid parameters your API route accepts, use the `@urlParam`, `@bodyParam` and `@queryParam` annotations.
-- The `@urlParam` annotation is used for describing parameters in your URl. For instance, in a Laravel Route like this: "/users/{id}/{lang?}", you would use this annotation to describe the `id` and `lang` parameters. It takes the name of the parameter, an optional "required" label, and then its description.
+- The `@urlParam` annotation is used for describing parameters in your URl. For instance, in a Laravel route with this URL: "/post/{id}/{lang?}", you would use this annotation to describe the `id` and `lang` parameters. It takes the name of the parameter, an optional "required" label, and then its description.
 - The `@queryParam` annotation takes the name of the parameter, an optional "required" label, and then its description.
 - The `@queryParam` annotation takes the name of the parameter, an optional "required" label, and then its description.
 - The `@bodyParam` annotation takes the name of the parameter, its type, an optional "required" label, and then its description. 
 - The `@bodyParam` annotation takes the name of the parameter, its type, an optional "required" label, and then its description. 
 
 
@@ -57,11 +57,22 @@ Examples:
 
 
 ```php
 ```php
 /**
 /**
- * @bodyParam title string required The title of the post.
- * @bodyParam body string required The title of the post.
- * @bodyParam type string The type of post to create. Defaults to 'textophonious'.
- * @bodyParam author_id int the ID of the author
- * @bodyParam thumbnail image This is required if the post type is 'imagelicious'.
+ * @urlParam id required The ID of the post.
+ * @urlParam lang The language.
+ * @bodyParam user_id int required The id of the user. Example: 9
+ * @bodyParam room_id string The id of the room.
+ * @bodyParam forever boolean Whether to ban the user forever. Example: false
+ * @bodyParam another_one number Just need something here.
+ * @bodyParam yet_another_param object required Some object params.
+ * @bodyParam yet_another_param.name string required Subkey in the object param.
+ * @bodyParam even_more_param array Some array params.
+ * @bodyParam even_more_param.* float Subkey in the array param.
+ * @bodyParam book.name string
+ * @bodyParam book.author_id integer
+ * @bodyParam book[pages_count] integer
+ * @bodyParam ids.* integer
+ * @bodyParam users.*.first_name string The first name of the user. Example: John
+ * @bodyParam users.*.last_name string The last name of the user. Example: Doe
  */
  */
 public function createPost()
 public function createPost()
 {
 {
@@ -83,7 +94,9 @@ They will be included in the generated documentation text and example requests.
 
 
 **Result:**
 **Result:**
 
 
-![](body_params.png)
+![](body_params_1.png)
+
+![](body_params_2.png)
 
 
 ### Example parameters
 ### Example parameters
 For each parameter in your request, this package will generate a random value to be used in the example requests. If you'd like to specify an example value, you can do so by adding `Example: your-example` to the end of your description. For instance:
 For each parameter in your request, this package will generate a random value to be used in the example requests. If you'd like to specify an example value, you can do so by adding `Example: your-example` to the end of your description. For instance: