Document all possible reponses of a single request in a single page
Hi!
Thanks for this great gem.
I would like to document all possible responses for a request in a single page for that request.
For example, in github :
the request
curl https://api.github.com
has three different responses for 3 cases,
Sending invalid JSON will result in a 400 Bad Request response.
HTTP/1.1 400 Bad Request
Content-Length: 35
{"message":"Problems parsing JSON"}
Sending the wrong type of JSON values will result in a 400 Bad Request response.
HTTP/1.1 400 Bad Request
Content-Length: 40
{"message":"Body should be a JSON object"}
Sending invalid fields will result in a 422 Unprocessable Entity response.
HTTP/1.1 422 Unprocessable Entity
Content-Length: 149
{
"message": "Validation Failed",
...
}
Is there a way to document these in a single page? (Or may be an alternative way like making these nested, below the link for each page.)
I have also been thinking about how to best structure multiple response for one request.
I found an example in the example documentation.
Looking at the source of the example app, it looks like you can just do multiple requests per example: https://github.com/zipmark/rspec_api_documentation/blob/master/example/spec/acceptance/orders_spec.rb#L47
@phansch thank you for your response.
just like your example that was what i did. i wrote multiple requests per example. In each the requests were the same but the responses were different ( for example when creating order, if it had three responses 201, 403, 505, then the requests would be same, where as the responses would differ in status code, and body )
At that time i wish i could generate something like this: https://help.shopify.com/api/reference/order#cancel https://developer.github.com/v3/#root-endpoint
If rspec_api_documentation intendeds to use this issue as feature request, I have keep this issue open. Else I can close it, because my problem was solved the way @phansch mentioned.