Closed cloudbring closed 1 year ago
Would this be better implemented as a plugin, or will this require a PR to Zodios itself?
Hello,
Thank you for the proposal,
Since query parameters are not standardized at all,
Zodios implements the most common pattern in practice.
So any custom format should be implemented in a plugin.
Zodios will not provide one. Since there are hundred of custom query formats in the wild, and zodios can't support them all.
So i suggest you implement your custom serializer in your code base as a plugin.
No need to do a PR to zodios. You can already add your custom 'operator' to your api definition, zodios and typescript will not complain.
You can then write your plugin to use the 'operator' keyword and forward your serializer to axios :
See paramsSerializer
in axios documentation on how to implement a custom query param serializer.
Thanks for the feedback. Once I'm done with my current project, I'll take a stab at making a Zodios plugin for this using paramsSerializer.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
closing. But feel free to share the results with the community
First, love this project and being able to define APIs in a type-safe way.
The issue I'm trying to solve is I have to support a bunch of query parameters that aren't just
/foo?field=value
.Example Query Parameters:
Proposal
If we define a url query as consisting of a field, a value and an operator, I want to support various operators.
Create an optional
operator
field on the parameters object.Usage:
Create a new
RAW_QUERY
query type that exposes the full parameter string (everything between and excluding the?
and&
characters).Usage: