openapi-to-graphql
openapi-to-graphql copied to clipboard
Adds query string serialization optimization
👋
This PR introduces the serialization of the query string, when the explode
attribute has been set. When defined the actual serialization includes a duplication of the parameter. Otherwise arrays will be serialized in a comma-separated way.
Example with explode
turned off:
http://localhost:3004/api/robots?types=Droid%2CBot
Example with explode
turned on:
http://localhost:3004/api/robots?types=Droid&types=Bot
This also activates the useQuerystring
mode in request
so that the query string gets encoded properly (#308).
I ran into the "problem" today, when using query string parameters which are typed as arrays
and wanted to help to fix that. So this is my PR 🙂
@akoenig This is an awesome change!!! Thank you so much! We're in the middle of trying to get our 2.1.0 version out and I will try to get this in right after!
@Alan-Cha @akoenig how will this work when you have a nested object ?
> q = {filter: { first_name: 'hello', last_name: 'world'}}
{ filter: { first_name: 'hello', last_name: 'world' } }
> querystring.stringify(q)
'filter='