Skip to main content

single-discriminator-declaration-in-schema-hierarchy

Overview

This rule belongs to the openapi-v3-apimatic-linting ruleset and states that:

A discriminated schema should not redefine the discriminator property. The discriminator property is defined at the root level of the schema and serves to differentiate between subtypes. Redefining the discriminator property within subtypes can lead to inconsistencies and conflicts.

PropertyValue
EnabledYes
Maximum SeverityError
MessageDiscriminated schema redefines discrimintor property.
CodeOPENAPI3APIMATIC_L698
TypeLinting
Rule SystemSemantic
Broad CategoryOpenAPI Schemas
Products ImpactedAPI Transformer, Code Generation, Developer Experience Portal
Tagsopenapi3 openapi apimatic semantic linting single discriminator declaration schema hierarchy

Suggested Fixes

  • Remove the re-declaration of discriminator in subtypes.
  • Declare discriminator once in the base schema only.

For More Information