Skip to main content

no-additional-property-in-discriminator-object

Overview

This rule belongs to the openapi-v3-standards-validation ruleset and states that:

In OpenAPI v3.0.x, the Discriminator Object cannot be extended with additional properties with or without the use of specification extensions (i.e. properties with names beginning with x-). Only the properties listed explicitly in the specification document for this object can be used and any other properties cannot be added. This rule does not apply to OpenAPI 3.1.x documents.

PropertyValue
EnabledYes
Maximum SeverityWarning
MessageAdditional property found in the Discriminator Object.
CodeOPENAPI3STANDARDS_V401
TypeValidation
Rule SystemSemantic
Broad CategoryDiscriminators
Products ImpactedAPI Transformer, Code Generation, Developer Experience Portal
Tagsopenapi3 openapi standards semantic validation additional property specification extensions vendor extensions extension discriminator

Suggested Fixes

  • Remove any extra properties from the Discriminator Object that are not explicitly part of the official set of properties made available by the OpenAPI standard document.
  • Remove any properties from the Discriminator Object that have names beginning with 'x-'.

For More Information