Skip to content

v3.3: remove invalid mention of prefixEncoding, itemEncoding here#5441

Open
karenetheridge wants to merge 2 commits into
OAI:v3.3-devfrom
karenetheridge:ether/invalid-prefixEncoding
Open

v3.3: remove invalid mention of prefixEncoding, itemEncoding here#5441
karenetheridge wants to merge 2 commits into
OAI:v3.3-devfrom
karenetheridge:ether/invalid-prefixEncoding

Conversation

@karenetheridge

Copy link
Copy Markdown
Member

In section 4.14.5.2 (Encoding by Position) we already said: "To use the prefixEncoding and/or itemEncoding fields, either itemSchema or a schema indicating an array type MUST be present.", however there is no parallel guidance in 4.14.5.1 (Encoding by Name) that says that the encoding field MUST also have a schema indicating an object type present.

(I already edited this sentence earlier in this release cycle to add mention of prefixEncoding alongside itemEncoding, but this entire sentence is inconsistent with the previous section, so we should either remove this sentence entirely, or soften the previous statement about prefixEncoding and itemEncoding requiring an array schema.)

  • no schema changes are needed for this pull request

In section 4.14.5.2 (Encoding by Position) we already said: "To use the
prefixEncoding and/or itemEncoding fields, either itemSchema or a schema
indicating an array type MUST be present.", however there is no parallel
guidance in 4.14.5.1 (Encoding by Name) that says that the encoding field MUST
also have a schema indicating an object type present.
@karenetheridge
karenetheridge requested review from a team as code owners July 20, 2026 22:48
@karenetheridge karenetheridge changed the title remove invalid mention of prefixEncoding, itemEncoding here v3.3: remove invalid mention of prefixEncoding, itemEncoding here Jul 20, 2026
This is the same phrasing as in "Encoding by Name" which states that the
`encoding` fields do nothing if they don't have a corresponding data
instance.
@karenetheridge
karenetheridge force-pushed the ether/invalid-prefixEncoding branch from 7cc6e85 to 82fb935 Compare July 21, 2026 00:21

@karenetheridge karenetheridge left a comment

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

some extra commentary here as I keep re-reading various sections of the spec and noticing inconsistencies between them, or things that we mandate without a clear reason for doing so.

Comment thread src/oas.md
##### Additional Encoding Approaches

The `prefixEncoding` and/or `itemEncoding` fields, and/or usage of a [`schema` indicating an array type](#non-json-data) (or `itemSchema`), can be used with any `multipart` content to require a fixed part order.
Usage of a [`schema` indicating an array type](#non-json-data) (or `itemSchema`), can be used with any `multipart` content to produce a fixed part order.

@karenetheridge karenetheridge Jul 21, 2026

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

I don't much like this statement either, because it is redundant for multipart content that is not form-data: other multipart types can only be deserialized to an array, as they have no part names, so there should be no need for a schema (or an encoding object, for that matter, if the part values are all ordinary strings, and even if they're serialized values, e.g. application/json, we don't need an encoding object to make use of Content-Type on the parts).

Comment thread src/oas.md
For applications that wish to preserve part order, `multipart/form-data` content may also be modelled as an array, with one item per part, in order (where each item consists of an object containing the name/value pair); the `schema` SHALL be used to determine whether deserializing to an `object` or an `array` is preferred. See examples in [Media Type Registry: Forms](https://spec.openapis.org/registry/media-type/forms).

To use the `prefixEncoding` and/or `itemEncoding` fields, either `itemSchema` or a [`schema` indicating an array type](#non-json-data) MUST be present.
To use the `prefixEncoding` and/or `itemEncoding` fields, each item referenced by the field MUST exist in the data instance; `prefixEncoding` and `itemEncoding` entries with no corresponding item SHALL be ignored.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

This is mostly obvious, since if there is no data to operate on, what would the encoding object even do? but it is consistent with Encoding by Name.

The part that is removed also brings consistency with Encoding by Name, which does not require that type: object must exist in the schema, nor even does it require that there is a properties entry for each individual part name. Both multipart/form-data and multipart/mixed can be successfully serialized from their original object or array representations without either a schema or an encoding object, and deep objects can be deserialized successfully as well if Content-Type headers are included.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant