Skip to content

Parameter schema specification via content #3421

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

Closed
commonism opened this issue Oct 27, 2023 · 8 comments
Closed

Parameter schema specification via content #3421

commonism opened this issue Oct 27, 2023 · 8 comments
Assignees
Labels
clarification requests to clarify, but not change, part of the spec media and encoding Issues regarding media type support and how to encode data (outside of query/path params) param serialization Issues related to parameter and/or header serialization
Milestone

Comments

@commonism
Copy link
Contributor

commonism commented Oct 27, 2023

I'd like to clarify the purpose of the Parameter Object schema specification depending on the media type via content.

For more complex scenarios, the content property can define the media type and schema of the parameter.

What is this complex scenario?
Having different media types defined for the body, the parameters schema should depend on the media type of the body?

  parameters:
    DefinedParameter:
      in: query
      name: value
      required: true
      style: form
      explode: false
      content:
        "application/json":
          schema:
            type: integer
            default: 5
          example: 5
        "multipart/form-data":
          schema:
            type: object
            $ref: ""

If the Media Type Object encoding property is not to be used when used with Parameter Objects, so the encoding of possibly different parameter types is set by the parameter independent of the schema.
If the encoding is free be used for Parameter Objects… for an object this will combine different encodings for the objects properties?

@commonism
Copy link
Contributor Author

Can we agree on purpose unknown - mark as deprecated?

@handrews
Copy link
Member

@commonism note that your example is not allowed by the spec as it uses two media types:

content: A map containing the representations for the parameter. The key is the media type and the value describes it. The map MUST only contain one entry.

The OAS also does not allow using an Encoding Object with the Media Type Object in this scenario:

encoding: A map between a property name and its encoding information. The key, being the property name, MUST exist in the schema as a property. The encoding object SHALL only apply to requestBody objects when the media type is multipart or application/x-www-form-urlencoded.

Note the restriction to Request Body Objects.

All the content field of the Parameter Object really does is allow examples to be specified alongside of the schema. We could definitely clarify this in some patch releases.

@handrews
Copy link
Member

didn't mean to close (for once!)

@handrews handrews reopened this Jan 24, 2024
@commonism
Copy link
Contributor Author

Hi,

great news, easier than I anticipated.

encoding: … . The encoding object SHALL only apply to requestBody objects when the media type is multipart or application/x-www-form-urlencoded.
It does not apply to Parameter, Header or any other objects.

@handrews handrews modified the milestones: v3.1.1, v3.0.4 Jan 27, 2024
@handrews
Copy link
Member

Sounds like the answer of "it doesn't apply to parameters" is accepted and there's no additional change needed to the spec. Please comment if I'm missing something here and I can re-open.

@commonism
Copy link
Contributor Author

I tried to propose adding

It does not apply to Parameter, Header or any other objects.

or, merging into

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

@handrews
Copy link
Member

Oh I did not understand your formatting as making a proposal.

Hmm... I can see how one might read this as talking about when it applies to Request Body objects, and not necessarily excluding other objects. I'll re-open and tag as a clarification for consideration in a patch release.

@handrews handrews reopened this Jan 30, 2024
@handrews handrews added clarification requests to clarify, but not change, part of the spec param serialization Issues related to parameter and/or header serialization media and encoding Issues regarding media type support and how to encode data (outside of query/path params) labels Jan 30, 2024
@handrews handrews self-assigned this Apr 20, 2024
@lornajane
Copy link
Contributor

Fixed by @handrews in #3724 #3756 #3757 (Thanks Henry!)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
clarification requests to clarify, but not change, part of the spec media and encoding Issues regarding media type support and how to encode data (outside of query/path params) param serialization Issues related to parameter and/or header serialization
Projects
None yet
Development

No branches or pull requests

4 participants