media-type-examples-override-media-schema-example
Overview
This rule belongs to the openapi-v3-standards-validation
ruleset and states that:
An example for a media type can be provided in two ways: either directly in the Media Type Object using the examples
property or in the Schema Object definition when specifying the media type level schema
property. If an example is provided at both levels, the Media Type Object level examples
will override the Schema Object level example
.
Property | Value |
---|---|
Enabled | Yes |
Maximum Severity | Information |
Message | Media Type level examples found that override the example present in the media type's schema definition. |
Code | OPENAPI3STANDARDS_V133 |
Type | Validation |
Rule System | Semantic |
Broad Category | Media Types |
Products Impacted | API Transformer, Developer Experience Portal |
Tags | openapi3 openapi standards semantic validation examples media type schema |
Suggested Fixes
- If the Schema Object does not add any new example value as compared to the Media Type Object
examples
, and the schema is inline, it might be a good idea to remove the schema levelexample
.
For More Information
- https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#media-type-object
- 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#media-type-object
- https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#schema-object
- https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#openapi-specification
- https://docs.apimatic.io/rulesets/overview/