OpenAPI-Specification
OpenAPI-Specification copied to clipboard
Expand Style Examples
Looking at the Style Examples I cannot see what style I should use in the following instance:
A parameter in: query of type: array such that I could accept the following query string: ?param[]=X¶m[]=Y
If someone could enlighten me on this (and any other examples you can think of that might be missing) I would be happy to make a PR that adds them.
Is that querystring format defined somewhere?
@MikeRalphson
It seems I can't find an RFC for that format, it's simply how PHP formats and parses query strings. i.e. http_build_query().
@charjr I believe [] must be part of the parameter's name, other than that it's a standard exploded form-style array. Exploded form is the default style for query parameters.
# ?param[]=X¶m[]=Y
parameters:
- in: query
name: 'param[]' # <-----
schema:
type: array
items:
type: string
example: [X, Y]
style: form # 'style' and 'explode' can be omitted here
explode: true # because these are the default values
Looks like this has been answered, so I'm going to close this - please open a new issue if there are remaining questions.
Note that [ and ] are technically not allowed in URLs (except in IPv6 literals), but that doesn't seem to stop people using them 🤦 and I guess it mostly works? I'll be addressing this in the PR for #3759 so no need to track it here.