no-content-type-response-header-definition
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 Response Object headers section as the content section is dedicated for adding this information. If a definition is found, it will be ignored.
| Property | Value |
|---|---|
| Enabled | Yes |
| Maximum Severity | Warning |
| Message | Content-Type header definition found in response headers section. |
| Code | OPENAPI3STANDARDS_V198 |
| Type | Validation |
| Rule System | Semantic |
| Broad Category | Responses |
| Products Impacted | API Transformer, Code Generation, Developer Experience Portal |
| Tags | openapi3 openapi standards semantic validation headers content type response |
Suggested Fixes
- Remove the header named Content-Type from the Response Object headers list.
- Provide the information related to expected/allowed response content types using the Response Object
contentsection.
For More Information
- https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#response-object
- https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#response-object
- https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#openapi-specification
- https://docs.apimatic.io/rulesets/overview/