Add support for query parameters in generated http request to match OAS query parameters serialization expectation #426
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Hi,
I discovered that the style formatting for query parameters as defined in the Open API Specification is not being respected.
Given the partial definition;
where
SomeSchemaInput
has properties offilter
andlimit
for example, I found that the http request made for the generated GraphQL resolver is of the format;http://{baseUrl}/api/path?parameters[limit]=10¶meters[offset]=10
.The http request url should be
http://{baseUrl}/api/path?limit=10&offset=10
considering the provided values forstyle
andexplode
, as defined in Open API specification.I've added a PR to support this behaviour although both for objects and arrays, I have not made
style: form
the default as defined here https://swagger.io/docs/specification/serialization/ for queries.I've also realized that even with the changes I've made some of the standard behaviour of arrays are ignored because of how the query params get constructed for object like primitives as seen here https://github.com/IBM/openapi-to-graphql/blob/master/packages/openapi-to-graphql/src/resolver_builder.ts#L1332-L1335, this related to #312 where a solution with used the native query string implementation was introduced. I'd be willing to take on the effort to make parameters behaviour in the package match the standard open api behaviour.