Skip to content

v4.0.0

Choose a tag to compare

@aleclarson aleclarson released this 24 May 19:13
· 19 commits to main since this release

What changed

Rouzer v4 removes the low-level client request descriptor API and makes generated, route-backed clients the only supported client shape.

Breaking changes

  • createClient now requires routes.
    • Use createClient({ baseURL, routes }) and call generated action functions like client.users.get(...).
  • HTTP actions no longer expose nested .request(...) factories.
  • Generated clients no longer expose client.request(...) or client.json(...) helpers.
  • The client metadata property was renamed from config to clientConfig.
    • This allows route trees to define an action named config without being overwritten, so client.config(...) can be a route.

Why

The removed request factory path was ambiguous for nested resources because action-local factories did not carry parent resource paths. Requiring createClient({ routes }) keeps URL construction, validation, response maps, and response plugins on the same generated action path.

Migration

Before:

const client = createClient({ baseURL })
await client.json(routes.getUser.request({ path: { id: '42' } }))

After:

const client = createClient({ baseURL, routes })
await client.getUser({ path: { id: '42' } })

If you read the client options from the returned client, use client.clientConfig instead of client.config.

Full Changelog: v3.2.0...v4.0.0