Beta You're reading the docs for Kubb v5, which is currently in beta. View the stable v4 docs
Skip to content
Official v5.0.0-beta.84 MIT kubb >=5.0.0 node >=22

@kubb/adapter-oas

Reads an OpenAPI 2.0, 3.0, or 3.1 spec and converts every schema and operation into the AST that Kubb plugins generate from, so one adapter feeds the whole build.

openapiswaggerapi-specparserconverter
Downloads
17.7k / mo
Stars
1.8k
Bundle size
574.7 kB
Updated
2d ago

The OpenAPI adapter sits between your spec and every Kubb plugin. It reads the file at input.path, validates it, and converts each schema and operation into Kubb's universal AST that downstream plugins consume.

Configure it once on defineConfig. Its choices for date representation, integer width, and server URL apply to every plugin in the build.

See Options for the full configuration reference.

Installation

shell
bun add -d @kubb/adapter-oas@beta
shell
pnpm add -D @kubb/adapter-oas@beta
shell
npm install --save-dev @kubb/adapter-oas@beta
shell
yarn add -D @kubb/adapter-oas@beta

Example

typescript
import {  } from 'kubb'
import {  } from '@kubb/adapter-oas'
import {  } from '@kubb/plugin-ts'

export default ({
  : { : './petStore.yaml' },
  : { : './src/gen' },
  : ({
    : true,
    : { : 0, : { : 'prod' } },
    : 'propagate',
    : 'root',
    : 'date',
    : 'number',
    : 'unknown',
    : 'unknown',
    : 'enum',
  }),
  : [()],
})

See Also