Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Expand Style Examples #3250

Closed
charjr opened this issue Apr 16, 2023 · 4 comments
Closed

Expand Style Examples #3250

charjr opened this issue Apr 16, 2023 · 4 comments
Labels
examples requests for more or better examples in the specification param serialization Issues related to parameter and/or header serialization

Comments

@charjr
Copy link

charjr commented Apr 16, 2023

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&param[]=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.

@MikeRalphson
Copy link
Member

Is that querystring format defined somewhere?

@charjr
Copy link
Author

charjr commented Apr 17, 2023

@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().

@handrews handrews added the examples requests for more or better examples in the specification label Jan 27, 2024
@hkosova
Copy link
Contributor

hkosova commented May 2, 2024

@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&param[]=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

@handrews handrews added the param serialization Issues related to parameter and/or header serialization label May 23, 2024
@handrews
Copy link
Member

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
examples requests for more or better examples in the specification param serialization Issues related to parameter and/or header serialization
Projects
None yet
Development

No branches or pull requests

4 participants