single-discriminator-declaration-in-schema-hierarchy
Overview
This rule belongs to the openapi-v3-apimatic-linting
ruleset and states that:
A discriminated schema should not redefine the discriminator property. The discriminator property is defined at the root level of the schema and serves to differentiate between subtypes. Redefining the discriminator property within subtypes can lead to inconsistencies and conflicts.
Property | Value |
---|---|
Enabled | Yes |
Maximum Severity | Error |
Message | Discriminated schema redefines discrimintor property. |
Code | OPENAPI3APIMATIC_L698 |
Type | Linting |
Rule System | Semantic |
Broad Category | OpenAPI Schemas |
Products Impacted | API Transformer, Code Generation, Developer Experience Portal |
Tags | openapi3 openapi apimatic semantic linting single discriminator declaration schema hierarchy |
Suggested Fixes
- Remove the re-declaration of discriminator in subtypes.
- Declare discriminator once in the base schema only.