Handle binary formats for pre-3.1#2966
Draft
Youssef1313 wants to merge 1 commit into
Draft
Conversation
Youssef1313
force-pushed
the
dev/ygerges/handle-formats
branch
from
July 18, 2026 05:40
0d972bf to
cdbd348
Compare
Youssef1313
force-pushed
the
dev/ygerges/handle-formats
branch
from
July 18, 2026 05:49
cdbd348 to
fb7d260
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The OpenApiSchema model is supposed to represent the latest version of the spec, and adjust accordingly when serializing to older versions.
This PR handles how binary formats are serialized. This means that users can simply define the model properly per the latest version and per the way the object model is designed, and we get correct serialized output for versions earlier than 3.1.
See https://spec.openapis.org/oas/v3.2.0.html#migrating-binary-descriptions-from-oas-3-0 from the spec.
Specifically,
type: string, contentEncoding: base64should map totype: string, format: bytefor versions older than 3.1.In addition, if
contentMediaTypeis specified (without specifying contentEncoding or type), then the format maps tobinary.