Skip to content

Commit 385f279

Browse files
committed
Root XML element name comes from component name
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).
1 parent 80f5126 commit 385f279

File tree

1 file changed

+37
-30
lines changed

1 file changed

+37
-30
lines changed

src/oas.md

Lines changed: 37 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -3447,7 +3447,7 @@ See examples for expected behavior.
34473447

34483448
| Field Name | Type | Description |
34493449
| ---- | :----: | ---- |
3450-
| <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. |
3450+
| <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. |
34513451
| <a name="xml-namespace"></a>namespace | `string` | The URI of the namespace definition. Value MUST be in the form of a non-relative URI. |
34523452
| <a name="xml-prefix"></a>prefix | `string` | The prefix to be used for the [name](#xml-name). |
34533453
| <a name="xml-attribute"></a>attribute | `boolean` | Declares whether the property definition translates to an attribute instead of an element. Default value is `false`. |
@@ -3539,25 +3539,30 @@ animals:
35393539

35403540
###### XML Attribute, Prefix and Namespace
35413541

3542-
In this example, a full model definition is shown.
3542+
In this example, a full [schema component](#components-schemas) definition is shown.
3543+
Note that the name of the root XML element comes from the component name.
35433544

35443545
```json
35453546
{
3546-
"Person": {
3547-
"type": "object",
3548-
"properties": {
3549-
"id": {
3550-
"type": "integer",
3551-
"format": "int32",
3552-
"xml": {
3553-
"attribute": true
3554-
}
3555-
},
3556-
"name": {
3557-
"type": "string",
3558-
"xml": {
3559-
"namespace": "https://example.com/schema/sample",
3560-
"prefix": "sample"
3547+
"components": {
3548+
"schemas": {
3549+
"Person": {
3550+
"type": "object",
3551+
"properties": {
3552+
"id": {
3553+
"type": "integer",
3554+
"format": "int32",
3555+
"xml": {
3556+
"attribute": true
3557+
}
3558+
},
3559+
"name": {
3560+
"type": "string",
3561+
"xml": {
3562+
"namespace": "https://example.com/schema/sample",
3563+
"prefix": "sample"
3564+
}
3565+
}
35613566
}
35623567
}
35633568
}
@@ -3566,19 +3571,21 @@ In this example, a full model definition is shown.
35663571
```
35673572

35683573
```yaml
3569-
Person:
3570-
type: object
3571-
properties:
3572-
id:
3573-
type: integer
3574-
format: int32
3575-
xml:
3576-
attribute: true
3577-
name:
3578-
type: string
3579-
xml:
3580-
namespace: https://example.com/schema/sample
3581-
prefix: sample
3574+
components:
3575+
schemas:
3576+
Person:
3577+
type: object
3578+
properties:
3579+
id:
3580+
type: integer
3581+
format: int32
3582+
xml:
3583+
attribute: true
3584+
name:
3585+
type: string
3586+
xml:
3587+
namespace: https://example.com/schema/sample
3588+
prefix: sample
35823589
```
35833590

35843591
```xml

0 commit comments

Comments
 (0)