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.
| Property | Value |
|---|---|
| Enabled | Yes |
| Maximum Severity | Error |
| Message | Discriminator value has been set even though no discriminator field found in the custom type or its hierarchy. |
| Code | APIMATICPRE_V509 |
| 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 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.