discriminator-mapping-value-for-each-one-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 oneOf
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 oneOf list. |
Code | OPENAPI3APIMATIC_L806 |
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 oneof schema |
Suggested Fixes
- Make sure that a discriminator mapping value is provided for all schemas involved in
oneOf
list. - Make sure that the schema name or reference used in the discriminator mapping value match exactly with the schemas involved in
oneOf
list. - Names are compared in a case-sensitive manner.
- Remove the schemas from the
oneOf
that have missing mapping information.