Property 'allowEmptyValue' is only allowed for query parameters
Issue ID: semantic-parameter-allowemptyvalue
Description
The parameter in question has the allowEmptyValue
property defined, but it is not a query
or a formData
parameter. Only query
and formData
parameters can have the allowEmptyValue
property defined.
For more details, see the OpenAPI Specification.
Example
The following is an example of how this issue could look in your API definition. The parameter has allowEmptyValue
set to true
, but in
is set to header
:
{
"parameters":[
{
"name": "myAPIparameter",
"type": "string",
"in": "header",
"required": true,
"pattern": "^([a-zA-Z0-9_=]{4,100})\\.([a-zA-Z0-9_=]{4,100})\\.([a-zA-Z0-9_\\-\\+\\/=]{4,100})$",
"maxLength": 300,
"allowEmptyValue": true
}
// ...
]
}
Remediation
Make sure that only query
and formData
parameters have the allowEmptyValue
property.
{
"parameters":[
{
"name": "myAPIparameter",
"type": "string",
"in": "query",
"required": true,
"pattern": "^([a-zA-Z0-9_=]{4,100})\\.([a-zA-Z0-9_=]{4,100})\\.([a-zA-Z0-9_\\-\\+\\/=]{4,100})$",
"maxLength": 300,
"allowEmptyValue": true
}
// ...
]
}