xml-wrapped-only-for-arrays
Overview
This rule belongs to the openapi-v3-standards-linting
ruleset and states that:
The XML wrapped definition takes effect only when defined alongside type being array (outside the items). This means that the property wrapped
in the xml
definition must be used only if the schema type
is set as array
.
Property | Value |
---|---|
Enabled | Yes |
Maximum Severity | Warning |
Message | XML wrapped definition has no effect on the current non-array schema. |
Code | OPENAPI3STANDARDS_L262 |
Type | Linting |
Rule System | Semantic |
Broad Category | XML |
Products Impacted | API Transformer, Code Generation, Developer Experience Portal |
Tags | openapi3 openapi standards semantic linting xml array items wrapping schema |
Suggested Fixes
- Ensure that if
wrapped
is used, the schema in which the XML information is provided has atype
set asarray
. - If your schema instance is not expected to have multiple elements i.e. it is not an array schema, consider removing the property
wrapped
from the XML definition outside the items schema. - If your XML data can have multiple element occurrences for the current schema definition, consider changing the schema type to array.
For More Information
- https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#xml-object
- https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#schema-object
- https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#xml-object
- https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#schema-object
- https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md
- https://docs.apimatic.io/rulesets/overview/