| Q | A
| ----------------- | ---
| Bug? | yes
| New Feature? | no
| Framework | Laravel
| Framework version | 5.6.22
| Package version | 2.0.0-alpha2
| PHP version | 7.2.4
I want to add the response for the api doc
* @Transaction({
* @Request("email=foo&password=bar", contentType="application/x-www-form-urlencoded"),
* @Response(200, body={"token": "JWT TOKEN","token_type" : "bearer","expires_in" : "xxxxx","status_code": 200,"message": "User Authenticated"}),
* @Response(401, body={"message": "401 Unauthorized","status_code": 401}),
* @Response(422, body={"message": "The given data was invalid.","errors": {"email": ["validation.required"],"password": ["validation.required"]},"status_code": 422})
* })
i have got this error
In AnnotationException.php line 42:
[Syntax Error] Expected PlainValue, got '[' at position 501 in method App\Http\Controllers\Api\Auth\AuthController:
:login().
I just want to the doc accept my array
put an array inside of annotation
Just use curly braces where you need to define array.
Documentation generator will detect where multiple objects are and display the array. So for your case:
* @Transaction({
* @Request("email=foo&password=bar", contentType="application/x-www-form-urlencoded"),
* @Response(200, body={"token": "JWT TOKEN","token_type" : "bearer","expires_in", "xxxxx","status_code": 200,"message": "User Authenticated"}),
* @Response(401, body={"message": "401 Unauthorized","status_code": 401}),
* @Response(422, body={"message": "The given data was invalid.","errors": {
* {"email": "validation.required"},
* {"password": "validation.required"}
* }},"status_code": 422})
* })
thanks :)
Most helpful comment
Just use curly braces where you need to define array.
Documentation generator will detect where multiple objects are and display the array. So for your case: