required-discriminator-with-discriminator-mapping
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. Therefore, the discriminator property name must be present when defining the mapping information.
| Property | Value |
|---|---|
| Enabled | Yes |
| Maximum Severity | Warning |
| Message | Discriminator mapping values are present but no discriminator property was specified. |
| Code | APIMATICPRE_V586 |
| 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 global type combinators anyOf oneOf not |
Suggested Fixes
- Make sure that the discriminator property is specified in the type definition.
- Make sure that the discriminator property is not null or empty.
- Remove the discriminator mapping information if no discriminator property is specified.