Custom Query Param Serialization in fetch Client #2368
Unanswered
sina-saeedi
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Hi everyone,
I’m using Orval with the fetch client and noticed a limitation with query parameter serialization. The generated code uses URLSearchParams.toString(), which doesn’t support indexed arrays or custom formats:
const stringifiedParams = new URLSearchParams(params).toString();
I know Orval allows providing a custom fetch client, but the challenge is that it still generates the full URL and passes that to my custom fetch. To apply custom serialization, I’d have to parse the URL back into parameters, reserialize them in my desired format, and then reconstruct the URL which feels redundant and less optimal.
Is there a known pattern for handling this that I'm missing?
Beta Was this translation helpful? Give feedback.
All reactions