Header 'Content-Type' of an encoding object is ignored
Issue ID: v3-warning-encoding-header-content-type
Description
You have included Content-Type
in the headers
field of your encoding
object. However, for encoding
objects, Content-Type
is defined separately and is ignored inside the headers
field.
For more details, see the OpenAPI Specification.
Example
The following is an example of how this issue could look in your API definition:
{
"encoding": {
"historyMetadata": {
"contentType": "application/xml; charset=utf-8"
},
"profileImage": {
"headers": {
"Content-Type": {
"contentType": "image/png, image/jpeg"
},
"X-Rate-Limit-Limit": {
"description": "The number of allowed requests in the current period",
"schema": {
"type": "integer"
}
}
}
}
}
}
Remediation
Make sure that you define Content-Type
separately, and not in the headers
field.
{
"encoding": {
"historyMetadata": {
"contentType": "application/xml; charset=utf-8"
},
"profileImage": {
"contentType": "image/png, image/jpeg",
"headers": {
"X-Rate-Limit-Limit": {
"description": "The number of allowed requests in the current period",
"schema": {
"type": "integer",
"additionalProperties": false
}
}
}
}
}
}