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

Adds query string serialization optimization #312

Closed
wants to merge 2 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10,883 changes: 1,207 additions & 9,676 deletions packages/openapi-to-graphql-cli/package-lock.json

Large diffs are not rendered by default.

12 changes: 11 additions & 1 deletion packages/openapi-to-graphql/lib/oas_3_tools.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion packages/openapi-to-graphql/lib/oas_3_tools.js.map

Large diffs are not rendered by default.

9 changes: 8 additions & 1 deletion packages/openapi-to-graphql/lib/resolver_builder.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion packages/openapi-to-graphql/lib/resolver_builder.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion packages/openapi-to-graphql/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 12 additions & 1 deletion packages/openapi-to-graphql/src/oas_3_tools.ts
Original file line number Diff line number Diff line change
@@ -422,7 +422,18 @@ export function instantiatePathAndGetQuery(

// Query parameters
case 'query':
query[param.name] = args[sanitizedParamName]
/**
* Spec-compliant query string serialization:
* http:pec.openapis.org/oas/v3.0.3#style-examples
*
* Whenever the query string value is an array, we check if it
* should be `exploded`. In this case, we don't serialize anything.
* Otherwise, the array will be joined in comma-separated fashion.
*/
const arg = args[sanitizedParamName]
const shouldBeCommaSeparated = Array.isArray(arg) && !param.explode

query[param.name] = shouldBeCommaSeparated ? arg.join(',') : arg
break

// Header parameters
Loading