Open
Description
Description
When working with APIs that accept array query parameters, sometimes data structures that differ from arrays are used to keep track of these parameters before requests.
For example, when passing an array of IDs as a query parameter, the code responsible for keeping the IDs might use a Set
to ensure all IDs are unique.
When passing this Set
into an openapi-fetch request, it must be converted to an array like so:
const client = createClient(...);
const itemsIds = new Set(["id-1", "id-1", "id-1"]); // Set {"id-1"}
await client.GET("/some/path", {
params: {
query: {
ids: Array.from(itemIds) // or [...itemIds]
}
}
});
Proposal
I propose that both the types and internals for openapi-fetch be modified to support Iterable data structures so that users don't need to convert structures into an array before using in openapi-fetch requests.
Checklist
- I’m willing to open a PR for this (see CONTRIBUTING.md)
Metadata
Metadata
Assignees
Labels
Type
Projects
Status
No status