no-additional-property-in-discriminator-object
Overview
This rule belongs to the openapi-v3-standards-validation
ruleset and states that:
In OpenAPI v3.0.x, the Discriminator Object cannot be extended with additional properties with or without the use of specification extensions (i.e. properties with names beginning with x-). Only the properties listed explicitly in the specification document for this object can be used and any other properties cannot be added. This rule does not apply to OpenAPI 3.1.x documents.
Property | Value |
---|---|
Enabled | Yes |
Maximum Severity | Warning |
Message | Additional property found in the Discriminator Object. |
Code | OPENAPI3STANDARDS_V401 |
Type | Validation |
Rule System | Semantic |
Broad Category | Discriminators |
Products Impacted | API Transformer, Code Generation, Developer Experience Portal |
Tags | openapi3 openapi standards semantic validation additional property specification extensions vendor extensions extension discriminator |
Suggested Fixes
- Remove any extra properties from the Discriminator Object that are not explicitly part of the official set of properties made available by the OpenAPI standard document.
- Remove any properties from the Discriminator Object that have names beginning with 'x-'.
For More Information
- https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#specification-extensions
- 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/