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

Support for multiple media types #4081

Open
lcawl opened this issue Mar 24, 2025 · 0 comments
Open

Support for multiple media types #4081

lcawl opened this issue Mar 24, 2025 · 0 comments

Comments

@lcawl
Copy link
Contributor

lcawl commented Mar 24, 2025

🚀 Feature Proposal

Add a method to specify the supported medias type for each request and response body.
If multiple media types are supported, we'll need a method (such as folder or file names?) to indicate which type each example pertains to.

Motivation

In OpenAPI documents, you can have request and response bodies that support various media types per https://spec.openapis.org/oas/v3.0.3#media-types
For example, the cat API (e.g cat aliases returns text/plain responses by default and you can use the format query parameter to get back JSON, YAML, etc.

It does not seem like we currently have a way to represent these media types in the current specifications.
I am converting the text/plain examples to json to work with the existing system, but it would be good to be able to specify the media type explicitly.

Example

When we were manually curating the examples, it looked like this (i.e. the cat aliases API responses could have both JSON and text formats:

    cat.aliases#200:
      description: ''
      content:
        application/json:
          schema:
            type: array
            items:
              "$ref": "#/components/schemas/cat.aliases:AliasesRecord"
        text/plain:
          schema:
            type: string
          examples:
            catAliasesResponseExample1:
              "$ref": "#/components/examples/CatAliasesResponseExample1"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant