-
Notifications
You must be signed in to change notification settings - Fork 9.2k
format: byte also defaults to octet-stream (3.0.4) #3922
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
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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.
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.
So
binaryandbyteare synonyms for serializing parts of a multipart request body? Any guidance on which is the preferred synonym?Also: why does
encodingand the Encoding Object not apply to multipart response bodies?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.
I am uncomfortable with this change. In general, I think
format: bytemeans "base64 encoded" and the purpose of base64 encoding is to make the value safe for a string field.Also, the "considerations for multipart" section in 3.0.3 does not actually mention
format: byte-- it mentionsformat: base64, which not only is absent from the "formats defined by the OAS" table in the "Data Types" section but is not even listed in the Formats registry.My conclusion here is that the "considerations for multipart" section is actually the place to be corrected by removing
format: base64.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.
Note: the
format: base64typo in 3.0.3 has been corrected in 3.0.4 via #3182.Not mentioning
format: bytehere (by closing this PR without merging) would make me feel more comfortable.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.
@ralfhandl
binaryandbyteare not synonyms, and are explained in he "Data Types" section, particularly in the "Working with Binary Data" subsection.It applies to
multipartandapplication/x-www-form-urlencoded, but what does that have to do with this PR?@mikekistler
It's not a change. I just made a mistake and forgot to include it and no one caught it because there had been a mistake in another part of the text which made it look like only
binaryis correct But that was wrong.The reason is that, in
multipart,Content-Typerefers to the actual content type of the data part. The encoding that makes it safe for a string is placed inContent-Transfer-Type. This should be a bit more clear after PR #3923. So yes, it is made safe for a string, but no, it does not change theContent-Typeheader, and therefore does not change the default forcontentTypecompared toformat: binary.The spec has always stated that
format: bytedefaultsapplication/octet-stream, and in 3.1 it states even more clearly that anycontentEncoding(including but not limited tobase64) defaults toapplication/octet-stream. So this is not a change.As @ralfhandl mentioned,
base64was always an error and had been fixed - if you look in PR #3923 you'll see it was alreadyformat: bytein 3.0.4. I know we discussed whether to addbase64to the registry but I guess we decided not to, and to emphasize thatbytewas correct. I can't find the discussion right now. Either way, whetherbase64is in the registry is irrelevant to this PR.goes with:
@ralfhandl
That would make the spec incorrect. It's inconsistent with the text from the Media Type object (which is more complete and correct in both 3.0 and 3.1) and is inconsistent with how the analogous
contentEncodingis used in 3.1.This PR is just a bug fix.
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.
@mikekistler in response to your question in the TDC call, the
Content-Transfer-Encodingrequirement is in the last paragraph of this section (or, more accurately, it will be after PR #3923 is merged - that rendering includes both that PR and this one).And yes, I want to acknowledge that 3.0.3 was not at all clear about
Content-Transfer-Encoding, and the inconsistent use ofbyteandbase64made things worse. (bytewas always what was defined in the "Data Types" section, but 3.0.3 and earlier mistakenly usedbase64in some examples - we debated it a lot b/c obviouslybase64is what would be used anywhere else, but we ultimately agreedbytewas what had been intended and is what should be used.)