discriminator-mapping-values-for-all-involved-models
Overview
This rule belongs to the apimatic-preliminary-validation ruleset and states that:
Discriminator mapping values indicate possible values that a discriminator property can have in a data and which concrete models they map to. This helps in the deserialization process. It is, therefore, expected that a mapping value is provided for each of the models involved in the type combinator definition and a missing value for any model would indicate incomplete information.
| Property | Value |
|---|---|
| Enabled | Yes |
| Maximum Severity | Warning |
| Message | Discriminator mapping value information is missing for one or more models. |
| Code | APIMATICPRE_V587 |
| Type | Validation |
| Rule System | Semantic |
| Broad Category | Global Types/Models |
| Products Impacted | Code Generation, Developer Experience Portal, API Transformer |
| Tags | preliminary checks validation apimatic discriminator mapping values discriminator mapping discriminator complex model complex type model custom type global type combinators anyOf oneOf not |
Suggested Fixes
- Make sure that a discriminator mapping value is provided for all model/object types involved in the type combinator (anyOf, oneOf, not) definition.
- Make sure that the model name in the discriminator mapping value matches exactly with the name of the model/object types involved in the type combinator (anyOf, oneOf, not) definition.
- Names are compared in a case-sensitive manner.
- Remove the models from the type combinator definition that have missing mapping information.