Skip to main content

required-discriminator-with-discriminator-value

Overview

This rule belongs to the apimatic-preliminary-validation ruleset and states that:

If a discriminator value is provided in a model, a discriminator property name must also be set somewhere in the model or its type hierarchy along with the property's definition.

PropertyValue
EnabledYes
Maximum SeverityError
MessageDiscriminator value has been set even though no discriminator field found in the custom type or its hierarchy.
CodeAPIMATICPRE_V509
TypeValidation
Rule SystemSemantic
Broad CategoryGlobal Types/Models
Products ImpactedCode Generation, Developer Experience Portal, API Transformer
Tagspreliminary checks validation apimatic discriminator value discriminator base type inheritance type custom type model complex model

Suggested Fixes

  • Define a discriminator and the corresponding discriminator property in the model or its type hierarchy.
  • Remove the discriminator value from the model.

For More Information