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

Allow properties on $ref objects for OpenAPI 3.1. #958

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

Conversation

luhn
Copy link
Contributor

@luhn luhn commented Nov 23, 2024

JSON Schema draft 5 (OpenAPI 3.0.4), it specifically says additional properties on a $ref object are ignored.

All other properties in a "$ref" object MUST be ignored.

https://datatracker.ietf.org/doc/html/draft-wright-json-schema-00#section-7

However, draft 2020-12 (OpenAPI 3.1.0) seems to have changed its tune:

Its results are the results of the referenced schema. [[CREF5: Note
that this definition of how the results are determined means that other
keywords can appear alongside of "$ref" in the same schema object. ]]

https://datatracker.ietf.org/doc/html/draft-bhutton-json-schema-00#section-8.2.3.1

So if I'm understanding correctly, things like this are now valid and meaningful:

{
            "$ref": "#/components/schemas/Child",
            "description": "A category",
            "x-extension": "A great extension",
 }

JSON Schema draft 5 (OpenAPI 3.0.4), it specifically says additional
properties on a $ref object are ignored.

> All other properties in a "$ref" object MUST be ignored.

https://datatracker.ietf.org/doc/html/draft-wright-json-schema-00#section-7

However, draft 2020-12 seems to have changed its tune:

> Its results are the results of the referenced schema.  [[CREF5: Note
> that this definition of how the results are determined means that other
> keywords can appear alongside of "$ref" in the same schema object.  ]]

https://datatracker.ietf.org/doc/html/draft-bhutton-json-schema-00#section-8.2.3.1

If I'm interpreting this correctly, $ref now allows properties alongside
it.
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.

1 participant