dollar-schema-overrides-default-oas-schema-dialect
Overview
This rule belongs to the openapi-v3-standards-linting ruleset and states that:
If $schema is defined explicitly in a Schema Object of the OpenAPI document, it overrides the default schema dialect specified using jsonSchemaDialect in the OpenAPI Object or the implicit OpenAPI dialect schema Id https://spec.openapis.org/oas/3.1/dialect/base if jsonSchemaDialect is not set. An exception to this rule is for schemas defined in external non-OAS documents.
| Property | Value |
|---|---|
| Enabled | Yes |
| Maximum Severity | Information |
| Message | $schema used in Schema Object overrides the default OAS schema dialect. |
| Code | OPENAPI3STANDARDS_L157 |
| Type | Linting |
| Rule System | Semantic |
| Broad Category | Schemas |
| Products Impacted | API Transformer, Code Generation, Developer Experience Portal |
| Tags | openapi3 openapi standards semantic linting $schema dialect schema |
Suggested Fixes
- If you do not wish to override the default schema dialects (specified either using
jsonSchemaDialector via the implicit OAS dialect schema Id), consider removing the $schema property from Schema Objects of OAS documents.
For More Information
- https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#specifying-schema-dialects
- https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#dialectSchemaId
- https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#schema-object
- https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#openapi-object
- https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md
- https://docs.apimatic.io/rulesets/overview/