-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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
fix(petstore): Update petstore to conform with OpenAPI 3.0.3 spec #4637
fix(petstore): Update petstore to conform with OpenAPI 3.0.3 spec #4637
Conversation
Hi @rstular, Thanks for opening this up! You're absolutely correct, the petstore fixture should use appropriate status codes. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
@rstular thanks for this. Indeed the representation is not leveraging the HTTP status codes appropriately. I'd prefer to have consistent descriptions while we're at it. Could you modify such that:
|
The petstore YAML is not consistent with the OpenAPI schema 3.0.2 and 3.0.3 as it uses HTTP response code 405 incorrectly (OAI/OpenAPI-Specification#1486)
ec9c166
to
b5b0491
Compare
I've done that for all occurrences where both |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. @char0n this will likely have to be scheduled with updates to dependent components.
@frantuma can you please confirm that this change is aligned with https://github.com/swagger-api/swagger-petstore/ ? I've inspected the PetController.java and I could tell that Regarding to |
Swagger Petstore v3.0 current APIs implementation only return 400 or 404, no 422 or 405 are ever returned however this version is based on spec first inflector, and its OpenAPI spec is currently using 405 in some responses. We have a note to update that, not sure if it's so important to have editor and petstore aligned.. |
As @frantuma confirmed the changes in this PR are already closer to Petstore java implementation than the old definitions without these changes. I'm going for a merge and will follow up on applying these changes to the |
# [5.0.0-alpha.87](v5.0.0-alpha.86...v5.0.0-alpha.87) (2024-01-23) ### Bug Fixes * **content-fixtures:** update to conform with OpenAPI 3.0.3 spec ([#4728](#4728)) ([24b1c84](24b1c84)), closes [#4637](#4637) * **editor-content-fixtures:** fix typo in OpenAPI 2.0 ([#4708](#4708)) ([fca1f8b](fca1f8b)), closes [#4684](#4684) ### Features * add complete editing experience for OpenAPI 2.0 ([#4777](#4777)) ([b0c603b](b0c603b))
The petstore YAML is not consistent with the OpenAPI schema 3.0.2 and 3.0.3 as it uses HTTP response code 405 incorrectly (OAI/OpenAPI-Specification#1486)
Description
This changes the Pet store example schema to use HTTP return codes
422
and400
to indicate an invalid entity instead of using405
.400
is used to indicate that the syntax of the body is incorrect, and422
is used to indicate that the syntax is valid, but some other aspect of the body (e.g. its structure) makes it invalid.Motivation and Context
OpenAPI
3.0.2
has changed the description of the HTTP response code 405 fromInvalid input
toMethod not allowed
to conform with RFC7231 (see here).The pet store example schema has the version set to
3.0.3
, but it does not reflect the changes that were made to the response code description. This renders the example schema misleading, as it uses a non-standard description for the code.How Has This Been Tested?
Ran the tests using
npm run test
, as well as manually inspected the results by running a local instance (see screenshots below).Screenshots (if appropriate):
Checklist
My PR contains...
src/
is unmodified: changes to documentation, CI, metadata, etc.)package.json
)My changes...
Documentation
Automated tests