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

Allow for array query strings #309

Closed
daniel-white opened this issue May 4, 2022 · 5 comments · Fixed by #326
Closed

Allow for array query strings #309

daniel-white opened this issue May 4, 2022 · 5 comments · Fixed by #326

Comments

@daniel-white
Copy link

daniel-white commented May 4, 2022

I have a OAS 3.1 spec that has a query parameter that is an array but uses the non-exploded form such as ?type=main,secondary. The gateway using parse from ljharb/qs & parseQueryString does not seem to account for these additional options and the param ends up in a couple different ways

  1. ?type=main,secondary => "type": "main,secondary" => fails to validate
  2. ?type=main => "type": "main" => fails to validate
  3. ?type=main&type=secondary => "type": ["main", "secondary"] => validates fine

My param config:

{
  type: 'array',
  items: { type: 'string' },
  uniqueItems: true,
  minItems: 1,
  convert: true
}

Should parseQueryString be smarter and respect some other OAS options?

The docs are lacking and just indicate to read up on ljharb/qs

@intech
Copy link
Member

intech commented May 4, 2022

?type[]=main&type[]=secondary for more information, read this thread

@daniel-white
Copy link
Author

@daniel-parakey
Copy link
Contributor

@intech is there a reason we are not allowed to specify this ourselves? For example through passing qsOptions in settings and using it here?

@intech
Copy link
Member

intech commented Jun 26, 2023

@daniel-parakey, welcome for PR for this feature :)

@daniel-parakey
Copy link
Contributor

@intech thoughts? #326

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants