Skip to content

Conversation

@sjaensch
Copy link
Contributor

@sjaensch sjaensch commented Mar 8, 2016

According to the spec, response codes should be of type string. This is the case in the JSON examples, but not in the YAML ones, causing issues with consumers that are implemented according to spec. Let's fix the examples so they don't set a bad... example.

According to the spec, response codes should be of type string. This is the case
in the JSON examples, but not in the YAML ones, causing issues with consumers
that are implemented according to spec. Let's fix the examples so they don't set
a bad... example.
@webron
Copy link
Member

webron commented Mar 8, 2016

It's not necessarily a bad example, but for the sake of cleanliness, I'll merge it.

webron added a commit that referenced this pull request Mar 8, 2016
Convert response codes in YAML specs to be strings
@webron webron merged commit 8e31017 into OAI:master Mar 8, 2016
@ePaul
Copy link
Contributor

ePaul commented Mar 8, 2016

I always assumed that any processor would convert the integers to strings here. Do we really need to use quotation marks here?

@webron
Copy link
Member

webron commented Mar 8, 2016

@ePaul in YAML keys are not necessarily string. Having something like

200: hello
"200": goodbye

is legal and those are entirely separate properties. However, when only one exists, converters will normally convert integers to strings, but afaik it is not explicitly defined. So for the sake of purity, the change does make sense. We've applied a similar change to the examples in the spec itself a few months ago.

@sjaensch
Copy link
Contributor Author

sjaensch commented Mar 8, 2016

Thanks for merging this in! @ePaul to expand on @webron's answer, 200 and "200" are different things in YAML, just like in JSON. Check out what I had to do for bravado, the Python client library.

@webron
Copy link
Member

webron commented Mar 8, 2016

Well, not 'just like in JSON' because in JSON keys are always strings.

AndersDJohnson pushed a commit to AndersDJohnson/OpenAPI-Specification that referenced this pull request Apr 8, 2019
Convert response codes in YAML specs to be strings
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.

3 participants