Skip to main content



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

If a discriminator is set for a model, it must have a corresponding discriminator field/property defined in its fields.

Maximum SeverityError
MessageDiscriminator field/property definition is missing in the model.
Rule SystemSemantic
Broad CategoryGlobal Types/Models
Products ImpactedCode Generation, Developer Experience Portal, API Transformer
Tagspreliminary checks validation apimatic discriminator field property type custom type model complex model

Suggested Fixes

  • Make sure that if you have a discriminator set for a model, then an explicit discriminator field/property definition is also added in the same model's fields/properties.
  • The name of the discriminator property/field must exactly match the name of the discriminator set in the model/type definition.
  • Only a string typed discriminator property/field is currently supported.