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

First pass at a media types registry. #4517

Open
wants to merge 4 commits into
base: gh-pages
Choose a base branch
from

Conversation

handrews
Copy link
Member

@handrews handrews commented Mar 29, 2025

This attempts to explain the basics of what is going on in terms of "modeling" (what you do with a Schema Object and in-memory data structures) and "mapping" (how you translate that model into something that fits a particular media type that can be serialized onto, or parsed off of, the wire).

This includes some sequential / streaming formats that will be added for 3.2, as well as a selection of media types directly addressed in the OAS text. We could add more, for example image/* that is more-or-less identical to application/octet-stream, but this gives the general idea.

I omitted YAML since AFAIK it is rarely used in actual API payloads, and such use is not directly mentioned in the OAS.

  • schema changes are included in this pull request
  • schema changes are needed for this pull request but not done yet
  • no schema changes are needed for this pull request

This attempts to explain the basics of what is going on
in terms of "modeling" (what you do with a Schema Object
and in-memory data structures) and "mapping" (how you translate
that model into something that fits a particular media type
that can be serialized onto, or parsed off of, the wire).

This includes some sequential / streaming formats that will
be added for 3.2, as well as a selection of media types
directly addressed in the OAS text.  We could add more,
for example `image/*` that is more-or-less identical
to `application/octet-stream`, but this gives the general idea.

I omitted YAML since AFAIK it is rarely used in actual API payloads,
and such use is not directly mentioned in the OAS.
@handrews handrews added media and encoding Issues regarding media type support and how to encode data (outside of query/path params) registries Related to any or all spec.openapis.org-hosted registries labels Mar 29, 2025
@handrews handrews added this to the v3.2.0 milestone Mar 29, 2025
@handrews handrews requested review from philsturgeon, dret and a team March 29, 2025 01:56
Copy link
Contributor

@duncanbeevers duncanbeevers left a comment

Choose a reason for hiding this comment

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

This seems like a great initial proposal.

I think each section needs to be fleshed-out with examples, including OpenAPI schemas, representative payloads, and supporting configuration, but all of that can happen incrementally on top of this.


# Media Type Registry

This registry defines how to use the Schema Object, Media Type Object, and in some cases other Objects to model media types other than `application/json` or media types using a `+json` suffix.
Copy link
Contributor

Choose a reason for hiding this comment

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

❤️

@handrews
Copy link
Member Author

handrews commented Mar 29, 2025

@duncanbeevers examples, schemas, representative payloads, etc. all belong on the learn site. All of the registries are bare-bones references, and this one is in line with that pattern. Contributions to the Learn site are encouraged :-)

@handrews
Copy link
Member Author

@duncanbeevers I do think that if/when we have that content on the Learn site, we should link to it directly from here (and similarly for other registries).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
media and encoding Issues regarding media type support and how to encode data (outside of query/path params) registries Related to any or all spec.openapis.org-hosted registries
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants