Skip to content
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

feat(parsers): ignore sibling elements of $ref according to OpenAPI 3.0 specification #11

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

catcombo
Copy link
Contributor

@catcombo catcombo commented Nov 1, 2024

According to OpenAPI 3.0 specification object containing $ref cannot be extended with additional properties and any properties added SHALL be ignored. We already have problems in our auto-generated code when description from object containing $ref overrides schema description.

In OpenAPI 3.1 summary and description are allowed, but I would like to concentrate on one spec version and extend code later if needed. Because right now it'll take more efforts to implement different behavior based on the spec version. Spec version should be also correctly handled in other parts of the code. Since our specs are 3.0 it shouldn't be a problem for now.

Comment on lines +74 to +76
return (
resolve_reference(schema["$ref"])
if "$ref" in schema

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you want to ignore any extra properties silently or throw an exception when that happens?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I want to ignore extra properties. It's validator responsibility to raise an exception. Unfortunately, in our case validator runs after JSON schema resolving. This should be fixed in the future.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants