Skip to main content

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.

PropertyValue
EnabledYes
Maximum SeverityWarning
MessageXML wrapped definition has no effect on the current non-array schema.
CodeOPENAPI3STANDARDS_L262
TypeLinting
Rule SystemSemantic
Broad CategoryXML
Products ImpactedAPI Transformer, Code Generation, Developer Experience Portal
Tagsopenapi3 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 a type set as array.
  • 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