Skip to main content

discriminator-mapping-value-a-valid-model-name

Overview

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

Discriminator mapping value must specify the name of the concrete type/model to which the discriminator value needs to be mapped to. This information is useful for deserialization purposes. Therefore, the value must be non-null, non-empty and match exactly with the name of a pre-defined custom type or model.

PropertyValue
EnabledYes
Maximum SeverityError
MessageDiscriminator mapping value is not a valid model name.
CodeAPIMATICPRE_V585
TypeValidation
Rule SystemSemantic
Broad CategoryGlobal Types/Models
Products ImpactedCode Generation, Developer Experience Portal, API Transformer
Tagspreliminary checks validation apimatic discriminator mapping value discriminator mapping discriminator custom type model complex model type global type combinators anyOf oneOf not

Suggested Fixes

  • Make sure that the discriminator mapping values are not null or empty.
  • Ensure that the discriminator mapping values are valid custom type/model names which are globally defined under the Custom Types list.
  • Mapping value name is compared in a case-sensitive manner.