Skip to content

"The Responses Object MUST contain at least one response code" #2799

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

Merged
merged 1 commit into from
Feb 24, 2022

Conversation

karenetheridge
Copy link
Member

@karenetheridge
Copy link
Member Author

karenetheridge commented Nov 20, 2021

Unfortunately JSON Schema doesn't have a "contains"-like operation for objects, which would let us say "there must be at least one property matching '^[1-5](?:[0-9]{2}|XX)$'" (i.e. not 'default'). But this is still better than nothing.

edit: I thought of a way of checking this! added as a second commit.

@hkosova
Copy link
Contributor

hkosova commented Nov 21, 2021

Wait, is the "MUST contain at least one response code" requirement meant to not count default? I've always interpreted the spec to mean that default is sort of also a "response code" (the catch-all code), just like OAS considers 2XX a response code despite the string 2XX itself not being an actual HTTP status code. 😕

Perhaps the spec itself could also use a clarification.

@karenetheridge
Copy link
Member Author

karenetheridge commented Nov 21, 2021

Good question! I always interpreted it as "must contain at least one, other than default" but I can see how it could be interpreted the other way too.

I wonder if there is much of a desire to declare a responses object with just default under it? It's too bad we don't have a way of searching what everyone is currently doing.

@hkosova
Copy link
Contributor

hkosova commented Nov 21, 2021

@karenetheridge
Copy link
Member Author

It might be good to discuss this at the next community meeting -- how do people interpret this section of the spec? is interpreting it one way obviously superior to the other option?

@darrelmiller
Copy link
Member

In my opinion, having a single default response is valid. default can be used to describe successful responses and having a successful response is not a MUST. My understanding was the constraint was there just so that docs generators could at least show something relating to the response.

It could be argued that this constraint is moot now that the responses property in Operation Object is not required. Forcing the Responses Object to contain something is not actually guaranteeing anything.

@webron webron merged commit f6f9ab3 into OAI:main Feb 24, 2022
@karenetheridge karenetheridge deleted the ether/responses-response-code branch February 25, 2022 03:13
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.

4 participants