-
-
Notifications
You must be signed in to change notification settings - Fork 555
Open
Labels
bugSomething isn't workingSomething isn't workingopenapi-fetchRelevant to the openapi-fetch libraryRelevant to the openapi-fetch library
Description
openapi-fetch version
0.14.0
Description
When there is an endpoint with ID parm - /actions/{id}
and it accepts params.path.id: string
- in that case ID equal to ''
(empty string)
Then openapi-fetch implicitly parses endpoint to /actions
and for types connected with ActionDto
I get implicitly ActionDto[]
Reproduction
export const getAction = async ({ params }: ActionParams) => {
const { data, error, response } = await fetchClient.GET('/actions/{id}', { params });
return data;
}
getAction({ params: { path: { id: '' } } }) // => [ActionObj, ActionObj]
Expected result
export const getAction = async ({ params }: ActionParams) => {
const { data, error, response } = await fetchClient.GET('/actions/{id}', { params });
return data;
}
getAction({ params: { path: { id: '' } } }) // => Error404 or whatever the API returns
Extra
- I’m willing to open a PR (see CONTRIBUTING.md)
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't workingopenapi-fetchRelevant to the openapi-fetch libraryRelevant to the openapi-fetch library