Ensures that XML objects do not use the nodeType field together with the deprecated attribute or wrapped field.
| OAS | Compatibility |
|---|---|
| 2.0 | ❌ |
| 3.0 | ❌ |
| 3.1 | ❌ |
| 3.2 | ✅ |
OpenAPI 3.2 adds the nodeType field to the XML Object and deprecates the attribute and wrapped fields. The specification does not allow a deprecated field in an XML object that has nodeType, because the two can contradict each other.
This rule reports the following combinations:
- An XML object with both
nodeTypeandattribute. Removeattribute, becausenodeTypereplaces it:nodeType: attributein place ofattribute: true. - An XML object with both
nodeTypeandwrapped. Removewrapped, becausenodeTypereplaces it:nodeType: elementin place ofwrapped: true.
| Option | Type | Description |
|---|---|---|
| severity | string | Possible values: off, warn, error. Default error (in recommended configuration). |
An example configuration:
rules:
spec-no-invalid-xml-combinations: error
Given this configuration:
rules:
spec-no-invalid-xml-combinations: error
Example of incorrect XML objects:
components:
schemas:
MenuItem:
type: object
properties:
id:
type: string
xml:
attribute: true
nodeType: attribute
tags:
type: array
xml:
wrapped: true
nodeType: element
items:
type: string
Example of correct XML objects:
components:
schemas:
MenuItem:
type: object
properties:
id:
type: string
xml:
nodeType: attribute
tags:
type: array
xml:
nodeType: element
items:
type: string