Closed erangeles closed 1 year ago
Update: I got this working below
const queryParams = new URLSearchParams();
queryParams.append('env', 'production');
queryParams.append('env', 'staging');
const { data, error } = useGetResources({
queryParams,
});
@erangeles could you please share your swagger.json
file btw?
I tried reproducing it, and got the correct typescript code:
if (data !== undefined && data !== null)
data && data.forEach(item => { url_ += "data=" + encodeURIComponent("" + item) + "&"; });
url_ = url_.replace(/[?&]$/, "");
I used the following swagger (generated automatically by NSwag):
"/query/ArrayInQuery": {
"get": {
"tags": ["Query"],
"operationId": "Query_ArrayInQuery",
"parameters": [
{
"name": "data",
"in": "query",
"style": "form",
"explode": true,
"schema": {
"type": "array",
"nullable": true,
"items": {
"type": "string"
}
},
"x-position": 1
}
],
"responses": {
"200": {
"description": "",
"content": {
"application/json": {
"schema": {
"type": "array",
"items": {
"type": "string"
}
}
}
}
}
}
}
}
Hello, I have an API endpoint that has this pattern
{url}?env=staging&env=production
— i can’t get any of the generated types / clients to support thatoutput:
{url}/endpoint?env=production%2Cstaging
expected output:
{url}/endpoint?env=production&env=staging