Skip to main content

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.

PropertyValue
EnabledYes
Maximum SeverityError
MessageDiscriminator mapping value information is missing for one or more schemas defined in anyOf list.
CodeOPENAPI3APIMATIC_L807
TypeLinting
Rule SystemSemantic
Broad CategoryOpenAPI Discriminators
Products ImpactedAPI Transformer, Code Generation, Developer Experience Portal
Tagsopenapi3 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.

For More Information