valid-discriminator-mapping-key
Overview
This rule belongs to the openapi-v3-syntax-validation
ruleset and states that:
Discriminator mapping keys must be string values.
Property | Value |
---|---|
Enabled | Yes |
Maximum Severity | Error |
Message | Discriminator mapping key is not a string value. |
Code | OPENAPI3SYNTAX_V160 |
Type | Validation |
Rule System | Syntax |
Broad Category | Discriminators |
Products Impacted | API Transformer, Code Generation, Developer Experience Portal |
Tags | openapi3 openapi syntax validation key discriminator mapping discriminator string |
Suggested Fixes
- If the value is a number or boolean, surround it in single or double quotes so it can be treated correctly as a string.
- Only string values are allowed as discriminator mapping keys.
For More Information
- https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#discriminator-object
- https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#discriminator-object
- https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#openapi-specification
- https://docs.apimatic.io/rulesets/overview/