media-type-encoding-property-exists-in-schema
Overview
This rule belongs to the openapi-v3-standards-validation
ruleset and states that:
If encoding information is provided for a Media Type Object, the encoding key must indicate name of the property which needs to be encoded. The property indicated this way must be pre-defined in the definition of the property schema
of the Media Type Object.
Property | Value |
---|---|
Enabled | Yes |
Maximum Severity | Error |
Message | Property name specified in encoding map of the Media Type Object is not defined in its schema definition. |
Code | OPENAPI3STANDARDS_V134 |
Type | Validation |
Rule System | Semantic |
Broad Category | Media Types |
Products Impacted | API Transformer, Code Generation, Developer Experience Portal |
Tags | openapi3 openapi standards semantic validation property encoding media type schema |
Suggested Fixes
- The Schema Object referenced in the
schema
property of the Media Type Object must consist of a definition for the property in itsproperties
list. - The name of the property specified in the encoding information of Media Type Object must match exactly with the name of the property in the schema definition.
- Names are compared in a case-sensitive manner.
- If you do not wish to add a schema level entry for the property, remove entry for the property from the encoding information of the Media Type Object.
For More Information
- https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#mediaTypeEncoding
- 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#mediaTypeEncoding
- 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/