restful-react
restful-react copied to clipboard
Default array query-parameter stringify format is not comply with the OAS3 spec
Describe the bug
Calling get method in below query parameter, this library generated url is http://xxxx/api?ary[0]=3&ary[1]=1&ary[2]=4
parameters:
- in: query
name: ary
schema:
type: array
items:
type: integer
But in spec https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.3.md#fixed-fields-10 ,
default is style=form and explode=true.
This configuration generated url is http://xxxx/api?ary=3&ary=1&ary=4.
To Reproduce
Steps to reproduce the behavior:
- write query parameter with array type
- generate client-side code
- call useGet
- fetch to
http://xxxx/api?ary[0]=3&ary[1]=1&ary[2]=4
Expected behavior
fetch to http://xxxx/api?ary=3&ary=1&ary=4
Workaround
Add queryParamStringifyOptions {arrayFormat: 'repeat'} on RestfulProvider like #278
This is great! Looking into it!