schema-content-media-type-exists-for-content-schema
Overview
This rule belongs to the openapi-v3-standards-linting
ruleset and states that:
The property contentSchema
should only be used when the property contentMediaType
is also set in the same Schema Object. If contentMediaType
is not present, contentSchema
will be ignored.
Property | Value |
---|---|
Enabled | Yes |
Maximum Severity | Warning |
Message | Missing corresponding contentMediaType property in the Schema Object for contentSchema . |
Code | OPENAPI3STANDARDS_L189 |
Type | Linting |
Rule System | Semantic |
Broad Category | Schemas |
Products Impacted | API Transformer, Code Generation, Developer Experience Portal |
Tags | openapi3 openapi standards semantic linting content media type content schema media type schema |
Suggested Fixes
- Define the property
contentMediaType
in the Schema Object along withcontentSchema
. - Remove the property
contentSchema
from the Schema Object ifcontentMediaType
property is not expected to be set.
For More Information
- https://datatracker.ietf.org/doc/html/draft-bhutton-json-schema-validation-00#section-8.5
- https://datatracker.ietf.org/doc/html/draft-bhutton-json-schema-validation-00#section-8.4
- 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.0.3.md
- https://docs.apimatic.io/rulesets/overview/