Officialv5.5.1MITkubb >=5.0.0node >=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
Stijn Van Hulle

Stijn Van Hulle

@stijnvanhulle

Downloads
223.0K/ mo
Stars
1.8K
Bundle size
605.3 kB
Updated
12h ago

@kubb/adapter-oas reads and validates OpenAPI 2.0, 3.0, and 3.1 documents, then converts schemas and operations into the AST used by every plugin.

Configure it on defineConfig.adapter. Its type mappings apply to every plugin in the build. Kubb uses adapterOas() by default. Add it explicitly to change Options.

Installation

bun add -d @kubb/adapter-oas

Dependencies

No plugin dependencies.

Example

kubb.config.ts
import { defineConfig } from 'kubb'
import { adapterOas } from '@kubb/adapter-oas'
import { pluginTs } from '@kubb/plugin-ts'

export default defineConfig({
  input: './petStore.yaml',
  output: { path: './src/gen' },
  adapter: adapterOas({ dateType: 'date', integerType: 'number' }),
  plugins: [pluginTs()],
})

See also