discriminator-mapping-value-for-each-any-of-schema
Overview
This rule belongs to the openapi-v3-apimatic-linting
ruleset and states that:
Discriminator mapping values indicate possible schemas that a payload can be deserialized into, based on the discriminator property. Therefore, it is expected that a mapping value is provided for each of the schemas involved in the anyOf
list. A missing value for any schema may cause deserialization issues in the generated code.
Property | Value |
---|---|
Enabled | Yes |
Maximum Severity | Error |
Message | Discriminator mapping value information is missing for one or more schemas defined in anyOf list. |
Code | OPENAPI3APIMATIC_L807 |
Type | Linting |
Rule System | Semantic |
Broad Category | OpenAPI Discriminators |
Products Impacted | API Transformer, Code Generation, Developer Experience Portal |
Tags | openapi3 openapi apimatic semantic linting discriminator mapping value anyof schema |
Suggested Fixes
- Make sure that a discriminator mapping value is provided for all schemas involved in
anyOf
list. - Make sure that the schema name or reference used in the discriminator mapping value match exactly with the schemas involved in
anyOf
list. - Names are compared in a case-sensitive manner.
- Remove the schemas from the
anyOf
that have missing mapping information.