Skip to content
Officialv5.8.2MITkubb >=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
284.1K/ mo
Stars
1.8K
Bundle size
569.6 kB
Updated
1h ago

Read OpenAPI 2.0, 3.0, and 3.1 documents.

  • Validate schemas and operations, then convert them into Kubb's AST.
  • Configure defineConfig.adapter to apply type mappings across plugins.
Kubb uses adapterOas() by default. Add it explicitly to change options.

Installation

Ships with kubb, no extra install.

Dependencies

No plugin dependencies.

Example

kubb.config.ts
import { defineConfig } from 'kubb/config'
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()],
})