Skip to main content

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.

PropertyValue
EnabledNo
Maximum SeverityWarning
MessageSchema XML metadata has no effect on this schema.
CodeOPENAPI3STANDARDS_L155
TypeLinting
Rule SystemSemantic
Broad CategorySchemas
Products ImpactedAPI Transformer, Code Generation, Developer Experience Portal
Tagsopenapi3 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