westfieldlabs / apivore

Tests your rails API against its Swagger description of end-points, models, and query parameters.
Apache License 2.0
213 stars 66 forks source link

Does not handle empty response case #122

Open ccouzens opened 6 years ago

ccouzens commented 6 years ago

From the swagger documentation:

Some responses, such as 204 No Content, have no body. To indicate the response body is empty, do not specify a content for the response:

https://swagger.io/docs/specification/describing-responses/#empty

If you try and test such an endpoint with apivore, you get the following exception:

Swagger doc: /swagger.json missing response model for get request with /liveness for code 200

It looks like the validator code https://github.com/westfieldlabs/apivore/blob/master/lib/apivore/validator.rb#L83 should be checking to see if response body is null before raising an exception about missing response models