mvalle
4 years agoNew Contributor
How to define a query parameter without value not using allowEmptyValue?
I have a query parameter for which only its presence is important.
For example, I have a sort parameter that if present makes the returned list sorted, otherwise the list is unsorted one. For example: https://example.com/api/documents?sort returns a sorted list of documents.
Currently I model it in OpenAPI this way:
parameters:
- name: sort
in: query
description: If present the list is sorted
required: false
allowEmptyValue: true
schema:
type: boolean
But OpenAPI specifications suggests not to use allowEmptyValue because it will be removed in a future version of the specification.
That said, which is the correct way to define this kind of query parameter?
Thanks!
mario