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

feat(spec): codify Encoding in specific requestBody mediatypes #3837

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

jeremyfiel
Copy link

the specification indicates

The encoding object SHALL only apply to requestBody objects when the media type is multipart or application/x-www-form-urlencoded.

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

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]>
@handrews
Copy link
Member

Also paging @karenetheridge

Copy link
Member

@handrews handrews left a 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.1/schema.yaml Show resolved Hide resolved
Comment on lines 786 to 788
patternProperties:
'^application/x-www-form-urlencoded$|^multipart\/.+$':
$ref: '#/definitions/MediaTypeWithEncoding'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice!

@jeremyfiel jeremyfiel requested a review from handrews May 22, 2024 19:35
@darrelmiller
Copy link
Member

Minor concern that this would prevent */* as a media type. Generally supportive of this addition.

@handrews
Copy link
Member

@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.

@@ -763,6 +783,9 @@ definitions:
type: object
additionalProperties:
$ref: '#/definitions/MediaType'
patternProperties:
'\*\/\*|^application/x-www-form-urlencoded$|^multipart\/.+$':
Copy link
Contributor

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?

Copy link
Author

@jeremyfiel jeremyfiel Jun 10, 2024

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.

@jeremyfiel jeremyfiel requested a review from notEthan June 10, 2024 17:16
@mikekistler
Copy link
Contributor

@handrews on this point:

@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.

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants