-
-
Notifications
You must be signed in to change notification settings - Fork 19
Open
Description
Bug description
When defining a route with two path parameters (for example /users/:userId/posts/:postId), the generated client incorrectly places both parameters in the first call to tuyau.users({...}). As a result, the second parameter (postId) is not scoped to the .posts() call as expected.
What’s happening
For a route like:
GET /users/:userId/posts/:postId
The generated client ends up like this:
await tuyau.users({ userId, postId }).posts().$get()So both userId and postId are passed together in the .users() call.
Expected behavior
I would expect the client to allow chaining the parameters for each segment, like:
await tuyau
.users({ userId })
.posts({ postId })
.$get()Meaning the parameter for the posts segment should be passed in the .posts({ … }) call.
Steps to reproduce
- Define a route with two path parameters, for example:
router.get('/users/:userId/posts/:postId', 'PostsController.show')- Generate the API client.
- Try to call it like:
await tuyau.users({ userId, postId }).posts({}).$get()- Observe that
postIdstays withusers()instead of being scoped to.posts().
Environment
- @tuyau/core: 0.4.2
- Node: v22.18.0
- OS: Windows 11
Metadata
Metadata
Assignees
Labels
No labels