-
-
Notifications
You must be signed in to change notification settings - Fork 581
Open
Labels
PRs welcomePRs are welcome to solve this issue!PRs are welcome to solve this issue!enhancementNew feature or requestNew feature or requestgood first issueStraightforward problem, solvable for first-time contributors without deep knowledge of the projectStraightforward problem, solvable for first-time contributors without deep knowledge of the projectopenapi-fetchRelevant to the openapi-fetch libraryRelevant to the openapi-fetch library
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
PRs welcomePRs are welcome to solve this issue!PRs are welcome to solve this issue!enhancementNew feature or requestNew feature or requestgood first issueStraightforward problem, solvable for first-time contributors without deep knowledge of the projectStraightforward problem, solvable for first-time contributors without deep knowledge of the projectopenapi-fetchRelevant to the openapi-fetch libraryRelevant to the openapi-fetch library
Type
Projects
Status
No status