no-schema-xml-in-root-schema
Overview
This rule belongs to the openapi-v3-standards-linting
ruleset and states that:
A Schema Object can add XML related metadata using the xml
property. This metadata is only effective if the schema under consideration is not a root schema e.g. it may be used in a schema property definition from a Schema Object properties
but not in a schema defined/referenced directly under the Parameter Object, Header Object or a Media Type Object.
Property | Value |
---|---|
Enabled | No |
Maximum Severity | Warning |
Message | Schema XML metadata has no effect on this schema. |
Code | OPENAPI3STANDARDS_L155 |
Type | Linting |
Rule System | Semantic |
Broad Category | Schemas |
Products Impacted | API Transformer, Code Generation, Developer Experience Portal |
Tags | openapi3 openapi standards semantic linting xml property schema |
Suggested Fixes
- Remove
xml
metadata property from the current schema. - It is better to use the XML metadata in an Schema Object only if it is defining a property from the
properties
object. - Remove occurrences of XML metadata from root schemas.
- In an OpenAPI document a schema directly defined or referenced in a Parameter Object, Header Object or Media Type Object is considered a root schema.
For More Information
- 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.1.0.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#xml-object
- https://github.com/OAI/OpenAPI-Specification/issues/1435
- https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md
- https://docs.apimatic.io/rulesets/overview/