Skip to content

Do not force "" for http status code #2147

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

Closed
wants to merge 1 commit into from

Conversation

pkuczynski
Copy link

In JSON the key which is a number must be wrapped into "". This is not the case of yaml format. Different formats, different requirements. It does not make sense to force json requirements into yaml.

Please also note that https://editor.swagger.io does not wrap status codes into "", which is correct, but contradictory to this spec:

In JSON the key which is a number must be wrapped into "". This is not the case of yaml format. Different formats, different requirements. It does not make sense to force json requirements into yaml.
@webron
Copy link
Member

webron commented Feb 19, 2020

As a general rule, we're looking for compatibility between JSON and YAML representations of API definitions, and have added some restrictions in the spec to support it. Since in YAML keys are typed, the following is legal:

responses:
  "400": {...}
  400: {...}

and doesn't really have a JSON equivalent. Even in YAML, that can cause parsing issues and we don't want to complicate parsing.

The fact that Swagger Editor does not complain about it is an issue with the tool and should be filed there.

@webron webron closed this Feb 19, 2020
@pkuczynski
Copy link
Author

This makes it really annoying to have to use "400": ... in YAML :(

@webron
Copy link
Member

webron commented Feb 19, 2020

I feel your pain (seriously). Regardless, this is definitely not a change we can do in 3.0.x because it changes the behavior of the spec.

@pkuczynski
Copy link
Author

Well, I didnt know how to propose it for the next version?

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

Successfully merging this pull request may close these issues.

2 participants