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

Add support for comma separated query parameters #899

Open
tylerlittlefield opened this issue Jan 6, 2023 · 4 comments
Open

Add support for comma separated query parameters #899

tylerlittlefield opened this issue Jan 6, 2023 · 4 comments
Labels
theme: OpenAPI pertains to OpenAPI type: enhancement Adds a new, backwards-compatible feature

Comments

@tylerlittlefield
Copy link

tylerlittlefield commented Jan 6, 2023

Consider this plumber.R file:

library(plumber)

#* Sort letters
#* @param letters:[]
#* @json
#* @get /letters
function(letters) {
  sort(letters)
}

How do I change the request from this:

http://127.0.0.1:9203/letters?letters=a&letters=b

To this:

http://127.0.0.1:9203/letters?letters=a,b

Swagger docs on parameter serialization: https://swagger.io/docs/specification/serialization/

@slodge
Copy link

slodge commented Jan 12, 2023

This currently works for path variables:


#* Sort letters
#* @param letters:[string]
#* @json
#* @get /letters/<letters:[string]>
function(letters) {
  sort(letters)
}

image

(Also adding a note to self for the spec changes in PR #889)

@slodge
Copy link

slodge commented Jan 12, 2023

Docs on path variables are in https://www.rplumber.io/articles/routing-and-input.html

@meztez
Copy link
Collaborator

meztez commented Nov 20, 2023

@meztez meztez added type: enhancement Adds a new, backwards-compatible feature theme: OpenAPI pertains to OpenAPI labels Nov 24, 2023
@meztez
Copy link
Collaborator

meztez commented Nov 24, 2023

Note : Think about issue with number conversion. Comma in values? I remember we played with the idea but decided against it because it created more problems? There might be a smart way to do it that will appear with automated argument conversion.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
theme: OpenAPI pertains to OpenAPI type: enhancement Adds a new, backwards-compatible feature
Projects
None yet
Development

No branches or pull requests

3 participants