Property 'allowEmptyValue' is only allowed for query parameters

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:

1parameters:
2  - name: myAPIparameter
3    type: string
4    in: header
5    required: true
6    pattern: ^([a-zA-Z0-9_=]{4,100})\.([a-zA-Z0-9_=]{4,100})\.([a-zA-Z0-9_\-\+\/=]{4,100})$
7    maxLength: 300
8    allowEmptyValue: true
9  # ...
10

Remediation

Make sure that only query and formData parameters have the allowEmptyValue property.

1parameters:
2  - name: myAPIparameter
3    type: string
4    in: query
5    required: true
6    pattern: ^([a-zA-Z0-9_=]{4,100})\.([a-zA-Z0-9_=]{4,100})\.([a-zA-Z0-9_\-\+\/=]{4,100})$
7    maxLength: 300
8    allowEmptyValue: true
9  # ...
10

Copyright 42Crunch 2021