Documents
Valibot Plugin Configuration
Valibot Plugin Configuration
Type
Topic
Status
Published
Created
May 14, 2026
Updated
May 14, 2026
Created by
Dosu Bot
Updated by
Dosu Bot

Valibot Plugin Configuration#

The valibot plugin for @hey-api/openapi-ts generates Valibot validation schemas from OpenAPI specifications. Configuration is defined inside the plugins array of the openapi-ts config file. The complete UserConfig interface is the authoritative reference for all options .

Schema Generation: What Gets Generated#

Four top-level options control which schema categories are emitted. All default to true :

OptionDefaultGenerated names (default pattern)
definitionstruev{{name}} (e.g., vPet)
requeststruev{{name}}Data + sub-schemas (see below)
responsestruev{{name}}Response
webhookstruev{{name}}WebhookRequest

Each of these accepts three shorthand forms :

  • boolean — shorthand for { enabled: boolean }
  • string or function — shorthand for { name: string | function }
  • full object{ case?, enabled?, name? }

Requests: Sub-Layer Configuration#

requests has the deepest nesting, with independent configuration for each HTTP request layer :

Sub-optionDefault name pattern
requests.bodyv{{name}}Body
requests.headersv{{name}}Headers
requests.pathv{{name}}Path
requests.queryv{{name}}Query

Each sub-option also supports the same boolean | NameTransformer | object shorthand.

shouldExtract#

requests.shouldExtract controls whether the composite request schema is emitted as a named export (vProjectListData) or built inline :

  • Default: false (inline)
  • true: always export as a named schema
  • Function: per-operation control via ({ operation }) => boolean

Naming Conventions (name)#

The name option on any category accepts :

  • A template string using {{name}} as a placeholder (e.g., 'v{{name}}Response')
  • A function (name: string) => string for programmatic transformation

Casing (case)#

A top-level case option sets the global default casing for all generated identifiers, with 'camelCase' as the default . Any nested category (e.g., definitions.case, requests.body.case) can override it independently.

Accepted values come from the shared Casing type (e.g., 'camelCase', 'PascalCase', 'snake_case') .

Metadata#

metadata attaches Valibot metadata() actions to generated schemas :

  • false (default) — no metadata emitted
  • true — attaches { description } from the OpenAPI schema when present
  • Function — custom builder receiving { $, node, schema }; populate node with $.literal(…) calls to add arbitrary metadata fields

SDK Integration#

To wire Valibot schemas as runtime validators in a generated SDK, set validator: true on the @hey-api/sdk plugin alongside valibot .

References#