array-level-xml-name-for-wrapped-schemas-only
Overview
This rule belongs to the openapi-v3-standards-linting ruleset and states that:
When XML name is defined alongside type being array (outside the items), it will only affect the wrapping element. Therefore, it should be set only if wrapped is true. If wrapped is false, it will be ignored.
| Property | Value |
|---|---|
| Enabled | Yes |
| Maximum Severity | Warning |
| Message | XML name has been specified outside the array items schema which is not a wrapped schema. |
| Code | OPENAPI3STANDARDS_L261 |
| Type | Linting |
| Rule System | Semantic |
| Broad Category | XML |
| Products Impacted | API Transformer, Code Generation, Developer Experience Portal |
| Tags | openapi3 openapi standards semantic linting name xml array items wrapping schema |
Suggested Fixes
- Did you mean to define the XML name for the array items? If so, move this information from outer schema to within the
itemsschema definition. - Are your multiple XML elements expected to be wrapped in another XML element? If so, make sure you turn the
wrappedflag as true in the array schema (outside items) and provide any relevant details about it using thexmlproperty at the same level. - If you do not expect the XML elements to be wrapped in another XML element, remove the XML name provided in
xmlproperty at array schema level (outside items).
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/