Skip to content

v3.2: Allow Parameter/Header examples w/content #4802

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

Open
wants to merge 3 commits into
base: v3.2-dev
Choose a base branch
from

Conversation

handrews
Copy link
Member

Note: This replaces PR #4648, except for the examples which are in PR #4801.

Parameter and Header serialization is complex, particularly when using the content field to use a Media Type Object.

In such scenarios, the serialization occurs in two steps: The first step is to serialize the data to the media type, which can be captured by the examples field of the Media Type Object.

The second is the encoding/escaping of the media type document for use in a URI, HTTP header, or other location with its own rules.

Sometimes the part needing illustration with an example is at one level, sometimes at another, and sometimes it is helpful to show both.

For simplicity, the "data" examples are always treated as the overall input data, so they would be the same at both levels. This is also because it is not always possible to show each step, particularly when there are binary serializations. This allows showing either step (or both steps) with both data and serialization, depending on what makes sense for the use case.

  • 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

Parameter and Header serialization is complex, particularly when
using the `content` field to use a Media Type Object.

In such scenarios, the serialization occurs in two steps:
The first step is to serialize the data to the media type, which
can be captured by the `examples` field of the Media Type Object.

The second is the encoding/escaping of the media type document
for use in a URI, HTTP header, or other location with its own rules.

Sometimes the part needing illustration with an example is at one
level, sometimes at another, and sometimes it is helpful to show
both.

For simplicity, the "data" examples are always treated as the
overall input data, so they would be the same at both levels.
This is also because it is not always possible to show each step,
particularly when there are binary serializations. This allows
showing either step (or both steps) with both data and serialization,
depending on what makes sense for the use case.
@handrews handrews requested review from a team as code owners July 18, 2025 21:58
@handrews handrews added param serialization Issues related to parameter and/or header serialization headers labels Jul 18, 2025
@handrews handrews changed the title Allow Parameter/Header examples w/content v3.2: Allow Parameter/Header examples w/content Jul 19, 2025
miqui
miqui previously approved these changes Jul 19, 2025
@ralfhandl ralfhandl requested a review from a team July 19, 2025 14:47
Copy link
Contributor

@ralfhandl ralfhandl left a comment

Choose a reason for hiding this comment

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

I think lines 2454 and 2455 should be removed, they have moved up to common fields.

@handrews
Copy link
Member Author

@ralfhandl good catch! There should be an award for catching things that aren't actually part of the diff, that's advance reviewing skills there!

@@ -733,6 +733,9 @@ $defs:
type: boolean
$ref: '#/$defs/examples'
$ref: '#/$defs/specification-extensions'
Copy link
Contributor

Choose a reason for hiding this comment

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

This line seems to be implied by the second allOf entry.

Copy link
Member Author

Choose a reason for hiding this comment

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

@ralfhandl thanks, fixed!

Let's only explain the validation requirements in one place.
Also, header example fields were supposed to be moved rather
than duplicatd but I missed the removal of the old ones.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
headers param serialization Issues related to parameter and/or header serialization
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants