media-type-example-overrides-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 example
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 example
will override the Schema Object level example
.
Property | Value |
---|---|
Enabled | Yes |
Maximum Severity | Information |
Message | Media Type level example found that overrides the example present in the media type's schema definition. |
Code | OPENAPI3STANDARDS_V132 |
Type | Validation |
Rule System | Semantic |
Broad Category | Media Types |
Products Impacted | API Transformer, Developer Experience Portal |
Tags | openapi3 openapi standards semantic validation example media type schema |
Suggested Fixes
- If the Schema Object does not add any new example value as compared to the Media Type Object
example
, 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/