xml-wrapped-only-for-array-schema-type
Overview
This rule belongs to the openapi-v3-apimatic-linting
ruleset and states that:
In OpenAPI specifications, XML serialization (wrapped) can be used to describe how to serialize and deserialize XML documents. The wrapped style applies to array schema types and defines how XML elements are named when representing arrays. This rule enforces the requirement that the wrapped style can only be used with array schema types to ensure that the schema is properly defined and can be used correctly.
Property | Value |
---|---|
Enabled | Yes |
Maximum Severity | Error |
Message | XML wrapped is only allowed for array schema type. |
Code | OPENAPI3APIMATIC_L845 |
Type | Linting |
Rule System | Semantic |
Broad Category | OpenAPI XML |
Products Impacted | API Transformer, Code Generation, Developer Experience Portal |
Tags | openapi3 openapi apimatic semantic linting xml array items wrapping schema |
Suggested Fixes
- Check the OpenAPI specification to confirm if any non-array schema types have the wrapped style specified.
- If any non-array schema types have the wrapped style specified, remove the style from the schema definition.
- 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/