request-body-encoding-only-for-form-media-types
Overview
This rule belongs to the openapi-v3-standards-validation
ruleset and states that:
A Request Body Object can only define encoding information for its content if the media type of the content is specified as multipart
or application/x-www-form-urlencoded
.
Property | Value |
---|---|
Enabled | Yes |
Maximum Severity | Warning |
Message | Encoding information is not applicable for the current Request Body Object media type. |
Code | OPENAPI3STANDARDS_V135 |
Type | Validation |
Rule System | Semantic |
Broad Category | Media Types |
Products Impacted | API Transformer, Code Generation, Developer Experience Portal |
Tags | openapi3 openapi standards semantic validation encoding form request body body media type |
Suggested Fixes
- Remove property
encoding
from the Media Type Object referenced in the Request Body Object if the corresponding media type is notmultipart
orapplication/x-www-form-urlencoded
. - Make sure you are referencing the correct Media Type Object in the Request Body Object content map.
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#request-body-object
- 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#encoding-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#request-body-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#encoding-object
- https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#openapi-specification
- https://docs.apimatic.io/rulesets/overview/