Trax-air / swagger-tester

Automatically test your swagger API
MIT License
104 stars 36 forks source link

when should default response be checked? #17

Closed zdelagrange closed 8 years ago

zdelagrange commented 8 years ago

Specifically I have a question on this conditional:

if 'default' not in response_spec.keys():
    assert response.status_code in response_spec.keys()
    validate_definition(swagger_parser, response_spec[response.status_code], response_json)
else:
    validate_definition(swagger_parser, response_spec['default'], response_json)

From what I understand, if there is a default key in the Responses object then swagger_tester will ALWAYS validate the default response object, and only validate specific status codes when there is no default. So if there is both a 200 & default response, then the 200 will never be validated. is this desired? I feel like the default should only be validated when the response code does not match one within the response object.

What's the justification for this? is it desired?

cyprieng commented 8 years ago

To be honest I don't remember why it has been done this way... But I am completely agree with you on this. I can fix this tomorrow, or you can submit a PR.

cyprieng commented 8 years ago

Fixed and deployed in v0.2.4 :smile: