Parameter defines both a schema property and a content property
Issue ID: v3-validation-parameter-schema-content-present
Description
You have defined both the schema and content properties for one or more parameter objects in your API. Each parameter must have either schema or content property defined, but not both.
For more details, see the OpenAPI Specification.
Example
The following is an example of how this issue could look in your API definition:
{
"/pets/{id}": {
"get": {
"description": "Returns a user based on a single ID, if the user does not have access to the pet",
"operationId": "find pet by id",
"parameters": [
{
"name": "id",
"in": "path",
"description": "ID of pet to fetch",
"required": true,
"schema": {
"type": "integer",
"format": "int64"
},
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/user"
}
}
}
}
]
}
}
}
Remediation
Make sure that you have defined either the schema
or content
property for all parameter
objects in your API.
{
"/pets/{id}": {
"get": {
"description": "Returns a user based on a single ID, if the user does not have access to the pet",
"operationId": "find pet by id",
"parameters": [
{
"name": "id",
"in": "path",
"description": "ID of pet to fetch",
"required": true,
"schema": {
"type": "integer",
"additionalProperties": false,
"format": "int64"
}
}
]
}
}
}