Skip to main content

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.

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

For More Information