I may be doing something wrong here, but I am following the docs to return a body that has information about the 400
response being thrown for a bad stock ticker input.
In the Swagger, this is not visible:
However, in curl
, you can see the body:
$ curl -X GET "http://127.0.0.1:4479/price?ticker=OTHER" -H "accept: application/json"
{"error":["Invalid ticker. Please use one of 'AAPL', 'AMZN', 'FB', 'GOOG', 'INTC', 'MSFT'"]}
Is it possible to include this type of response in Swagger even for non-200 responses?
Apparently the "Warning" header is one that we should be using based on the spec, but that is not shown in Swagger either.
res$status <- 400
res$headers$Message <- "Message"
res$headers$Warning <- "Warning"
@colearendt I believe swagger in general needs a good once-over and an update to the latest version. If you find any more unexpected behavior, please make an issue so I can track them. Thank you in advance!
This issue (https://github.com/swagger-api/swagger-ui/issues/3041) is apparently fixed in Swagger 3.0.18 馃槃
swagger
has been updated to use swagger-ui
3.33.0
Closing