Forum Discussion

mvalle's avatar
New Contributor
3 years ago

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: returns a sorted list of documents.

Currently I model it in OpenAPI this way:

        - name: sort
          in: query
          description: If present the list is sorted
          required: false
          allowEmptyValue: true
            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?