all-model-types-in-type-combinator-with-discriminator
Overview
This rule belongs to the apimatic-preliminary-validation ruleset and states that:
A discriminator property in a global type combinator definition helps simplify deserialization of model types. This means that the types involved must be complex objects. If only primitive types are expected, a discriminator property is not applicable.
| Property | Value |
|---|---|
| Enabled | Yes |
| Maximum Severity | Error |
| Message | Discriminator property is not applicable in the current context. |
| Code | APIMATICPRE_V588 |
| 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 global type combinators type combinator type cases anyOf oneOf not models types custom types complex models |
Suggested Fixes
- Use a discriminator only when complex objects are involved in the type combinator (anyOf, oneOf, not) cases.
- Remove any primitive type entry from the type combinator (anyOf, oneOf, not) cases.
- Remove discriminator information if complex objects are not expected.