Skip to content

fix: fix type for Header.schema fixed field #4906

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
Aug 24, 2025

Conversation

char0n
Copy link
Contributor

@char0n char0n commented Aug 21, 2025

Affected section: https://spec.openapis.org/oas/v3.1.1.html#fixed-fields-for-use-with-schema-0

image

Schema Object | Reference Object would create ambiguity as both objects can only have $ref field. When Schema Object is a type for a field, it shouldn't use union with Reference Object as the Schema Object is already reference-able by itself.

  • schema changes are included in this pull request
  • schema changes are needed for this pull request but not done yet
  • no schema changes are needed for this pull request

@char0n char0n requested review from a team as code owners August 21, 2025 21:37
@handrews
Copy link
Member

Huh. We fixed this in 3.2 and must have missed it in 3.1.

@amritk
Copy link

amritk commented Aug 21, 2025

Thats funny I ran into this same issue last week!

@handrews
Copy link
Member

@amritk This is just a bug, so definitely treat it as Schema Object-only in any implementation. Anything in 3.1 where either the Schema Object or the Path Item Object is said to have a Reference Alternative is an error, as both of those Objects already have their own $ref fields which behave differently from the Reference Object (and from each other).

@amritk
Copy link

amritk commented Aug 21, 2025

@handrews does this mean any object can have a $ref now as it would be part of json schema?

@handrews
Copy link
Member

@amritk no I just mean that in OAS 3.1 (and later), the Schema Object includes JSON Schema's $ref keyword, so an Object with just a $ref that appears where a Schema Object is expected is still a Schema Object, with JSON Schema draft 2020-12's $ref behavior. In OAS 3.0, the Schema Object did not include JSON Schema's $ref, so a $ref where a Schema Object was expected was actually a Reference Object- which was written the way the line being changed here is written, as we just missed this when updating such lines for 3.1. And 3.1.1, apparently.

The thing with the Path Item Object dates back to 2.0 and is a different kind of weird. It also defines its own $ref keyword, with rather vague behavior regarding adjacent fields.

Everything else needs to allow a Reference Object in order to use $ref.

@amritk
Copy link

amritk commented Aug 21, 2025

Got you! Thanks for the clarification! We'll make those changes later this week

@ralfhandl ralfhandl requested a review from a team August 22, 2025 07:36
@ralfhandl ralfhandl added approved pr port PRs that just port an approved PR to another version headers labels Aug 22, 2025
@ralfhandl ralfhandl added this to the v3.1.2 milestone Aug 22, 2025
@miqui miqui merged commit 10633c5 into OAI:v3.1-dev Aug 24, 2025
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved pr port PRs that just port an approved PR to another version headers
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants