Published: 2024-09-01
Kubb v3
Kubb v3 is a major release. Here is what changed.
What is Kubb?
Kubb generates code from OpenAPI specs: API clients, TypeScript types, Zod schemas, React Query hooks, and more. New to Kubb? Start with the docs.
What's new in v3?
- Updated plugin architecture
The plugin architecture was overhauled. Generation runs faster, and the CLI shows a progress bar so you can see what is running.
| Left: v3 | Right: v2 |
|---|
Tanstack Query integration also changed. Each framework (React, Vue, Solid, Svelte) is now its own package, so you only install what you need.
- Dropping support for Tanstack Query v4
Kubb v3 targets Tanstack Query v5 only. If your project still depends on v4, stay on Kubb v2.
- Generators: the core of Kubb v3
TIP
In v2 of Kubb we used the name templates.
Generators hook into file generation so you can customize or add code on the fly. Every plugin builds its files through them. In v3 you can also reuse generators from other plugins.
Say you generate an API client with @kubb/plugin-client and want to append extra functionality to the output. You have two options:
- Use the footer option to add code.
- Override the default generator and write your own logic.
- Improved performance
The core engine was rewritten for speed, so the CLI gives faster feedback while it builds.
- File extensions and compatibility
Recent Node.js versions require explicit file extensions on imports. Kubb v3 appends .ts to generated files by default. If your project does not use this Node.js setting yet, switch to .js or drop the extension.
- Expanded OpenAPI support
Earlier versions of Kubb were tied closely to Swagger. v3 supports OpenAPI v3 and v3.1 in full, and the internal architecture is easier to extend toward other spec formats.
Migrating to Kubb v3
The migration guide walks through the full upgrade.