I want to specify a query parameter called fields
that can be sent as a string list with multiple possible values in my OpenAPI 3 specification.
i.e., all of these are valid for my purposes:
fields=name
fields=title,abstract
fields=name,title,abstract
I was going to use the enum
type (as below), but it occurs to me this is wrong, as this means only one of the given values should be used.
"fields": {
"name": "fields",
"in": "query",
"description": "The data fields to be returned from the response.",
"required": false,
"schema": {
"type": "string",
"enum": [
"name",
"title",
"abstract"
]
}
},
How do I specify a list of possible valid options? Do I have to use the pattern
field and a regex? Or is there a better way?