Skip to content

@kubb/swagger-zodios 🦙 ​

With the Swagger zodios plugin you can use zodios to validate your schema's based on a Swagger file.

Installation ​

shell
bun add @kubb/swagger-zodios @kubb/swagger-zod @kubb/swagger
bun add @kubb/swagger-zodios @kubb/swagger-zod @kubb/swagger
shell
pnpm add @kubb/swagger-zodios @kubb/swagger-zod @kubb/swagger
pnpm add @kubb/swagger-zodios @kubb/swagger-zod @kubb/swagger
shell
npm install @kubb/swagger-zodios @kubb/swagger-zod @kubb/swagger
npm install @kubb/swagger-zodios @kubb/swagger-zod @kubb/swagger
shell
yarn add @kubb/swagger-zodios @kubb/swagger-zod @kubb/swagger
yarn add @kubb/swagger-zodios @kubb/swagger-zod @kubb/swagger

Options ​

output ​

Output to save the zodios instance.
Output should be a file(ending with .ts or .js).

INFO

Type: string
Default: 'zodios.ts'

typescript
import { defineConfig } from '@kubb/swagger'
import createSwagger from '@kubb/swagger'
import createSwaggerZod from '@kubb/swagger-zod'
import createSwaggerZodios from '@kubb/swagger-zodios'

export default defineConfig({
  input: {
    path: './petStore.yaml',
  },
  output: {
    path: './src/gen',
  },
  plugins: [
    createSwagger({ output: false }),
    createSwaggerZod({}),
    createSwaggerZodios(
      {
        output: 'zodios.ts',
      },
    ),
  ],
})
import { defineConfig } from '@kubb/swagger'
import createSwagger from '@kubb/swagger'
import createSwaggerZod from '@kubb/swagger-zod'
import createSwaggerZodios from '@kubb/swagger-zodios'

export default defineConfig({
  input: {
    path: './petStore.yaml',
  },
  output: {
    path: './src/gen',
  },
  plugins: [
    createSwagger({ output: false }),
    createSwaggerZod({}),
    createSwaggerZodios(
      {
        output: 'zodios.ts',
      },
    ),
  ],
})

Depended ​

Released under the MIT License.