Skip to content

v3.1.2: Root XML element name comes from component name #4576

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 1 commit into
base: v3.1-dev
Choose a base branch
from

Conversation

handrews
Copy link
Member

@handrews handrews commented May 13, 2025

Fixes #1435 (as much as can be in a patch release)

Clarifies that the name of the root XML element comes from the component name, which was shown in an example but was unclear due to the use of the obsolete OAS 2.0 terminology "model."

This does not change the restriction (in the xml field of the Schema Object) that the xml field only applies to property schemas (and not root schemas).

  • 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

Clarifies that the name of the root XML element comes from
the component name, which was shown in an example but was unclear
due to the use of the obsolete OAS 2.0 terminology "model."

This does not change the restriction (in the `xml` field of the
Schema Object) that the `xml` field only applies to property
schemas (and not root schemas).
@handrews handrews added this to the v3.1.2 milestone May 13, 2025
@handrews handrews requested review from a team as code owners May 13, 2025 17:06
@handrews handrews added xml 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) labels May 13, 2025
@@ -3447,7 +3447,7 @@ See examples for expected behavior.

| Field Name | Type | Description |
| ---- | :----: | ---- |
| <a name="xml-name"></a>name | `string` | Replaces the name of the element/attribute used for the described schema property. When defined within `items`, it will affect the name of the individual XML elements within the list. When defined alongside `type` being `"array"` (outside the `items`), it will affect the wrapping element if and only if `wrapped` is `true`. If `wrapped` is `false`, it will be ignored. |
| <a name="xml-name"></a>name | `string` | Replaces the name of the element/attribute used for the described schema property. For the root XML element, the name comes from the [schema component](#components-schemas) name; for other elements or attributes, the name comes from the property name. When defined within `items`, it will affect the name of the individual XML elements within the list. When defined alongside `type` being `"array"` (outside the `items`), it will affect the wrapping element if and only if `wrapped` is `true`. If `wrapped` is `false`, it will be ignored. |
Copy link
Contributor

Choose a reason for hiding this comment

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

Some implementations allow the xml fixed field in any Schema Object, including the Schema Object for the root XML element, and use its name value for the XML element name. If absent, the name of the XML element (or attribute) is the name of the name/value pair whose value is the Schema Object.

Which is straight-forward and what I would have expected, without the funny restriction to "property schemas", a term that is nowhere defined.

I'd not reinforce the surprising restriction to "property schemas" further, or at least add that implementations MAY allow it in any Schema Object, including the one for the XML root element.

@ralfhandl ralfhandl requested a review from a team May 15, 2025 07:13
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) xml
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants