Skip to content

Limiting OAS3.1 to RFC7231 status codes? #2471

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
ioggstream opened this issue Feb 18, 2021 · 9 comments · Fixed by #3991
Closed

Limiting OAS3.1 to RFC7231 status codes? #2471

ioggstream opened this issue Feb 18, 2021 · 9 comments · Fixed by #3991
Milestone

Comments

@ioggstream
Copy link
Contributor

I expect

To reference all registered status codes

Instead

The spec says

The available status codes are defined by RFC7231

Note

It is not clear to whether the current formulation limits the available status codes to the one in 7231

@philsturgeon
Copy link
Contributor

What else would it mean? You can use any status codes defined in RFC 7231. Using custom status codes is undefined and therefore undefined behavior is to be expected.

Was there a particular status code you were looking to use thats not in 7231 or are you trying to use custom codes?

For extra context, the JSON Schema validates the following:

patternProperties:
          '[1-5](?:\d{2}|XX)':

So you could go using custom status codes if you wanted to, but if its outside of those rules some validators will barf errors at you.

@ioggstream
Copy link
Contributor Author

429 status code is rfc6585, but not in 7231 ;)

I'm just saying that there are http-extensions beyond 7231 and they are standards too.

@hkosova
Copy link
Contributor

hkosova commented Feb 18, 2021

OAS refers not only to RFC 7231 but also to the IANA registry:

https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.1.0.md#http-status-codes

HTTP Status Codes
The available status codes are defined by RFC7231 and registered status codes are listed in the IANA Status Code Registry.

RFC 7231 itself points to the IANA registry for the complete list of codes:

Note that this list is not exhaustive -- it does not include extension status codes defined in other specifications. The complete list of status codes is maintained by IANA.


Maybe the intended meaning here is that the definition of "HTTP status code" is taken from RFC 7231 (i.e. it's a 3-digit integer in the 100-599 range), and for specific registered status codes the reader should refer to the IANA registry?

@philsturgeon
Copy link
Contributor

@hkosova sounds good!

@ioggstream
Copy link
Contributor Author

@hkosova exactly, the text just need a slight rewording. Feel free to PR with your text... or I'll do it tomorrow if you don't have time.

@MikeRalphson
Copy link
Member

@ioggstream @hkosova woudl one of you like to take a go at that proposed PR?

@ioggstream
Copy link
Contributor Author

The httpwg is releasing the new http spec. I will create a PR next week but we could even wait for the new spec to be released so that we have the latest references.

ioggstream added a commit to ioggstream/OpenAPI-Specification that referenced this issue Jun 25, 2021
ioggstream added a commit to ioggstream/OpenAPI-Specification that referenced this issue Jul 5, 2021
webron pushed a commit that referenced this issue Nov 18, 2021
* Fix: #2471. Clarify status code text.

* Update versions/3.1.1.md

Co-authored-by: Darrel <darrmi@microsoft.com>

Co-authored-by: Darrel <darrmi@microsoft.com>
@MikeRalphson
Copy link
Member

#2630 was merged. Thanks all.

@ioggstream
Copy link
Contributor Author

@MikeRalphson sorry for the delay. The PR is ok. Thanks!

charjr pushed a commit to charjr/OpenAPI-Specification that referenced this issue Apr 27, 2023
* Fix: OAI#2471. Clarify status code text.

* Update versions/3.1.1.md

Co-authored-by: Darrel <darrmi@microsoft.com>

Co-authored-by: Darrel <darrmi@microsoft.com>
charjr pushed a commit to charjr/OpenAPI-Specification that referenced this issue Apr 27, 2023
* Fix: OAI#2471. Clarify status code text.

* Update versions/3.1.1.md

Co-authored-by: Darrel <darrmi@microsoft.com>

Co-authored-by: Darrel <darrmi@microsoft.com>
@handrews handrews added this to the v3.1.1 milestone May 22, 2024
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 a pull request may close this issue.

5 participants