- Downloads
- 83.6K/ mo
- Stars
- 8
- Bundle size
- 450.8 kB
- Updated
- 2h ago
Generate typed API calls with the native Fetch API.
- One async function per OpenAPI operation.
- Grouped request parameters and status-keyed results.
Installation
bun add -d @kubb/plugin-fetchpnpm add -D @kubb/plugin-fetchnpm install --save-dev @kubb/plugin-fetchyarn add -D @kubb/plugin-fetchOr run kubb add plugin-fetch to install the version the Kubb registry pins and add pluginFetch() to kubb.config.ts.
Dependencies
- Add
pluginTsorpluginZodwithinferred: truefor operation types.pluginTstakes precedence. - Add
pluginZodfor validation.
Example
kubb.config.ts
import { defineConfig } from 'kubb/config'
import { pluginTs } from '@kubb/plugin-ts'
import { pluginFetch } from '@kubb/plugin-fetch'
export default defineConfig({
input: './petStore.yaml',
output: { path: './src/gen' },
plugins: [
pluginTs(),
pluginFetch({ baseURL: 'https://petstore.swagger.io/v2' }),
],
})