Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Validate spec failed on validating response code without quote #49

Open
zhichuny opened this issue May 19, 2016 · 1 comment
Open

Validate spec failed on validating response code without quote #49

zhichuny opened this issue May 19, 2016 · 1 comment

Comments

@zhichuny
Copy link

I found that validate_spec will fail on validating response codes when it is not wrapped with single quote. But on swagger website, response codes are not quoted: http://editor.swagger.io/#/

On OpenAPI doc, example response codes are wrapped with quotes.

I am confused which way is the correct and valid way to write response code in spec yaml. Can you make both type of response codes pass validation? Or is response code without quote not valid?

@sjaensch
Copy link
Contributor

The problem here is that JSON only allows strings as dictionary keys, and quite a bit of spec-handling code expects the response codes to be strings because of that. I've added handling of these integer response codes to bravado: https://github.com/Yelp/bravado/blob/master/bravado/swagger_model.py#L107

Unfortunately the Swagger spec does not explicitly define that response codes have to be strings, this was simply a limitation of JSON (and thus implicitly defined). With the advent of YAML spec this has changed. Note though that the YAML example within the spec does wrap the response code in quotes to make sure it's a string: http://swagger.io/specification/#responsesObject

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants