no-content-type-header-in-encoding-headers
Overview
This rule belongs to the openapi-v3-standards-validation ruleset and states that:
The Content-Type header must not be explicitly defined in the Encoding Object headers section as it is described separately in the contentType section of the Encoding Object. If a definition is found, it will be ignored.
| Property | Value |
|---|---|
| Enabled | Yes |
| Maximum Severity | Warning |
| Message | Content-Type header definition found in encoding headers section. |
| Code | OPENAPI3STANDARDS_V145 |
| Type | Validation |
| Rule System | Semantic |
| Broad Category | Encoding |
| Products Impacted | API Transformer, Code Generation, Developer Experience Portal |
| Tags | openapi3 openapi standards semantic validation headers content type encoding |
Suggested Fixes
- Remove the header named Content-Type from the Encoding Object headers list.
- Relocate the Content-Type information to the
contentTypeproperty in the same Encoding Object.
For More Information
- 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#encoding-object
- https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#openapi-specification
- https://docs.apimatic.io/rulesets/overview/