I'm trying to figure out how to document two of my query parameters in OpenAPI.
Filtering
My filtering follows the recommendations of JSON:API, which takes the form of, for example:
?filter[post]=1,2,3
?filter[post]=1,2,3&filter[author]=5
The filter
key is an associative array that can contain a set list of resource names in my API. The value assigned to each filter key is either a single id or list of comma separated ids.
Sorting
For sorting also follows the JSON:API recommendation, so something like these:
?sort=age
?sort=age,-height
The sort
query parameter is assigned the value of one sort field or list of comma separated sort fields. Note that the minus sign that prefixes the height
field indicates a descending sort.
Question
How do I represent the my filtering and sorting in OpenAPI?
For example, I'm not sure it's possible for me to specify that the filter key is an associative array, or that it accepts a comma separated list of ids. Almost the same issue for sort: how to represent a comma separated list of sort fields?