-
Notifications
You must be signed in to change notification settings - Fork 9k
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(spec): codify Encoding in specific requestBody mediatypes #3837
base: main
Are you sure you want to change the base?
feat(spec): codify Encoding in specific requestBody mediatypes #3837
Conversation
the specification indicates > The encoding object SHALL only apply to requestBody objects when the media type is multipart or application/x-www-form-urlencoded. Co-authored-by: Fiel, Jeremy <[email protected]>
Also paging @karenetheridge |
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've suggested a change although if you feel strongly about it it's not a hill I care to die on :-)
schemas/v3.0/schema.yaml
Outdated
patternProperties: | ||
'^application/x-www-form-urlencoded$|^multipart\/.+$': | ||
$ref: '#/definitions/MediaTypeWithEncoding' |
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.
Nice!
Minor concern that this would prevent |
@OAI/tsc I think what is needed here is a policy on whether field combinations that are said to be ignored or to not apply can be forbidden by the schema or not. That would help us decide a lot of schema design issues, rather than having to re-think each proposed restriction. There are quite a few places in the spec with this kind of language, and we should treat them consistently in the schemas. I'd be fine with either way the TSC wants to decide this - if it is decided that ignored/non-applicable things can be forbidden in the schema, then I'm fine with this PR being merged. |
schemas/v3.0/schema.yaml
Outdated
@@ -763,6 +783,9 @@ definitions: | |||
type: object | |||
additionalProperties: | |||
$ref: '#/definitions/MediaType' | |||
patternProperties: | |||
'\*\/\*|^application/x-www-form-urlencoded$|^multipart\/.+$': |
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.
Should */*
have ^
/$
anchors?
Should application/*
be matched, as that would apply to application/x-www-form-urlencoded
?
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.
what is the purpose of the anchors? Why would it be needed?
I see your point on the above. I'll update that
application/*
would match any application
media type and that's not what we want here., although that would enable quite a few different media types to allow encoding
schema. Matching */*
was only for backwards compatibility per Darrell's comment.
@handrews on this point:
My opinion is that if the spec says a field combination must be ignored or not apply, then we can make these forbidden by the schema. |
the specification indicates
This PR codifies that behavior in the JSON Schema to enable validation.
Per the Development.md, this change was already merged to the Specification on this PR