@kubb/plugin-valibot 0.0.0-stage → 0.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +73 -2
- package/dist/index.cjs +2105 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +308 -0
- package/dist/index.d.ts +308 -0
- package/dist/index.js +2096 -0
- package/dist/index.js.map +1 -0
- package/docs/guides/coercion.md +52 -0
- package/docs/guides/customization.md +131 -0
- package/docs/guides/format-mappings.md +98 -0
- package/docs/guides/inferred-types.md +70 -0
- package/docs/options.md +215 -0
- package/docs/overview.md +70 -0
- package/kubb-extension.json +224 -0
- package/package.json +93 -3
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.cjs","names":["text","casing","text","ast","Diagnostics","ast","ast","text","File","Const","Type","Function","ast","text","createPrinter","defineGenerator","jsxRenderer","File","ast","createResolver","casing","defineExtension","Resolver"],"sources":["../../../internals/utils/src/reserved.ts","../../../internals/utils/src/codegen.ts","../../../internals/utils/src/fs.ts","../../../internals/utils/src/strings.ts","../../../internals/shared/src/operation.ts","../../../internals/shared/src/adapter.ts","../../../internals/shared/src/resolver.ts","../../../internals/shared/src/schema.ts","../src/components/Valibot.tsx","../src/printers/printerValibot.ts","../src/generators/valibotGenerator.tsx","../kubb-extension.json","../package.json","../src/resolvers/resolverValibot.ts","../src/plugin.ts"],"sourcesContent":["/**\n * JavaScript and Java reserved words.\n * @link https://github.com/jonschlinkert/reserved/blob/master/index.js\n */\nconst reservedWords = new Set([\n 'abstract',\n 'arguments',\n 'await',\n 'boolean',\n 'break',\n 'byte',\n 'case',\n 'catch',\n 'char',\n 'class',\n 'const',\n 'continue',\n 'debugger',\n 'default',\n 'delete',\n 'do',\n 'double',\n 'else',\n 'enum',\n 'eval',\n 'export',\n 'extends',\n 'false',\n 'final',\n 'finally',\n 'float',\n 'for',\n 'function',\n 'goto',\n 'if',\n 'implements',\n 'import',\n 'in',\n 'instanceof',\n 'int',\n 'interface',\n 'let',\n 'long',\n 'native',\n 'new',\n 'null',\n 'package',\n 'private',\n 'protected',\n 'public',\n 'return',\n 'short',\n 'static',\n 'super',\n 'switch',\n 'synchronized',\n 'this',\n 'throw',\n 'throws',\n 'transient',\n 'true',\n 'try',\n 'typeof',\n 'var',\n 'void',\n 'volatile',\n 'while',\n 'with',\n 'yield',\n 'Array',\n 'Date',\n 'hasOwnProperty',\n 'Infinity',\n 'isFinite',\n 'isNaN',\n 'isPrototypeOf',\n 'length',\n 'Math',\n 'name',\n 'NaN',\n 'Number',\n 'Object',\n 'prototype',\n 'String',\n 'toString',\n 'undefined',\n 'valueOf',\n] as const)\n\n/**\n * Returns `true` when `name` is a syntactically valid JavaScript variable name.\n *\n * @example\n * ```ts\n * isValidVarName('status') // true\n * isValidVarName('class') // false (reserved word)\n * isValidVarName('42foo') // false (starts with digit)\n * ```\n */\nexport function isValidVarName(name: string): boolean {\n if (!name || reservedWords.has(name as 'valueOf')) {\n return false\n }\n return isIdentifier(name)\n}\n\n/**\n * Returns `name` when it's a syntactically valid JavaScript variable name,\n * otherwise prefixes it with `_` so the result is a valid identifier.\n *\n * Useful for sanitizing OpenAPI schema names or operation IDs that start with\n * a digit (e.g. `409`, `504AccountCancel`) before using them as exported\n * variable, type, or function names.\n *\n * @example\n * ```ts\n * ensureValidVarName('409') // '_409'\n * ensureValidVarName('504AccountCancel') // '_504AccountCancel'\n * ensureValidVarName('Pet') // 'Pet'\n * ensureValidVarName('class') // '_class'\n * ```\n */\nexport function ensureValidVarName(name: string): string {\n if (!name || isValidVarName(name)) {\n return name\n }\n return `_${name}`\n}\n\n/**\n * Returns `true` when `name` is syntactically a valid identifier, ignoring reserved words.\n *\n * Reserved words and globals (`class`, `name`, `Date`, …) are valid as bare object-literal keys\n * even though they are not valid variable names, so use this (not {@link isValidVarName}) when\n * deciding whether an object key needs quoting.\n *\n * @example\n * ```ts\n * isIdentifier('name') // true\n * isIdentifier('x-total')// false\n * ```\n */\nexport function isIdentifier(name: string): boolean {\n return /^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(name)\n}\n","import { text } from '@kubb/kit'\nimport { isIdentifier } from './reserved.ts'\n\n/**\n * Builds a JSDoc comment block from an array of lines. Returns `fallback` when there are no\n * comments.\n *\n * @example\n * ```ts\n * buildJSDoc(['@type string', '@example hello'])\n * // '/**\\n * @type string\\n * @example hello\\n *\\/\\n '\n * ```\n */\nexport function buildJSDoc(\n comments: Array<string>,\n options: {\n /**\n * String used to indent each comment line.\n * @default ' * '\n */\n indent?: string\n /**\n * String appended after the closing tag.\n * @default '\\n '\n */\n suffix?: string\n /**\n * Returned as-is when `comments` is empty.\n * @default ' '\n */\n fallback?: string\n } = {},\n): string {\n const { indent = ' * ', suffix = '\\n ', fallback = ' ' } = options\n\n if (comments.length === 0) return fallback\n\n return `/**\\n${comments.map((c) => `${indent}${c}`).join('\\n')}\\n */${suffix}`\n}\n\n/**\n * Assembles a multi-line object literal from already-rendered `entries`, indenting each entry one\n * level and closing the brace at column zero. Entries that are themselves multi-line objects indent\n * cumulatively. Each entry ends with a trailing comma to match the formatter's multi-line style.\n *\n * @example\n * ```ts\n * buildObject(['id: z.number()', 'name: z.string()'])\n * // '{\\n id: z.number(),\\n name: z.string(),\\n}'\n * ```\n */\nexport function buildObject(entries: Array<string>): string {\n if (entries.length === 0) return '{}'\n const body = entries.map((entry) => `${text.indent({ text: entry })},`).join('\\n')\n\n return `{\\n${body}\\n}`\n}\n\n/**\n * Assembles a bracketed list (array by default) from already-rendered `items`. Keeps everything on\n * one line when no item spans multiple lines, and otherwise puts each item on its own line, indented\n * one level with a trailing comma and the closing bracket at column zero. Used for member lists such\n * as `z.union([…])` and `z.array([…])`.\n *\n * @example\n * ```ts\n * buildList(['z.string()', 'z.number()'])\n * // '[z.string(), z.number()]'\n * ```\n */\nexport function buildList(items: Array<string>, brackets: [open: string, close: string] = ['[', ']']): string {\n const [open, close] = brackets\n if (items.length === 0) return `${open}${close}`\n if (!items.some((item) => item.includes('\\n'))) return `${open}${items.join(', ')}${close}`\n const body = items.map((item) => `${text.indent({ text: item })},`).join('\\n')\n\n return `${open}\\n${body}\\n${close}`\n}\n\n/**\n * Emits a lazy getter for a circular-ref property position, `get name() { return body }`. The key\n * is quoted only when it is not a valid identifier. Used by the string printers to defer evaluation\n * of a recursive schema until first access.\n *\n * @example\n * ```ts\n * lazyGetter({ name: 'parent', body: 'z.lazy(() => Pet)' })\n * // \"get parent() { return z.lazy(() => Pet) }\"\n * ```\n */\nexport function lazyGetter({ name, body }: { name: string; body: string }): string {\n return `get ${objectKey(name)}() { return ${body} }`\n}\n\n/**\n * An object key, quoted only when it is not identifier-shaped. Reserved words such as `class` stay bare.\n *\n * @example\n * ```ts\n * objectKey('x-total') // \"'x-total'\"\n * ```\n */\nexport function objectKey(name: string): string {\n return isIdentifier(name) ? name : text.quote(name)\n}\n\n/**\n * A JSON value as a JavaScript literal, with single-quoted strings and identifier keys left unquoted.\n *\n * @example\n * ```ts\n * toLiteral({ id: 1, 'x-tag': ['a'] }) // \"{ id: 1, 'x-tag': ['a'] }\"\n * ```\n */\nexport function toLiteral(value: unknown): string {\n if (typeof value === 'string') return text.quote(value)\n if (Array.isArray(value)) return `[${value.map(toLiteral).join(', ')}]`\n if (value && typeof value === 'object') {\n return `{ ${Object.entries(value)\n .map(([key, item]) => `${objectKey(key)}: ${toLiteral(item)}`)\n .join(', ')} }`\n }\n return String(value)\n}\n","import { posix } from 'node:path'\nimport { casing } from '@kubb/kit'\nfunction toSlash(p: string): string {\n if (p.startsWith('\\\\\\\\?\\\\')) return p\n return p.replaceAll('\\\\', '/')\n}\n\n/**\n * Returns the relative path from `rootDir` to `filePath`, always using forward slashes\n * and prefixed with `./` when not already traversing upward.\n *\n * @example\n * ```ts\n * getRelativePath('/src/components', '/src/components/Button.tsx') // './Button.tsx'\n * getRelativePath('/src/components', '/src/utils/helpers.ts') // '../utils/helpers.ts'\n * ```\n */\nexport function getRelativePath(rootDir: string, filePath: string): string {\n const relativePath = posix.relative(toSlash(rootDir), toSlash(filePath))\n\n return relativePath.startsWith('../') ? relativePath : `./${relativePath}`\n}\n\n/**\n * Builds a nested file path from a dotted name. Splits on dots that precede a letter\n * (so version numbers embedded in operationIds like `v2025.0` stay intact), camelCases\n * every earlier segment, applies `caseLast` to the final segment, and joins with `/`.\n *\n * Empty segments are dropped before joining. They arise when the name starts with a dot\n * followed by a letter (e.g. `..Schema` splits into `['..', 'Schema']` and `'..'` cases to\n * an empty string). Without this a leading `/` would form, which `path.resolve` reads as an\n * absolute path, letting generated files escape the configured output directory.\n *\n * @example Nested path from a dotted name\n * `toFilePath('pet.petId') // 'pet/petId'`\n *\n * @example PascalCase the final segment\n * `toFilePath('pet.Pet', pascalCase) // 'pet/Pet'`\n *\n * @example Suffix applied to the final segment only\n * `toFilePath('tag.tag', (part) => camelCase(part, { suffix: 'schema' })) // 'tag/tagSchema'`\n */\nexport function toFilePath(name: string, caseLast: (part: string) => string = casing.camel): string {\n const parts = name.split(/\\.(?=[a-zA-Z])/)\n return parts\n .map((part, i) => (i === parts.length - 1 ? caseLast(part) : casing.camel(part)))\n .filter(Boolean)\n .join('/')\n}\n","import { text } from '@kubb/kit'\n\n// `\\p{`, `\\P{` or `\\u{` behind an odd number of backslashes, or a character outside the BMP: both need the `u` flag.\nconst NEEDS_UNICODE = /(?<!\\\\)(?:\\\\\\\\)*\\\\[pPu]\\{|[\\u{10000}-\\u{10FFFF}]/u\n// Escapes the `u` flag accepts. `\\-` only counts inside a class.\nconst KEPT_ESCAPE = /[A-Za-z0-9^$\\\\.*+?()[\\]{}|/]/\n\n/**\n * Drops the backslash from escapes that the `u` flag rejects: an escaped punctuation character that is\n * not a syntax character, and `\\-` outside a class. Both match the same character without the backslash.\n */\nfunction dropIdentityEscapes(pattern: string): string {\n let inClass = false\n\n return pattern.replace(/\\\\(.)|[[\\]]/gs, (match, escaped?: string) => {\n if (escaped === undefined) {\n inClass = match === '['\n return match\n }\n\n return KEPT_ESCAPE.test(escaped) || (escaped === '-' && inClass) ? match : escaped\n })\n}\n\n/**\n * Builds the `RegExp` for a pattern, adding the `u` flag when it uses `\\p{...}`, `\\P{...}` or `\\u{...}`, or\n * holds a character outside the BMP. A pattern that is not valid under `u` keeps the flags it came with.\n */\nfunction toRegExp(pattern: string, flags: string | undefined): RegExp {\n if (flags?.includes('u') || !NEEDS_UNICODE.test(pattern)) return new RegExp(pattern, flags)\n\n try {\n return new RegExp(dropIdentityEscapes(pattern), `${flags ?? ''}u`)\n } catch {\n return new RegExp(pattern, flags)\n }\n}\n\n/**\n * Converts a pattern string into a `new RegExp(...)` constructor call or a regex literal string.\n * Inline flags expressed as a `^(?im)` prefix are extracted and applied to the resulting expression.\n * Pass `null` as the second argument to emit a `/pattern/flags` literal instead.\n *\n * @example\n * ```ts\n * toRegExpString('^(?im)foo') // 'new RegExp(\"^foo\", \"im\")'\n * toRegExpString('^(?im)foo', null) // '/^foo/im'\n * ```\n */\nexport function toRegExpString(pattern: string, func: string | null = 'RegExp'): string {\n const raw = text.unquote(pattern)\n\n const match = raw.match(/^\\^(\\(\\?([igmsuy]+)\\))/i)\n const replacementTarget = match?.[1] ?? ''\n const matchedFlags = match?.[2]\n const cleaned = raw\n .replace(/^\\\\?\\//, '')\n .replace(/\\\\?\\/$/, '')\n .replace(replacementTarget, '')\n\n const { source, flags } = toRegExp(cleaned, matchedFlags)\n\n if (func === null) return `/${source}/${flags}`\n\n return `new ${func}(${JSON.stringify(source)}${flags ? `, ${JSON.stringify(flags)}` : ''})`\n}\n\n/**\n * Renders a dotted path or string array as an optional-chaining accessor expression rooted at\n * `accessor`. Returns `null` for an empty path.\n *\n * @example\n * ```ts\n * getNestedAccessor('pagination.next.id', 'lastPage')\n * // \"lastPage?.['pagination']?.['next']?.['id']\"\n * ```\n */\nexport function getNestedAccessor(param: string | Array<string>, accessor: string): string | null {\n const parts = Array.isArray(param) ? param : param.split('.')\n if (parts.length === 0 || (parts.length === 1 && parts[0] === '')) return null\n return `${accessor}?.['${`${parts.join(\"']?.['\")}']`}`\n}\n\n/**\n * Escapes an `@` at the start of a line, so a multi-line description can't start a new JSDoc tag.\n * Editors render `\\@` as `@` in hovers.\n *\n * @example\n * ```ts\n * jsDocEscape('intro\\n@example value') // 'intro\\n\\\\@example value'\n * ```\n */\nexport function jsDocEscape(input: unknown): string {\n return `${input}`.replace(/^(\\s*)@/gm, '$1\\\\@')\n}\n","import { jsDocEscape } from '@internals/utils'\nimport { ast, type Group, type Memo, type Output, type Resolver, type ResolverFileParams } from '@kubb/kit'\n\n/**\n * Builds the `ResolverFileParams` every operation generator passes to\n * `resolver.file`: a file named `name`, tagged by the operation's first\n * tag (or `'default'`), at the operation's path. Centralizes the entry object\n * that was repeated at dozens of call sites across the client and query plugins.\n *\n * @example\n * ```ts\n * resolver.file(operationFileEntry(node, node.operationId), { root, output, group })\n * ```\n */\nexport function operationFileEntry(node: ast.OperationNode, name: string, extname: ResolverFileParams['extname'] = '.ts'): ResolverFileParams {\n return {\n name,\n extname,\n tag: node.tags[0] ?? 'default',\n path: node.path,\n }\n}\n\n/**\n * Resolves the file a schema-emitting plugin (`plugin-ts`, `plugin-zod`, `plugin-faker`) writes\n * `node` to, cached in `ctx.memo` under the resolver's plugin name and the\n * operation. The plugin itself and every plugin that imports from it call this, so they all get\n * the same path.\n *\n * When that path matches the file of a component schema in `ctx.schemas`, ignoring case, the file name\n * gets an `Operation` suffix: operation `point` goes to `PointOperation.ts` next to schema `Point.ts`.\n * Otherwise the two merge into one file, or overwrite each other on a case-insensitive file system.\n * Only the file name changes. The declarations keep their names.\n *\n * @example Resolve `plugin-ts`'s file for the current operation\n * ```ts\n * const fileTs = resolveOperationFile({ ctx, node, resolver: tsResolver, root, output })\n * ```\n */\nexport function resolveOperationFile(options: {\n ctx: { memo: Memo; schemas: ReadonlyArray<ast.SchemaNode> }\n node: ast.OperationNode\n resolver: Pick<Resolver, 'file' | 'pluginName'>\n root: string\n output: Output\n group?: Group | null\n}): ast.FileNode {\n const { ctx, node, resolver, root, output } = options\n const { memo } = ctx\n const location = { root, output, group: options.group ?? undefined }\n\n return memo(`${resolver.pluginName}:operationFile:${node.operationId}`, () => {\n const schemaPaths = memo(\n `${resolver.pluginName}:schemaFilePaths`,\n () =>\n new Set(ctx.schemas.flatMap((schema) => (schema.name ? [resolver.file({ name: schema.name, extname: '.ts', ...location }).path.toLowerCase()] : []))),\n )\n let file = resolver.file({ ...operationFileEntry(node, node.operationId), ...location })\n\n for (let name = `${node.operationId}Operation`; schemaPaths.has(file.path.toLowerCase()); name += 'Operation') {\n const next = resolver.file({ ...operationFileEntry(node, name), ...location })\n // A single-file output holds every declaration on purpose, so a new name changes nothing.\n if (next.path === file.path) break\n file = next\n }\n\n return file\n })\n}\n\nexport type ContentTypeInfo = {\n contentTypes: string[]\n isMultipleContentTypes: boolean\n contentTypeUnion: string\n defaultContentType: string\n hasFormData: boolean\n}\n\nexport type RequestConfigResolver = {\n response: {\n body(node: ast.OperationNode): string\n }\n}\n\nexport type ResponseStatusNameResolver = {\n response: {\n status(node: ast.OperationNode, statusCode: ast.StatusCode): string\n }\n}\n\nexport type ResponseNameResolver = ResponseStatusNameResolver & {\n response: {\n response(node: ast.OperationNode): string\n }\n}\n\nexport type OperationTypeNameResolver = RequestConfigResolver &\n ResponseNameResolver & {\n param: {\n path(node: ast.OperationNode, param: ast.ParameterNode): string\n query(node: ast.OperationNode, param: ast.ParameterNode): string\n headers(node: ast.OperationNode, param: ast.ParameterNode): string\n cookies(node: ast.OperationNode, param: ast.ParameterNode): string\n }\n }\n\nexport type BuildOperationCommentsOptions = {\n splitLines?: boolean\n}\n\nexport type ResolveOperationTypeNameOptions = {\n responseStatusNames?: boolean | 'error'\n exclude?: ReadonlyArray<string | undefined>\n order?: 'params-first' | 'body-response-first'\n /**\n * Include the individual `Path`/`Query`/`Headers` group type names. Set to `false` for clients\n * that reference the grouped `Options` type instead of the per-group types.\n */\n includeParams?: boolean\n}\n\n/**\n * The operation's method and path as plain text, such as `` `GET /pet/{petId}` ``. A path is not a valid `{@link}` target.\n */\nfunction getOperationRequestLine(node: ast.OperationNode): string | null {\n return ast.http.isOperation(node) && node.path ? `\\`${node.method.toUpperCase()} ${node.path}\\`` : null\n}\n\n/**\n * Derives the shared `ContentTypeInfo` shape from a list of content types, tracking whether several\n * are present and the union, default, and form-data flags the client uses to pick one.\n */\nfunction buildContentTypeInfo(contentTypes: string[]): ContentTypeInfo {\n const isMultipleContentTypes = contentTypes.length > 1\n\n return {\n contentTypes,\n isMultipleContentTypes,\n contentTypeUnion: isMultipleContentTypes ? contentTypes.map((ct) => JSON.stringify(ct)).join(' | ') : '',\n defaultContentType: contentTypes[0] ?? 'application/json',\n hasFormData: contentTypes.some((ct) => ct === 'multipart/form-data'),\n }\n}\n\nexport function getContentTypeInfo(node: ast.OperationNode): ContentTypeInfo {\n return buildContentTypeInfo(node.requestBody?.content?.map((e) => e.contentType) ?? [])\n}\n\n/**\n * The request-body counterpart for the primary success response: the content types it documents and\n * whether several are present, so the client can let a caller pick which one to accept.\n */\nexport function getResponseContentTypeInfo(node: ast.OperationNode): ContentTypeInfo {\n return buildContentTypeInfo(ast.http.responses.findPrimary(node)?.content?.map((e) => e.contentType) ?? [])\n}\n\ntype ResponseType = 'blob' | 'text' | 'stream'\n\ntype ResponseContentEntry = { contentType: string; schema?: ast.SchemaNode | null; stream?: ast.ContentNode['stream'] }\n\n/**\n * How an operation streams its primary success response item by item, when that response declares one content type:\n * - `'event'` for `text/event-stream` whose `itemSchema` types the whole event with its own `event` and `data`\n * - `'data'` for `text/event-stream` typed by its payload only\n * - `'line'` for JSON Lines, one parsed JSON value per line\n *\n * Returns `null` for any other response, and for a response that also declares another content type, which stays a normal\n * call with its query hooks.\n */\nexport function getEventStream(node: ast.OperationNode): 'event' | 'data' | 'line' | null {\n const content = ast.http.responses.findPrimary(node)?.content ?? []\n if (content.length !== 1) return null\n const entry = content[0]!\n const framing = getStreamFraming(entry)\n if (framing === 'events') return entry.stream?.shape ?? 'data'\n return framing === 'lines' ? 'line' : null\n}\n\n/**\n * How a content entry is framed as a stream: `'events'` for Server-Sent Events, `'lines'` for JSON Lines.\n */\nexport function getStreamFraming(entry: Pick<ast.ContentNode, 'contentType' | 'stream'>): 'events' | 'lines' | undefined {\n if (ast.mediaType.getBase(entry) === 'text/event-stream') return 'events'\n // `multipart/mixed` with an `itemSchema` also has `stream`, but it is a stream of parts, not of JSON values.\n return entry.stream && ast.mediaType.isStream(entry) ? 'lines' : undefined\n}\n\n/**\n * Whether an operation streams its primary success response, as Server-Sent Events or JSON Lines. The client generator uses\n * this to return a typed stream of items instead of a one-shot `RequestResult`.\n */\nexport function isEventStream(node: ast.OperationNode): boolean {\n return getEventStream(node) !== null\n}\n\n// A stream without a schema is a `blob` with a string primitive, so it keeps the JSON-parse default.\nfunction isTextSchema(schema: ast.SchemaNode | null | undefined): boolean {\n if (!schema) return false\n const resolved = ast.ref.getSchema(schema)\n return resolved.type !== 'blob' && resolved.primitive === 'string'\n}\n\n/**\n * Whether an operation streams Server-Sent Events whose `data` the document types as a string, so the client keeps each\n * `data` as text instead of JSON-parsing it. With an event-shaped `itemSchema` where only some events type `data` as a\n * string, it returns the names of those events, or `false` when one of them has no fixed name.\n */\nexport function hasTextEventData(node: ast.OperationNode): boolean | Array<string> {\n const shape = getEventStream(node)\n const entry = ast.http.responses.findPrimary(node)?.content?.[0]\n if (!entry || (shape !== 'data' && shape !== 'event')) return false\n if (shape === 'data') return isTextSchema(entry.stream?.schema ?? entry.schema)\n\n const item = entry.stream?.schema ? ast.ref.getSchema(entry.stream.schema) : undefined\n if (!item) return false\n const events = item.type === 'union' ? (ast.schema.narrow(item, 'union')?.members ?? []) : [item]\n // A discriminator makes each event an intersection of its `$ref` and the pinned `event`, so every part is read.\n const propertySchemas = (event: ast.SchemaNode, propertyName: string) => ast.schema.findProperties({ node: event, propertyName }).map(({ schema }) => schema)\n const textEvents = events.filter((event) => {\n const dataSchemas = propertySchemas(event, 'data')\n return dataSchemas.length > 0 && dataSchemas.every(isTextSchema)\n })\n if (textEvents.length === events.length) return events.length > 0\n\n const eventNames = textEvents.map((event) => propertySchemas(event, 'event').flatMap((schema) => ast.schema.getLiterals(ast.ref.getSchema(schema))))\n return eventNames.length > 0 && eventNames.every((values) => values.length > 0) && [...new Set(eventNames.flat().map(String))]\n}\n\n/**\n * Whether the primary success response offers `text/event-stream`, alone or next to other content types. The client asks\n * for the stream by default and ships the `sse.ts` runtime, so a mixed response can be read as events too.\n */\nexport function hasEventStreamContent(node: ast.OperationNode): boolean {\n const entries = ast.http.responses.findPrimary(node)?.content ?? []\n // Next to another type, a stream without a schema gets no typed variant, so it keeps the plain call.\n return entries.some((entry) => getStreamFraming(entry) === 'events' && (entries.length === 1 || Boolean(entry.schema)))\n}\n\n/**\n * Whether a success response offers a stream media type next to other content types. The client returns that variant's\n * body as a `ReadableStream`, so the stream runtime is registered and a hook's data type includes the stream.\n */\nexport function hasStreamVariant(node: ast.OperationNode): boolean {\n return ast.http.responses.filterSuccess(node).some((response) => {\n const variants = (response.content ?? []).filter((entry) => entry.schema)\n return variants.length > 1 && variants.some((entry) => ast.mediaType.isStream(entry))\n })\n}\n\nconst formContentTypes = ['multipart/form-data', 'application/x-www-form-urlencoded'] as const\n\n/**\n * The form media types the operation's request body offers, `multipart/form-data` and `application/x-www-form-urlencoded`,\n * which the client needs a handler for.\n */\nexport function getFormContentTypes(node: ast.OperationNode): Array<(typeof formContentTypes)[number]> {\n const request = new Set((node.requestBody?.content ?? []).map((entry) => ast.mediaType.getBase(entry)))\n return formContentTypes.filter((contentType) => request.has(contentType))\n}\n\n/**\n * Parser for one response content entry.\n *\n * JSON stays unset so the runtime detects it. `text/event-stream` and JSON Lines are streams. A binary schema\n * (`format: binary` / `contentMediaType`) is a blob even when the media type is not a well-known\n * binary type. Other `text/*` is text, and `application/octet-stream`, `application/pdf`,\n * `image/*`, `audio/*`, and `video/*` are blobs.\n */\nfunction responseTypeForContent(entry: ResponseContentEntry): ResponseType | undefined {\n const baseType = ast.mediaType.getBase(entry)\n if (!baseType) return undefined\n if (getStreamFraming(entry)) return 'stream'\n if (ast.mediaType.isJson(baseType)) return undefined\n if (entry.schema?.type === 'blob') return 'blob'\n if (baseType.startsWith('text/')) return 'text'\n if (isBinaryContentType(baseType)) return 'blob'\n return undefined\n}\n\nfunction isBinaryContentType(baseType: string): boolean {\n return baseType === 'application/octet-stream' || baseType === 'application/pdf' || /^(image|audio|video)\\//.test(baseType)\n}\n\n/**\n * Maps a content type to the PascalCase suffix used to name per-content-type variants\n * (e.g. `application/json` → `Json`, `application/xml` → `Xml`, `multipart/form-data` → `FormData`).\n */\nfunction getContentTypeSuffix(contentType: string): string {\n // Keeps the original case, unlike ast.mediaType.getBase, so generated names stay stable.\n const baseType = contentType.split(';')[0]!.trim()\n if (baseType === 'application/json') return 'Json'\n if (baseType === 'multipart/form-data') return 'FormData'\n if (baseType === 'application/x-www-form-urlencoded') return 'FormUrlEncoded'\n const subtype = baseType.split('/').pop() ?? baseType\n const parts = subtype.split(/[^a-zA-Z0-9]+/).filter(Boolean)\n if (parts.length === 0) return 'Unknown'\n return parts.map((part) => part.charAt(0).toUpperCase() + part.slice(1)).join('')\n}\n\n/**\n * Appends a content-type suffix to a base name, keeping a trailing `Data` segment last\n * (e.g. `AddPetData` + `Json` → `AddPetJsonData`, `AddPetStatus200` + `Xml` → `AddPetStatus200Xml`).\n */\nexport function getPerContentTypeName(baseName: string, suffix: string): string {\n if (baseName.endsWith('Data')) {\n return suffix.endsWith('Data') ? baseName.slice(0, -4) + suffix : `${baseName.slice(0, -4)}${suffix}Data`\n }\n return baseName + suffix\n}\n\nexport type ContentVariantInput = { contentType: string; schema?: ast.SchemaNode | null; keysToOmit?: Array<string> | null }\nexport type ContentVariant = { name: string; suffix: string; schema: ast.SchemaNode; keysToOmit?: Array<string> | null; contentType: string }\n\n/**\n * Returns the entry with the schema of the value the client returns: `string` for a body read as text, such as `Pet` on\n * `application/xml`, and `blob` for `image/*`, `audio/*`, `video/*`, PDF, and octet-stream. A binary schema elsewhere is a `Blob`\n * only through `parseAs: 'blob'`, which needs every entry in `entries` binary. JSON, vendor (`application/vnd.*`), stream,\n * schemaless, and wildcard entries keep their schema. `entries` is the response's full list of content types.\n */\nexport function toResponseContent<T extends ContentVariantInput & ResponseContentEntry>(entry: T, entries: ReadonlyArray<ResponseContentEntry> = [entry]): T {\n const { contentType, schema } = entry\n if (!schema || entry.stream) return entry\n\n const baseType = ast.mediaType.getBase(contentType)\n const resolved = ast.ref.getSchema(schema)\n if (isBinaryContentType(baseType)) {\n return resolved.type === 'blob' ? entry : { ...entry, schema: ast.factory.createSchema({ type: 'blob' }), keysToOmit: null }\n }\n const isPlainMediaType = Boolean(baseType) && !ast.mediaType.isJson(baseType) && !baseType.includes('*')\n if (resolved.type === 'blob') {\n // shortcut: an error response never gets `parseAs`, so a lone binary schema there reads as text too but stays `Blob`.\n const readsAsText = isPlainMediaType && !entries.every((item) => item.schema?.type === 'blob')\n return readsAsText ? { ...entry, schema: ast.factory.createSchema({ type: 'string' }), keysToOmit: null } : entry\n }\n if (resolved.primitive === 'string') return entry\n\n const responseType = responseTypeForContent(entry)\n // A response without a body, such as a 405, has no schema to read. Only `text/*` is always text.\n if (responseType !== 'text' && (resolved.type === 'unknown' || resolved.type === 'any' || resolved.type === 'void')) return entry\n const isVendorJson = /^[^/]+\\/vnd\\./.test(baseType) && !/(xml|yaml|yml|csv)$/.test(baseType)\n const isText = responseType === 'text' || (!responseType && isPlainMediaType && !isVendorJson)\n\n return isText ? { ...entry, schema: ast.factory.createSchema({ type: 'string' }), keysToOmit: null } : entry\n}\n\n/**\n * Resolves per-content-type variant names for a set of content entries, deduplicating suffix\n * collisions with a numeric counter. Entries without a schema are skipped. The returned `suffix` is\n * the final (possibly counter-augmented) value, so callers can derive parallel names in another\n * namespace (e.g. plugin-faker deriving the matching plugin-ts type name).\n */\nexport function resolveContentTypeVariants(entries: Array<ContentVariantInput>, baseName: string): Array<ContentVariant> {\n const usedNames = new Set<string>()\n return entries\n .filter((entry) => entry.schema)\n .map((entry) => {\n const baseSuffix = getContentTypeSuffix(entry.contentType)\n let suffix = baseSuffix\n let name = getPerContentTypeName(baseName, suffix)\n let counter = 2\n while (usedNames.has(name)) {\n suffix = `${baseSuffix}${counter++}`\n name = getPerContentTypeName(baseName, suffix)\n }\n usedNames.add(name)\n return { name, suffix, schema: entry.schema!, keysToOmit: entry.keysToOmit, contentType: entry.contentType }\n })\n}\n\n/**\n * Builds the `client?:` option type shared by the generated query hooks (`useQuery`,\n * `useInfiniteQuery`, `useSWR`, ...): `RequestConfig` minus what the\n * hook fills in, which is every request group and `throwOnError`. Unlike {@link buildRequestConfigType},\n * it never narrows `contentType`: query hooks wrap GET operations, which carry no request body to select\n * a content type for.\n */\nexport function buildClientOptionType(options: { omit?: Array<string> } = {}): string {\n const keys = [...requestGroupOrder, 'url', ...(options.omit ?? []), 'throwOnError']\n return `Partial<Omit<RequestConfig, ${keys.map((key) => `'${key}'`).join(' | ')}>>`\n}\n\n/**\n * The `client?:` option type of a mutation hook. When the operation has a request content type choice,\n * the mutation variables carry `contentType`, so the config leaves it out. Otherwise the ambiguous side is\n * narrowed to the operation's media types; a single-type side has nothing to pick, so it stays baked in the\n * generated call.\n */\nexport function buildRequestConfigType(node: ast.OperationNode): string {\n if (hasRequestContentTypeChoice(node)) {\n return buildClientOptionType({ omit: ['contentType'] })\n }\n\n const request = getContentTypeInfo(node)\n const response = getResponseContentTypeInfo(node)\n const members = [\n request.isMultipleContentTypes ? `request?: ${request.contentTypeUnion}` : null,\n response.isMultipleContentTypes ? `response?: ${response.contentTypeUnion}` : null,\n ].filter(Boolean)\n\n const base = buildClientOptionType()\n return members.length ? `${base} & { contentType?: { ${members.join('; ')} } }` : base\n}\n\n/** The grouped request options, in the order generated signatures and calls list them. */\nexport const requestGroupOrder = ['path', 'query', 'body', 'headers', 'cookies'] as const\n\nexport type RequestGroups = {\n path: boolean\n query: boolean\n body: boolean\n headers: boolean\n cookies: boolean\n}\n\n/**\n * Which of the grouped request options an operation carries.\n */\nexport function getRequestGroups(node: ast.OperationNode): RequestGroups {\n const { path, query, header, cookie } = ast.http.groupParameters(node)\n return {\n path: path.length > 0,\n query: query.length > 0,\n body: Boolean(ast.http.requestBody.getSchema(node)),\n headers: header.length > 0,\n cookies: cookie.length > 0,\n }\n}\n\nexport type RequestGroupOptionality = {\n groups: RequestGroups\n hasRequiredPath: boolean\n hasRequiredQuery: boolean\n hasRequiredHeader: boolean\n /**\n * Whether the grouped request parameter can default to `{}`. True only when no group carries a\n * required member, so every member is safe to omit.\n */\n isOptional: boolean\n}\n\n/**\n * Resolves which grouped request options an operation carries together with whether each group\n * holds a required member. The grouped parameter stays optional only when nothing inside it is\n * required, matching the generated `RequestConfig` type.\n */\nexport function getRequestGroupOptionality(node: ast.OperationNode): RequestGroupOptionality {\n const groups = getRequestGroups(node)\n const { path, query, header } = ast.http.groupParameters(node)\n const hasRequiredPath = path.some((param) => param.required)\n const hasRequiredQuery = query.some((param) => param.required)\n const hasRequiredHeader = header.some((param) => param.required)\n\n return {\n groups,\n hasRequiredPath,\n hasRequiredQuery,\n hasRequiredHeader,\n // `cookies` never makes the parameter required: a browser sends its cookies itself and cannot set a `Cookie` header.\n isOptional: !hasRequiredPath && !hasRequiredQuery && !hasRequiredHeader && !(groups.body && node.requestBody?.required === true),\n }\n}\n\nexport type RequestOptionsNameResolver = RequestConfigResolver & {\n response: {\n options(node: ast.OperationNode): string\n }\n}\n\n/**\n * Builds the grouped `{ path, query, body, headers, cookies }` parameter for a generated client\n * function, typed from the operation's `Options` (minus `url`). Only the groups the\n * operation actually has are destructured. The trailing `config` parameter carries the\n * runtime `RequestConfig` overrides plus `client`.\n */\nexport function buildRequestParamsSignature(\n node: ast.OperationNode,\n resolver: RequestOptionsNameResolver,\n options: { isConfigurable?: boolean } = {},\n): { signature: string; groups: RequestGroups; names: Array<keyof RequestGroups> } {\n const { isConfigurable = true } = options\n const { groups, isOptional } = getRequestGroupOptionality(node)\n\n const names = requestGroupOrder.filter((key) => groups[key])\n\n // These callers never carry the `contentType` that several media types require.\n const optionsType = hasRequestContentTypeChoice(node)\n ? `Pick<${resolver.response.options(node)}, ${names.map((name) => `'${name}'`).join(' | ')}>`\n : resolver.response.options(node)\n const firstParam = names.length > 0 ? `{ ${names.join(', ')} }: ${optionsType}${isOptional ? ' = {}' : ''}` : null\n const configParam = isConfigurable ? `config: ${buildRequestConfigType(node)} = {}` : null\n\n return {\n signature: [firstParam, configParam].filter(Boolean).join(', '),\n groups,\n names,\n }\n}\n\nexport function buildOperationComments(node: ast.OperationNode, options: BuildOperationCommentsOptions = {}): Array<string> {\n const { splitLines = false } = options\n // The request line leads: free text after a block tag would belong to that tag.\n const comments = [\n getOperationRequestLine(node),\n node.description && `@description ${node.description}`,\n node.summary && `@summary ${node.summary}`,\n node.deprecated && '@deprecated',\n node.externalDocs && `@see ${jsDocEscape([node.externalDocs.url, node.externalDocs.description].filter(Boolean).join(' '))}`,\n ]\n\n const filteredComments = comments.filter((comment): comment is string => Boolean(comment))\n\n if (!splitLines) {\n return filteredComments\n }\n\n return filteredComments.flatMap((text) => text.split(/\\r?\\n/).map((line) => line.trim())).filter((comment): comment is string => Boolean(comment))\n}\n\n/**\n * Whether the operation declares more than one request media type with a schema, so a caller must pick one on `contentType`.\n */\nexport function hasRequestContentTypeChoice(node: ast.OperationNode): boolean {\n return (node.requestBody?.content ?? []).filter((entry) => entry.schema).length > 1\n}\n\n/**\n * Casts a call argument to the client's parameter type; a `'plain'` client is non-generic.\n */\nexport function castToClientOptions(callArg: string, clientName: string, returnType: 'full' | 'data' | 'plain' = 'full'): string {\n return `${callArg} as Parameters<typeof ${clientName}${returnType === 'plain' ? '' : '<true>'}>[0]`\n}\n\n/**\n * Builds the combined `{ body, path, query, headers, cookies }` options object schema for an operation,\n * referencing the already-resolved body and grouped param names. `cookies` appears only on an operation\n * with a cookie parameter, and stays optional because a browser sends its cookies itself. Shared by `@kubb/plugin-ts`'s\n * `Options` type and `@kubb/plugin-zod`'s inferred options schema, so both printers emit the same shape from the same inputs.\n * `primitive: 'object'` is a no-op for the TS printer and tells the Zod printer to emit `z.object(…)` rather\n * than a record.\n */\nexport function buildOptionsSchema(node: ast.OperationNode, resolver: OperationTypeNameResolver, { pairContentTypes = false } = {}): ast.SchemaNode {\n const { path, query, header, cookie } = ast.http.groupParameters(node)\n const hasBody = Boolean(ast.http.requestBody.getSchema(node))\n const createNever = () => ast.factory.createSchema({ type: 'never', primitive: undefined, optional: true })\n const groups = [\n { name: 'path', params: path, resolve: resolver.param.path },\n { name: 'query', params: query, resolve: resolver.param.query },\n { name: 'headers', params: header, resolve: resolver.param.headers },\n { name: 'cookies', params: cookie, resolve: resolver.param.cookies },\n ] as const\n\n const createOptions = (body: ast.SchemaNode, extra: Array<ast.PropertyNode> = []) =>\n // NOTE(v5-stable): the fields were renamed from the legacy beta shape\n // (`data`/`pathParams`/`queryParams`/`headerParams`) to `body`/`path`/`query`/`headers` so the\n // type matches the runtime client. Drop this note once v5 leaves beta.\n ast.factory.createSchema({\n type: 'object',\n primitive: 'object',\n deprecated: node.deprecated,\n properties: [\n ast.factory.createProperty({ name: 'body', required: hasBody && node.requestBody?.required === true, schema: body }),\n ...groups\n .filter(({ name, params }) => name !== 'cookies' || params.length > 0)\n .map(({ name, params, resolve }) => {\n const required = name !== 'cookies' && params.some((param) => param.required)\n\n return ast.factory.createProperty({\n name,\n required,\n schema:\n params.length > 0\n ? ast.factory.createSchema({ type: 'ref', name: resolve.call(resolver.param, node, params[0]!), optional: !required })\n : createNever(),\n })\n }),\n ...extra,\n ],\n })\n\n const variants =\n pairContentTypes && hasRequestContentTypeChoice(node) ? resolveContentTypeVariants(node.requestBody?.content ?? [], resolver.response.body(node)) : []\n if (variants.length < 2) {\n return createOptions(hasBody ? ast.factory.createSchema({ type: 'ref', name: resolver.response.body(node) }) : createNever())\n }\n\n // The first media type is the runtime default, so only the others must pass `contentType`. A bare string sets the\n // request content type at runtime, so it is accepted next to the `{ request }` form.\n return ast.factory.createSchema({\n type: 'union',\n members: variants.map((variant, index) => {\n const contentType = ast.factory.createSchema({ type: 'enum', enumValues: [variant.contentType] })\n\n return createOptions(ast.factory.createSchema({ type: 'ref', name: variant.name }), [\n ast.factory.createProperty({\n name: 'contentType',\n required: index > 0,\n schema: ast.factory.createSchema({\n type: 'union',\n members: [\n contentType,\n ast.factory.createSchema({\n type: 'object',\n primitive: 'object',\n properties: [ast.factory.createProperty({ name: 'request', required: true, schema: contentType })],\n }),\n ],\n }),\n }),\n ])\n }),\n })\n}\n\n/**\n * The schema a status occupies in the `<Name>Responses` record. A status that documents several\n * content types becomes a `{ contentType; data }` union so the runtime can surface the negotiated type\n * on `result.parsed`, while the standalone `<Name>StatusNNN` alias stays the plain body union that the\n * query hooks and `result.data` use. With `streamData`, the stream variant of a 2xx status holds that schema, since the\n * client returns its body unread.\n */\nfunction buildResponseRecordEntry(\n node: ast.OperationNode,\n res: ast.ResponseNode,\n resolver: ResponseStatusNameResolver,\n streamData: ast.SchemaNode | undefined,\n): ast.SchemaNode {\n const statusName = resolver.response.status(node, res.statusCode)\n const variants = (res.content ?? []).filter((entry) => entry.schema)\n if (variants.length <= 1) {\n return ast.factory.createSchema({ type: 'ref', name: statusName })\n }\n\n return ast.factory.createSchema({\n type: 'union',\n members: resolveContentTypeVariants(variants, statusName).map((variant) =>\n ast.factory.createSchema({\n type: 'object',\n primitive: 'object',\n properties: [\n ast.factory.createProperty({\n name: 'contentType',\n required: true,\n // The runtime reports the bare media type, without parameters such as `charset` or `profile`.\n schema: ast.factory.createSchema({ type: 'enum', enumValues: [ast.mediaType.getBase(variant)] }),\n }),\n ast.factory.createProperty({\n name: 'data',\n required: true,\n schema:\n streamData && ast.http.status.isSuccess(res) && ast.mediaType.isStream(variant)\n ? streamData\n : ast.factory.createSchema({ type: 'ref', name: variant.name }),\n }),\n ],\n }),\n ),\n })\n}\n\n/**\n * Builds the per-status `<Name>Responses` record for an operation, referencing the already-resolved\n * `<Name>StatusNNN` names. Shared by `@kubb/plugin-ts`'s `Responses` type and `@kubb/plugin-zod`'s\n * inferred responses schema, so both emit the same shape from the same inputs.\n *\n * Always emits the keyed record, even when an operation declares no responses. An operation with no\n * responses renders as an empty object, which keeps every consumer's import (for example the axios\n * SDK's `RequestResult<XResponses>`) resolvable instead of pointing at a missing export.\n *\n * `streamData` is the type of a stream variant's `data`, such as a `ReadableStream<Uint8Array>` reference.\n */\nexport function buildResponses(\n node: ast.OperationNode,\n resolver: ResponseStatusNameResolver,\n { streamData }: { streamData?: ast.SchemaNode } = {},\n): ast.SchemaNode {\n return ast.factory.createSchema({\n type: 'object',\n primitive: 'object',\n properties: node.responses.map((res) =>\n ast.factory.createProperty({\n name: String(res.statusCode),\n required: true,\n schema: buildResponseRecordEntry(node, res, resolver, streamData),\n }),\n ),\n })\n}\n\nexport function resolveErrorNames(node: ast.OperationNode, resolver: ResponseStatusNameResolver): string[] {\n return ast.http.responses.filterError(node).map((response) => resolver.response.status(node, response.statusCode))\n}\n\nexport function resolveSuccessNames(node: ast.OperationNode, resolver: ResponseStatusNameResolver): string[] {\n return ast.http.responses.filterSuccess(node).map((response) => resolver.response.status(node, response.statusCode))\n}\n\nexport function resolveStatusCodeNames(node: ast.OperationNode, resolver: ResponseStatusNameResolver): string[] {\n return node.responses.map((response) => resolver.response.status(node, response.statusCode))\n}\n\n/**\n * Lists the type names an operation's types file declares, computed once per resolver and `options` so every\n * dependent reads the same list.\n */\nexport function resolveOperationTypeNames(\n node: ast.OperationNode,\n resolver: OperationTypeNameResolver & Pick<Resolver, 'memo'>,\n options: ResolveOperationTypeNameOptions = {},\n): string[] {\n const key = `${node.operationId}\\0${options.order ?? ''}\\0${options.responseStatusNames ?? ''}\\0${options.includeParams === false ? 'noparams' : ''}\\0${(options.exclude ?? []).join(',')}`\n return resolver.memo(`operationTypeNames:${key}`, () => {\n const { path, query, header, cookie } = ast.http.groupParameters(node)\n const responseStatusNames =\n options.responseStatusNames === 'error'\n ? resolveErrorNames(node, resolver)\n : options.responseStatusNames === false\n ? []\n : resolveStatusCodeNames(node, resolver)\n const exclude = new Set(options.exclude ?? [])\n const paramNames =\n options.includeParams === false\n ? []\n : [\n ...path.map((param) => resolver.param.path(node, param)),\n ...query.map((param) => resolver.param.query(node, param)),\n ...header.map((param) => resolver.param.headers(node, param)),\n ...cookie.map((param) => resolver.param.cookies(node, param)),\n ]\n const bodyAndResponseNames = [ast.http.requestBody.getSchema(node) ? resolver.response.body(node) : null, resolver.response.response(node)]\n const names =\n options.order === 'body-response-first'\n ? [...bodyAndResponseNames, ...paramNames, ...responseStatusNames]\n : [...paramNames, ...bodyAndResponseNames, ...responseStatusNames]\n\n return names.filter((name): name is string => Boolean(name) && !exclude.has(name as string))\n })\n}\n\nexport function resolveResponseTypes(node: ast.OperationNode, resolver: ResponseNameResolver): Array<[statusCode: number | 'default', typeName: string]> {\n const types: Array<[number | 'default', string]> = []\n\n for (const response of node.responses) {\n if (response.statusCode === 'default') {\n types.push(['default', resolver.response.response(node)])\n continue\n }\n\n const code = Number(response.statusCode)\n if (Number.isNaN(code)) {\n continue\n }\n\n types.push([code, ast.http.status.isSuccess(code) ? resolver.response.response(node) : resolver.response.status(node, response.statusCode)])\n }\n\n return types\n}\n\n/**\n * One object schema for a list of parameters or response headers, with each schema inline.\n */\nexport function buildParamsSchema(params: Array<ast.ParameterNode>): ast.SchemaNode {\n return ast.factory.createSchema({\n type: 'object',\n // `primitive: 'object'` makes a printer emit an object schema and not a record.\n primitive: 'object',\n properties: params.map((param) => ast.factory.createProperty({ name: param.name, required: param.required, schema: param.schema })),\n })\n}\n\n/**\n * One object schema for the parameters of an operation, where each key points at the const of\n * that parameter. The const already has its optional wrapper, so every key is required here.\n */\nexport function buildParamRefsSchema({\n node,\n params,\n resolver,\n}: {\n node: ast.OperationNode\n params: Array<ast.ParameterNode>\n resolver: { param: { name(node: ast.OperationNode, param: ast.ParameterNode): string } }\n}): ast.SchemaNode {\n return ast.factory.createSchema({\n type: 'object',\n primitive: 'object',\n properties: params.map((param) =>\n ast.factory.createProperty({\n name: param.name,\n required: true,\n schema: ast.factory.createSchema({ type: 'ref', name: resolver.param.name(node, param) }),\n }),\n ),\n })\n}\n\ntype SchemaEntry = { schema: ast.SchemaNode; name: string; keysToOmit?: Array<string> | null }\n\n/**\n * The schemas a name with several content types needs: one per content type, then the union of\n * them under `baseName`.\n */\nexport function buildContentTypeEntries(\n entries: Array<ContentVariantInput>,\n baseName: string,\n decorate: (schema: ast.SchemaNode) => ast.SchemaNode = (schema) => schema,\n): Array<SchemaEntry> {\n const variants = resolveContentTypeVariants(entries, baseName)\n const union = ast.factory.createSchema({\n type: 'union',\n members: variants.map((variant) => ast.factory.createSchema({ type: 'ref', name: variant.name })),\n })\n\n return [\n ...variants.map((variant) => ({ schema: decorate(variant.schema), name: variant.name, keysToOmit: variant.keysToOmit })),\n { schema: union, name: baseName },\n ]\n}\n\n/**\n * The schema behind a response or error name: a union of the per-status schemas. Returns `null`\n * when a response is a `$ref` to a component whose name is already `name`, which would declare it twice.\n */\nexport function buildResponseUnionSchema({\n node,\n responses,\n name,\n resolver,\n fallbackUnknown,\n}: {\n node: ast.OperationNode\n responses: Array<ast.ResponseNode>\n name: string\n resolver: { name(name: string): string; response: { status(node: ast.OperationNode, statusCode: ast.StatusCode): string } }\n /**\n * Print an unknown schema when no response has one, so the name still resolves.\n */\n fallbackUnknown: boolean\n}): ast.SchemaNode | null {\n const importedNames = new Set(ast.http.responses.getImportedNames(responses).map((refName) => resolver.name(refName)))\n if (importedNames.has(name)) return null\n\n const members = responses.map((res) => ast.factory.createSchema({ type: 'ref', name: resolver.response.status(node, res.statusCode) }))\n if (members.length === 0) return fallbackUnknown ? ast.factory.createSchema({ type: 'unknown' }) : null\n\n return members.length === 1 ? members[0]! : ast.factory.createSchema({ type: 'union', members })\n}\n","import { type Adapter, Diagnostics } from '@kubb/kit'\nimport type { AdapterOas } from '@kubb/adapter-oas'\n\n/**\n * Narrows the generic `Adapter` from a generator context to the OpenAPI adapter,\n * so OAS-only options (`dateType`, `enums`) and the parsed `document` are typed.\n *\n * Throws when a non-OAS adapter is configured, turning a silently wrong cast into a\n * clear, actionable error at the point of use.\n *\n * @example\n * ```ts\n * const { dateType } = getOasAdapter(ctx.adapter).options\n * ```\n */\nexport function getOasAdapter(adapter: Adapter): Adapter<AdapterOas> {\n if (adapter.name !== 'oas') {\n throw new Diagnostics.Error({\n code: Diagnostics.code.adapterRequired,\n severity: 'error',\n message: `Expected the OpenAPI adapter (adapterOas), but received \"${adapter.name}\".`,\n help: 'Set `adapter: adapterOas()` in kubb.config.ts.',\n location: { kind: 'config' },\n })\n }\n\n return adapter as Adapter<AdapterOas>\n}\n","import { ensureValidVarName, toFilePath } from '@internals/utils'\nimport { ast, casing } from '@kubb/kit'\nimport type { GeneratorContext, Resolver, ResolverFile } from '@kubb/kit'\n\n/**\n * The shared top-level `name` of the operation plugins, computed once per operation name and build.\n */\nexport function resolveOperationName(this: Resolver, name: string): string {\n return this.memo(`operation:${name}`, () => ensureValidVarName(casing.camel(name)))\n}\n\n/**\n * Builds the allocation key for a declaration an operation owns. `scope` names which declaration\n * it is, so two of them never share an allocation even when a custom resolver gives both the same\n * name. Leave `scope` empty for the operation's own declaration.\n *\n * The key starts from the operation's input `pointer`, which macros keep, so a plugin whose macro\n * rewrites the method or path still resolves another plugin's names for the same operation.\n *\n * @example\n * ```ts\n * resolver.resolveName({ key: operationKey(node, 'response', 'status', 404), name })\n * ```\n */\nexport function operationKey(node: ast.OperationNode, ...scope: Array<string | number>): Array<string | undefined> {\n const source = node.pointer ? [node.pointer] : [node.method, node.path]\n return ['operation', ...source, ...scope.map(String)]\n}\n\n/**\n * The `param` namespace shared by the schema-producing plugins (ts, zod, faker):\n * per-parameter names plus the grouped `Path`/`Query`/`Headers`/`Cookies` names, all routed\n * through the plugin's top-level `name` casing.\n */\nexport type OperationParamResolver = {\n name(this: Resolver, node: ast.OperationNode, param: ast.ParameterNode): string\n path(this: Resolver, node: ast.OperationNode): string\n query(this: Resolver, node: ast.OperationNode): string\n headers(this: Resolver, node: ast.OperationNode): string\n cookies(this: Resolver, node: ast.OperationNode): string\n}\n\n/**\n * The `response` namespace shared by the schema-producing plugins: per-status,\n * body, and combined response names, all routed through the plugin's top-level\n * `name` casing.\n */\nexport type OperationResponseResolver = {\n status(this: Resolver, node: ast.OperationNode, statusCode: ast.StatusCode): string\n /**\n * Name of the headers a response declares, such as `ListPetsStatus200Headers`.\n */\n headers(this: Resolver, node: ast.OperationNode, statusCode: ast.StatusCode): string\n body(this: Resolver, node: ast.OperationNode): string\n responses(this: Resolver, node: ast.OperationNode): string\n response(this: Resolver, node: ast.OperationNode): string\n}\n\n/**\n * Builds the shared `param` namespace. Spread the result into `createResolver`\n * and override individual methods next to it when a plugin deviates.\n *\n * @example\n * ```ts\n * createResolver<PluginTs>({ param: createOperationParamResolver(), ... })\n * ```\n */\nexport function createOperationParamResolver(): OperationParamResolver {\n return {\n name(node, param) {\n const name = this.name(`${node.operationId} ${param.in} ${param.name}`)\n return this.resolveName({ key: operationKey(node, 'param', 'name', param.in, param.name), name })\n },\n path(node) {\n const name = this.name(`${node.operationId} Path`)\n return this.resolveName({ key: operationKey(node, 'param', 'path'), name })\n },\n query(node) {\n const name = this.name(`${node.operationId} Query`)\n return this.resolveName({ key: operationKey(node, 'param', 'query'), name })\n },\n headers(node) {\n const name = this.name(`${node.operationId} Headers`)\n return this.resolveName({ key: operationKey(node, 'param', 'headers'), name })\n },\n cookies(node) {\n const name = this.name(`${node.operationId} Cookies`)\n return this.resolveName({ key: operationKey(node, 'param', 'cookies'), name })\n },\n }\n}\n\n/**\n * Builds the shared `response` namespace. Spread the result into\n * `createResolver` and add plugin-specific methods (`options`, `error`) next\n * to it.\n *\n * @example\n * ```ts\n * createResolver<PluginTs>({ response: { ...createOperationResponseResolver(), options(node) {...} }, ... })\n * ```\n */\nexport function createOperationResponseResolver(): OperationResponseResolver {\n return {\n status(node, statusCode) {\n const name = this.name(`${node.operationId} Status ${statusCode}`)\n return this.resolveName({ key: operationKey(node, 'response', 'status', statusCode), name })\n },\n headers(node, statusCode) {\n const name = this.name(`${node.operationId} Status ${statusCode} Headers`)\n return this.resolveName({ key: operationKey(node, 'response', 'headers', statusCode), name })\n },\n body(node) {\n const name = this.name(`${node.operationId} Body`)\n return this.resolveName({ key: operationKey(node, 'response', 'body'), name })\n },\n responses(node) {\n const name = this.name(`${node.operationId} Responses`)\n return this.resolveName({ key: operationKey(node, 'response', 'responses'), name })\n },\n response(node) {\n const name = this.name(`${node.operationId} Response`)\n return this.resolveName({ key: operationKey(node, 'response', 'response'), name })\n },\n }\n}\n\n/**\n * Builds a resolver `file` override whose base name runs every path segment\n * through `toFilePath`, casing the final segment with `caseLast`.\n *\n * @example\n * ```ts\n * createResolver<PluginTs>({ file: createCasedFile(pascalCase), ... })\n * ```\n */\nexport function createCasedFile(caseLast: (part: string) => string): ResolverFile {\n return {\n baseName({ name, extname }) {\n return this.memo(`file:${name}\\0${extname}`, (): ast.FileNode['baseName'] => `${toFilePath(name, caseLast)}${extname}`)\n },\n }\n}\n\ntype SchemaIndexContext = Pick<GeneratorContext, 'memo' | 'schemas'>\n\n/**\n * Names of the schemas in a circular reference chain, computed once per build.\n */\nexport function getCircularNames(ctx: SchemaIndexContext): ReadonlySet<string> {\n return ctx.memo('circularNames:set', () => ast.graph.getCircularNames(ctx.schemas))\n}\n\n/**\n * Names of the schemas whose type is `enum`, computed once per build.\n */\nexport function getEnumNames(ctx: SchemaIndexContext): ReadonlySet<string> {\n return ctx.memo('enumNames:set', () => new Set(ctx.schemas.flatMap((schema) => (schema.type === 'enum' && schema.name ? [schema.name] : []))))\n}\n\ndeclare global {\n namespace Kubb {\n interface MemoRegistry {\n operation: string\n file: ast.FileNode['baseName']\n operationTypeNames: Array<string>\n }\n }\n}\n","import { jsDocEscape } from '@internals/utils'\nimport { ast, text } from '@kubb/kit'\n\n/**\n * Whether the node is a plain inline object whose properties can merge into another object schema.\n * Input checks, `additionalProperties`, `patternProperties`, `propertyNames`, and a nullable or\n * optional wrapper rule it out.\n */\nexport function isPlainInlineObject(node: ast.SchemaNode): boolean {\n if (node.type !== 'object') return false\n if (hasInputChecks(node)) return false\n if (node.nullable || node.optional || node.nullish) return false\n\n const hasAdditionalProperties = node.additionalProperties !== undefined\n const hasPatternProperties = Boolean(node.patternProperties)\n\n return !hasAdditionalProperties && !hasPatternProperties && !node.propertyNames\n}\n\n/**\n * Whether a node prints as a plain object schema, which other schemas can extend or discriminate on.\n * Covers object nodes, a `$ref` that resolves to an object or is still unresolved, a union with one\n * object member, and an object-composable `allOf`.\n *\n * A nullable or optional node, a node with input checks, and a ref into `cyclicSchemas` do not count.\n */\nexport function isObjectSchemaNode(node: ast.SchemaNode, cyclicSchemas?: ReadonlySet<string>): boolean {\n if (node.nullable || node.optional || node.nullish) return false\n if (hasInputChecks(node)) return false\n if (node.type === 'object') {\n const hasProperties = Boolean(node.properties?.length)\n const hasTypedAdditionalProperties = Boolean(node.additionalProperties && node.additionalProperties !== true)\n const hasPatternProperties = Boolean(node.patternProperties)\n\n const isRecord = !hasProperties && (hasTypedAdditionalProperties || hasPatternProperties || node.propertyNames)\n\n return !isRecord\n }\n\n if (node.type === 'ref') {\n const refName = ast.ref.getName(node)\n if (refName && cyclicSchemas?.has(refName)) return false\n const resolved = ast.ref.mergeSchema(node)\n // An unresolved ref keeps its `ref` type; assume it resolves to an object (matches the printer's\n // prior optimism that only a resolved intersection blocks a discriminated union).\n return resolved.type === 'ref' || isObjectSchemaNode(resolved, cyclicSchemas)\n }\n\n if (node.type === 'union') {\n const members = node.members ?? []\n return members.length === 1 && isObjectSchemaNode(members[0]!, cyclicSchemas)\n }\n\n return isObjectComposableIntersection(node, cyclicSchemas)\n}\n\n/**\n * Whether an `allOf` is an object base plus inline object members, so it can print as one object\n * schema and not as an intersection.\n */\nexport function isObjectComposableIntersection(node: ast.SchemaNode, cyclicSchemas?: ReadonlySet<string>): boolean {\n if (node.type !== 'intersection') return false\n const [first, ...rest] = node.members ?? []\n return !!first && isObjectSchemaNode(first, cyclicSchemas) && rest.every(isPlainInlineObject)\n}\n\n/**\n * Marks a property required in a later `allOf` member when an earlier member already requires it.\n */\nexport function preserveRequiredProperties(members: Array<ast.SchemaNode>): Array<ast.SchemaNode> {\n const hasRequiredProperty = ({\n node,\n propertyName,\n seen = new Set<ast.SchemaNode>(),\n }: {\n node: ast.SchemaNode\n propertyName: string\n seen?: Set<ast.SchemaNode>\n }): boolean => {\n if (seen.has(node)) return false\n seen.add(node)\n const resolved = ast.ref.mergeSchema(node)\n const composition = ast.schema.narrow(resolved, ast.schema.types.intersection) ?? ast.schema.narrow(resolved, ast.schema.types.union)\n // Property lookup skips unions, but a single-member union prints as its member.\n if (composition) {\n if (composition.type === ast.schema.types.union && composition.members?.length !== 1) return false\n return composition.members?.some((child) => hasRequiredProperty({ node: child, propertyName, seen })) ?? false\n }\n return ast.schema\n .findProperties({ node: resolved, propertyName })\n .some((property) => property.required !== false && !property.schema.optional && !property.schema.nullish)\n }\n\n return members.map((member, index) => {\n const object = ast.schema.narrow(member, ast.schema.types.object)\n if (!object || index === 0) return member\n\n return {\n ...object,\n properties: object.properties.map((property) => {\n const required = members.slice(0, index).some((base) => hasRequiredProperty({ node: base, propertyName: property.name }))\n if (!required) return property\n\n return {\n ...property,\n required: true,\n schema: { ...property.schema, optional: false, nullish: false, nullable: property.schema.nullable || property.schema.nullish },\n }\n }),\n }\n })\n}\n\n/**\n * Format a default value as a code-level literal.\n * Arrays and objects keep their contents as a JSON literal, primitives become their string\n * representation, strings are quoted.\n */\nexport function formatDefault(value: unknown): string {\n if (typeof value === 'string') return text.quote(value)\n if (typeof value === 'object' && value !== null) return JSON.stringify(value)\n\n return String(value ?? '')\n}\n\n/**\n * Formats a default so the literal matches the type of the generated schema, or returns `null` when\n * the default should be dropped.\n *\n * An OpenAPI `default` does not always agree with its schema: a `bigint` field (`format: int64`)\n * carries a `number` default, and a spec may put `default: {}` on an `array`. Printed as they are,\n * those do not typecheck, so a bigint default becomes a `BigInt(...)` literal and a non-array default\n * on an array is dropped.\n */\nexport function defaultLiteral(node: ast.SchemaNode | undefined, value: unknown): string | null {\n // A `null` default is invalid on a non-nullable schema and redundant on a nullish one, and emitting\n // it produces a bare `.default()` (no argument). Drop it.\n if (value === null) return null\n const resolved = node ? ast.ref.mergeSchema(node) : undefined\n // A binary schema parses to a `Blob`, which a spec default, a string, cannot be.\n if (resolved?.type === 'blob') return null\n if (resolved && ast.schema.narrow(resolved, 'bigint')) {\n // A string keeps a value above the safe integer range exact, where a number literal is already rounded.\n // `BigInt(value)` spells a large number out in digits, where `String(1e21)` is `'1e+21'`, which `BigInt` cannot parse.\n if (typeof value === 'bigint' || (typeof value === 'number' && Number.isInteger(value))) return `BigInt('${BigInt(value)}')`\n return null\n }\n if (resolved && ast.schema.narrow(resolved, 'array')) {\n return Array.isArray(value) ? JSON.stringify(value) : null\n }\n // An enum/literal schema narrows to its members (e.g. `1 | 3`), but the spec default may not match\n // that type (`default: '1'` on a numeric enum). Emit the matching member's typed literal so the\n // default agrees with the schema, or drop a default that matches no member.\n const enumNode = resolved ? ast.schema.narrow(resolved, 'enum') : undefined\n if (enumNode) {\n const values = ast.schema.getLiterals(enumNode)\n if (values.length) {\n const match = values.find((member) => member === value || String(member) === String(value))\n return match != null ? formatDefault(match) : null\n }\n }\n return formatDefault(value)\n}\n\n/**\n * Numeric limits of a schema: min, max, exclusive bounds, and `multipleOf`.\n */\nexport type NumericConstraints = Pick<ast.NumberSchemaNode, 'min' | 'max' | 'exclusive' | 'multipleOf'>\n\n/**\n * Digit pattern for a `type: 'string'` schema that carries an integer `format`, the way ProtoJSON\n * encodes 64-bit integers. Returns `undefined` for every other format, and a `pattern` from the\n * spec takes precedence over this fallback.\n *\n * @example\n * ```ts\n * integerFormatPattern('uint64') // '^\\\\d+$'\n * ```\n */\nexport function integerFormatPattern(format: string | undefined): string | undefined {\n if (format === 'int32' || format === 'int64') return '^-?\\\\d+$'\n if (format === 'uint64') return '^\\\\d+$'\n\n return undefined\n}\n\n/**\n * Numeric bounds for a bigint: the inclusive, whole, safe bounds faker mocks against, and a whole, safe `multipleOf`.\n */\nexport function bigintConstraints({ min, max, exclusive, multipleOf }: NumericConstraints): NumericConstraints {\n return { ...ast.schema.getNumberBounds({ min, max, exclusive, integer: true }), multipleOf: Number.isSafeInteger(multipleOf) ? multipleOf : undefined }\n}\n\n/**\n * Numeric limits whose `min` and `max` may be digit strings, for 64-bit bounds a `number` cannot hold.\n */\nexport type NumericBounds = Omit<NumericConstraints, 'min' | 'max'> & { min?: number | string; max?: number | string }\n\nconst integerFormatRanges: Record<'integer' | 'bigint', Record<string, [min: bigint, max: bigint]>> = {\n integer: {\n int8: [-(2n ** 7n), 2n ** 7n - 1n],\n uint8: [0n, 2n ** 8n - 1n],\n int16: [-(2n ** 15n), 2n ** 15n - 1n],\n uint16: [0n, 2n ** 16n - 1n],\n int32: [-(2n ** 31n), 2n ** 31n - 1n],\n uint32: [0n, 2n ** 32n - 1n],\n },\n bigint: { int64: [-(2n ** 63n), 2n ** 63n - 1n], uint64: [0n, 2n ** 64n - 1n] },\n}\n\n/**\n * Adds the range of an integer `format` to a schema's limits. A bound from the spec stays when it\n * is at least as tight as the format's.\n *\n * @example\n * ```ts\n * withFormatRange({ format: 'int32', min: 0 }, 'integer') // { format: 'int32', min: 0, max: '2147483647' }\n * ```\n */\nexport function withFormatRange(node: NumericConstraints & { format?: string }, type: 'integer' | 'bigint'): NumericBounds {\n const range = node.format ? integerFormatRanges[type][node.format] : undefined\n if (!range) return node\n const [min, max] = range\n\n return {\n ...node,\n min: node.min === undefined || node.min < Number(min) ? String(min) : node.min,\n max: node.max === undefined || node.max > Number(max) ? String(max) : node.max,\n }\n}\n\n/**\n * Whether `propertyNames` needs its own check. A record schema checks its keys, but an object with\n * `properties` and a record keyed by `patternProperties` do not.\n */\nexport function hasKeyCheck(node: ast.SchemaNode): node is ast.ObjectSchemaNode & { propertyNames: ast.SchemaNode } {\n if (node.type !== 'object' || !node.propertyNames) return false\n const hasTypedAdditionalProperties = Boolean(node.additionalProperties && node.additionalProperties !== true)\n\n return node.properties.length > 0 || (Boolean(node.patternProperties) && !hasTypedAdditionalProperties)\n}\n\n/**\n * Whether the node has checks that run on the raw input: `conditionals`, property counts, or a key check.\n */\nexport function hasInputChecks(node: ast.SchemaNode): boolean {\n return Boolean(node.conditionals?.length) || (node.type === 'object' && (node.min !== undefined || node.max !== undefined)) || hasKeyCheck(node)\n}\n\n/**\n * Marks an inline `oneOf` object strict, so a value with the keys of another member does not match it.\n */\nexport function strictOneOfNode(node: ast.SchemaNode): ast.SchemaNode {\n return node.type === 'object' && node.additionalProperties === undefined ? { ...node, additionalProperties: false } : node\n}\n\n/**\n * Whether the `coercion` option turns on conversion for a type.\n */\nexport function shouldCoerce(\n coercion: boolean | { dates?: boolean; strings?: boolean; numbers?: boolean } | undefined,\n type: 'dates' | 'strings' | 'numbers',\n): boolean {\n return coercion === true || (typeof coercion === 'object' && Boolean(coercion[type]))\n}\n\n/**\n * A numeric bound as source code. A bigint bound prints as `BigInt('…')`, which is exact and\n * compiles below ES2020, where a `1n` literal does not.\n */\nexport function numericLiteral(value: number | string, isBigint: boolean): number | string {\n return isBigint ? `BigInt('${value}')` : value\n}\n\n/**\n * The JSDoc lines above a schema const: its description, and `@deprecated` when the spec says so.\n * A `$ref` const gets none, because the const it points to has them.\n */\nexport function schemaComments(node: ast.SchemaNode): Array<string> {\n if (node.type === ast.schema.types.ref) return []\n\n return [node.description && jsDocEscape(node.description), node.deprecated && '@deprecated'].filter((comment): comment is string => Boolean(comment))\n}\n","import type { ast } from '@kubb/kit'\nimport { Const, File, Function, Type } from '@kubb/renderer-jsx'\nimport type { KubbReactNode } from '@kubb/renderer-jsx'\nimport type { PrinterValibotFactory } from '../printers/printerValibot.ts'\nimport type { PluginValibot } from '../types.ts'\n\ntype Props = {\n name: string\n node: ast.SchemaNode\n /**\n * Printer instance the generator created for this node.\n */\n printer: ast.Printer<PrinterValibotFactory>\n /**\n * Name of the inferred type alias to export, or `null` for no alias.\n */\n inferTypeName?: string | null\n /**\n * The helper the alias is printed with. `InferInput` is the value a request schema accepts,\n * `InferOutput` the value a schema returns. They differ for a schema that converts.\n *\n * @default 'InferOutput'\n */\n inferKind?: 'InferInput' | 'InferOutput'\n typeGuards?: PluginValibot['resolvedOptions']['typeGuards']\n isName?: string | null\n assertName?: string | null\n /**\n * Set when the schema is part of a circular reference. Its initializer reaches itself through\n * `v.lazy(() => …)`, which is implicitly `any` under `strict`, so the const gets a `v.GenericSchema` annotation.\n */\n cyclic?: boolean\n /**\n * JSDoc lines above the schema const, so an editor shows them on hover.\n */\n comments?: Array<string>\n}\n\nexport function Valibot({\n name,\n node,\n printer,\n inferTypeName,\n inferKind = 'InferOutput',\n typeGuards,\n isName,\n assertName,\n cyclic,\n comments = [],\n}: Props): KubbReactNode {\n const output = printer.print(node)\n const printerImports = printer.drainImports()\n\n if (!output) {\n return\n }\n\n // `v.is` and `v.assert` narrow to the value the schema accepts, before any conversion.\n const guardType = `v.InferInput<typeof ${name}>`\n const shouldGenerateIs = isName && (typeof typeGuards === 'object' ? (typeGuards.is ?? true) : Boolean(typeGuards))\n const shouldGenerateAssert = assertName && (typeof typeGuards === 'object' ? (typeGuards.assert ?? true) : Boolean(typeGuards))\n\n return (\n <>\n {printerImports.map((imp) => (\n <File.Import\n key={[name, imp.path, imp.name].join('-')}\n name={imp.name}\n path={imp.path}\n root={imp.root}\n isTypeOnly={imp.isTypeOnly}\n isNameSpace={imp.isNameSpace}\n />\n ))}\n <File.Source name={name} isExportable isIndexable>\n <Const export name={name} type={cyclic ? 'v.GenericSchema' : undefined} JSDoc={comments.length ? { comments } : undefined}>\n {output}\n </Const>\n </File.Source>\n {inferTypeName && (\n <File.Source name={inferTypeName} isExportable isIndexable isTypeOnly>\n <Type export name={inferTypeName}>\n {`v.${inferKind}<typeof ${name}>`}\n </Type>\n </File.Source>\n )}\n {shouldGenerateIs && (\n <File.Source name={isName} isExportable isIndexable>\n <Const export name={isName} JSDoc={{ comments: [`Type guard for {@link ${name}}`] }}>\n {`(data: unknown): data is ${guardType} => v.is(${name}, data)`}\n </Const>\n </File.Source>\n )}\n {shouldGenerateAssert && (\n <File.Source name={assertName} isExportable isIndexable>\n <Function\n export\n name={assertName}\n params=\"data: unknown\"\n returnType={`asserts data is ${guardType}`}\n JSDoc={{ comments: [`Asserter for {@link ${name}}`, '@throws {v.ValiError} If data is invalid'] }}\n >\n {`v.assert(${name}, data)`}\n </Function>\n </File.Source>\n )}\n </>\n )\n}\n","import {\n bigintConstraints,\n defaultLiteral,\n formatDefault,\n hasInputChecks,\n hasKeyCheck,\n integerFormatPattern,\n isObjectComposableIntersection,\n isObjectSchemaNode,\n type NumericBounds,\n numericLiteral,\n preserveRequiredProperties,\n shouldCoerce,\n strictOneOfNode,\n withFormatRange,\n} from '@internals/shared'\nimport { buildList, buildObject, objectKey, toRegExpString } from '@internals/utils'\nimport { ast, createPrinter, text } from '@kubb/kit'\nimport type { PluginValibot, ResolverValibot } from '../types.ts'\n\n/**\n * Partial map of node-type overrides for the Valibot printer, keyed by `SchemaType`. Each function\n * replaces the built-in handler and can call `this.transform`, `this.base`, and `this.options`.\n */\nexport type PrinterValibotNodes = ast.PrinterPartial<string, PrinterValibotOptions>\n\nexport type PrinterValibotOptions = {\n /**\n * Output form for an OpenAPI `pattern` inside `v.regex(...)`.\n *\n * @default 'literal'\n */\n regexType?: PluginValibot['resolvedOptions']['regexType']\n /**\n * How a `oneOf` without a discriminator is validated: strict members, or exactly one match.\n *\n * @default 'union'\n */\n oneOfType?: PluginValibot['resolvedOptions']['oneOfType']\n /**\n * Convert input before validation: `v.toString()`, `v.toNumber()`, and `v.toDate()`.\n *\n * @default false\n */\n coercion?: PluginValibot['resolvedOptions']['coercion']\n /**\n * Which way a node converts between its wire type and its runtime type:\n * - `'decode'` (default): wire into runtime, used by response schemas.\n * - `'encode'`: runtime back to wire, used by request bodies and parameters.\n *\n * A handler that returns different output per direction makes the generator emit an\n * `${name}InputSchema` variant for that component.\n */\n direction?: 'encode' | 'decode'\n /**\n * The adapter's `dateType`. `'stringLocal'` drops the timestamp check, because Valibot has no\n * check for a date-time without an offset.\n */\n dateType?: ast.ParserOptions['dateType']\n /**\n * Turns a schema name from the spec into the name of its generated const.\n */\n resolver?: ResolverValibot\n /**\n * Property names to drop from the printed object with `v.omit(...)`.\n */\n keysToOmit?: Array<string> | null\n /**\n * Schema names that are part of a circular reference. A `$ref` to one of them prints inside\n * `v.lazy(() => ...)`.\n */\n cyclicSchemas?: ReadonlySet<string>\n /**\n * Custom handler map for node type overrides.\n */\n nodes?: PrinterValibotNodes\n}\n\n/**\n * Factory options for the Valibot printer: its name, options, and output types.\n */\nexport type PrinterValibotFactory = ast.PrinterFactoryOptions<'valibot', PrinterValibotOptions, string, string>\n\ntype LengthConstraints = { min?: number; max?: number; pattern?: string }\n\ntype PrinterContext = { transform: (node: ast.SchemaNode) => string | null; options: PrinterValibotOptions }\n\ntype ModifierOptions = {\n value: string\n schema: ast.SchemaNode\n nullable?: boolean\n optional?: boolean\n nullish?: boolean\n defaultValue?: unknown\n title?: string\n description?: string\n examples?: Array<unknown>\n direction?: PrinterValibotOptions['direction']\n}\n\nconst UNKNOWN = 'v.unknown()'\n\n// A check on the raw input skips every value that is not a plain object.\nconst NOT_OBJECT = 'typeof value !== \"object\" || value === null || Array.isArray(value)'\n\n// Actions for string `format`s that Valibot checks with a dedicated action.\nconst stringFormatActions = new Map<string | undefined, string>([\n ['byte', 'v.base64()'],\n ['base64', 'v.base64()'],\n ['ulid', 'v.ulid()'],\n])\n\nfunction pipe(base: string, actions: Array<string | false | null | undefined>): string {\n const list = actions.filter(Boolean)\n\n return list.length ? `v.pipe(${[base, ...list].join(', ')})` : base\n}\n\nfunction lengthActions({ min, max, pattern }: LengthConstraints, regexType: PrinterValibotOptions['regexType']): Array<string> {\n return [\n min !== undefined && `v.minLength(${min})`,\n max !== undefined && `v.maxLength(${max})`,\n pattern !== undefined && `v.regex(${toRegExpString(pattern, regexType === 'constructor' ? 'RegExp' : null)})`,\n ].filter((action): action is string => Boolean(action))\n}\n\nfunction numberActions({ min, max, exclusive, multipleOf }: NumericBounds, isBigint = false): Array<string> {\n const literal = (value: number | string) => numericLiteral(value, isBigint)\n\n return [\n min !== undefined && `v.minValue(${literal(min)})`,\n max !== undefined && `v.maxValue(${literal(max)})`,\n exclusive?.min !== undefined && `v.gtValue(${literal(exclusive.min)})`,\n exclusive?.max !== undefined && `v.ltValue(${literal(exclusive.max)})`,\n multipleOf !== undefined && `v.multipleOf(${literal(multipleOf)})`,\n ].filter((action): action is string => Boolean(action))\n}\n\n// The actions an `allOf` member adds to a bare string, number, or array. An empty list means the\n// member prints as its own schema.\nfunction memberActions({\n member,\n base,\n regexType,\n}: {\n member: ast.SchemaNode\n base: ast.SchemaNode\n regexType: PrinterValibotOptions['regexType']\n}): Array<string> {\n // Checks on the raw input cannot ride along as actions, so that member prints as its own schema.\n if (hasChecks(member)) return []\n if (member.primitive === 'string') return lengthActions(ast.schema.narrow(member, 'string') ?? {}, regexType)\n if (member.primitive === 'number' || member.primitive === 'integer') {\n const numeric = ast.schema.narrow(member, 'number') ?? ast.schema.narrow(member, 'integer') ?? {}\n // The base decides the value the bounds compare with: a bigint base takes bigint bounds.\n if (base.type === ast.schema.types.bigint) return numberActions(bigintConstraints(numeric), true)\n\n return [...(member.primitive === 'integer' && base.type !== ast.schema.types.integer ? ['v.integer()'] : []), ...numberActions(numeric)]\n }\n if (member.primitive === 'array') {\n const array = ast.schema.narrow(member, 'array')\n return array && !array.contains ? lengthActions({ min: array.min, max: array.max }, regexType) : []\n }\n\n return []\n}\n\nfunction buildLiteral(value: unknown): string {\n if (value === null) return 'v.null()'\n if (Array.isArray(value)) return `v.strictTuple([${value.map((item) => buildLiteral(item)).join(', ')}])`\n if (typeof value === 'object') {\n const properties = Object.entries(value).map(([name, item]) => `${JSON.stringify(name)}: ${buildLiteral(item)}`)\n return `v.strictObject({${properties.join(', ')}})`\n }\n\n return `v.literal(${formatDefault(value)})`\n}\n\n// `v.picklist` takes strings and numbers only, so any other set prints as a union of literals.\nfunction buildEnum(values: Array<unknown>): string {\n if (values.length === 1) return buildLiteral(values[0])\n if (values.every((value) => typeof value === 'string' || typeof value === 'number')) {\n return `v.picklist([${values.map((value) => formatDefault(value)).join(', ')}])`\n }\n\n return `v.union([${values.map((value) => buildLiteral(value)).join(', ')}])`\n}\n\n// A spec default is a string, which does not fit an encode schema that takes a `Date`.\nfunction expectsDate(node: ast.SchemaNode, direction: PrinterValibotOptions['direction']): boolean {\n const resolved = ast.ref.mergeSchema(node)\n\n return direction === 'encode' && (resolved.type === 'date' || resolved.type === 'time') && resolved.representation !== 'string'\n}\n\n// An object with `properties`, `patternProperties`, and `additionalProperties: false` takes a key that\n// is declared or matches a pattern. Its rest schema checks the values, so the keys need their own check.\nfunction hasPatternKeyCheck(node: ast.SchemaNode): node is ast.ObjectSchemaNode & { patternProperties: Record<string, ast.SchemaNode> } {\n return node.type === 'object' && node.additionalProperties === false && node.properties.length > 0 && Boolean(node.patternProperties)\n}\n\nfunction hasChecks(node: ast.SchemaNode): boolean {\n return hasInputChecks(node) || hasPatternKeyCheck(node)\n}\n\n// How many `v.check` actions `withInputChecks` puts before the schema of a node.\nfunction countChecks(node: ast.SchemaNode): number {\n const object = ast.schema.narrow(node, 'object')\n\n return (\n Number(object?.min !== undefined) +\n Number(object?.max !== undefined) +\n Number(hasKeyCheck(node)) +\n Number(hasPatternKeyCheck(node)) +\n (node.conditionals?.length ?? 0)\n )\n}\n\n// Wraps a value in `v.nullable(...)` and `v.optional(...)`. A default goes in as the second argument\n// of `v.optional`, so `null` stays `null` and only a missing value takes the default.\nfunction applyModifiers({ value, schema, nullable, optional, nullish, defaultValue, title, description, examples, direction }: ModifierOptions): string {\n const metadata = [\n title && `v.title(${text.quote(title)})`,\n description && `v.description(${text.quote(description)})`,\n // `v.examples()` is typed against the schema, so an example of the wrong type in the spec would not compile.\n examples?.length && `v.metadata({ examples: [${examples.map((example) => (example === null ? 'null' : formatDefault(example))).join(', ')}] })`,\n ].filter(Boolean)\n // Always its own `v.pipe`, so `.pipe[0]` is the schema without the metadata.\n const described = metadata.length ? `v.pipe(${value}, ${metadata.join(', ')})` : value\n const inner = nullable || nullish ? `v.nullable(${described})` : described\n const literal = defaultValue !== undefined && !expectsDate(schema, direction) ? defaultLiteral(schema, defaultValue) : null\n if (literal !== null) return `v.optional(${inner}, ${literal})`\n\n return optional || nullish ? `v.optional(${inner})` : inner\n}\n\n// A `$ref` const prints without the metadata of its target, so `print` and `unwrapChain` agree on the shape.\nfunction hasMetadata(node: ast.SchemaNode): boolean {\n return node.type !== ast.schema.types.ref && Boolean(node.title || node.description || node.examples?.length)\n}\n\n// The `.wrapped` chain that reaches the object behind the `v.optional` and `v.nullable` wrappers\n// `applyModifiers` puts on the const a `$ref` resolves to.\nfunction unwrapChain(node: ast.SchemaNode, direction: PrinterValibotOptions['direction']): string {\n const ref = ast.schema.narrow(node, 'ref')\n if (!ref) return ''\n const target = ref.schema ?? ref\n // `print` reads the modifiers of a const from its merged schema, so an alias of a nullable schema is nullable twice.\n const meta = ast.ref.mergeSchema(target)\n const hasDefault = meta.default !== undefined && !expectsDate(target, direction) && defaultLiteral(target, meta.default) !== null\n const depth = Number(Boolean(meta.nullable || meta.nullish)) + Number(Boolean(meta.optional || meta.nullish || hasDefault))\n // An alias const wraps the const it points to, so the chain goes on through it.\n const inner = target !== ref && target.type === ast.schema.types.ref ? unwrapChain(target, direction) : ''\n\n // `v.omit` and the other object helpers do not take a schema with a pipe.\n return `${'.wrapped'.repeat(depth)}${inner}${hasMetadata(target) ? '.pipe[0]' : ''}`\n}\n\nfunction objectEntries(ctx: PrinterContext, properties: Array<ast.PropertyNode>): Array<string> {\n return properties.map(({ name, schema, required }) => {\n const meta = ast.ref.mergeSchema(schema)\n const value = applyModifiers({\n value: ctx.transform(schema) ?? UNKNOWN,\n schema,\n nullable: meta.nullable,\n optional: schema.optional || required === false,\n nullish: schema.nullish,\n defaultValue: meta.default,\n // A property that replaces a `$ref`, such as a discriminator, does not take the description of the target.\n title: schema.type === ast.schema.types.ref ? undefined : schema.title,\n description: schema.type !== ast.schema.types.ref && meta.type === ast.schema.types.ref ? undefined : meta.description,\n examples: meta.examples,\n direction: ctx.options.direction,\n })\n\n return `${objectKey(name)}: ${value}`\n })\n}\n\n// Makes a `$ref` member of a `oneOf` strict, so a value with the keys of another member does not\n// match it. Only a const that holds a plain object schema has the `.entries` this reads.\nfunction strictMember({ member, node, cyclicSchemas }: { member: string; node: ast.SchemaNode; cyclicSchemas?: ReadonlySet<string> }): string {\n if (node.type !== ast.schema.types.ref) return member\n const refName = ast.ref.getName(node)\n if (refName && cyclicSchemas?.has(refName)) return member\n\n const schema = ast.ref.mergeSchema(node)\n const isWrapped = schema.nullable || schema.optional || schema.nullish || schema.default !== undefined || node.nullable || node.optional\n const isPlainObject =\n schema.type === ast.schema.types.object &&\n (schema.additionalProperties === undefined || schema.additionalProperties === false) &&\n !schema.patternProperties &&\n !schema.propertyNames &&\n !hasChecks(schema)\n\n return isPlainObject && !isWrapped ? `v.strictObject(${member}.entries)` : member\n}\n\nfunction containsCheck(ctx: PrinterContext, { schema, min = 1, max }: NonNullable<ast.ArraySchemaNode['contains']>): string | false {\n if (min === 0 && max === undefined) return false\n const bounds = [`count >= ${min}`, max !== undefined && `count <= ${max}`].filter(Boolean).join(' && ')\n const message = max !== undefined ? `Array must contain ${min} to ${max} matching items` : `Array must contain at least ${min} matching items`\n\n return `v.check((items) => { const count = items.filter((item) => v.is(${ctx.transform(schema) ?? UNKNOWN}, item)).length; return ${bounds} }, ${JSON.stringify(message)})`\n}\n\n// A required `unknown` property means \"the key is present\", which an object schema accepts as missing, so those keys are checked with `in`.\nfunction conditionExpression(ctx: PrinterContext, schema: ast.SchemaNode | undefined): string {\n if (!schema) return 'true'\n const object = ast.schema.narrow(schema, ast.schema.types.object)\n const keyOnlyNames =\n object?.properties.filter((property) => property.required && property.schema.type === ast.schema.types.unknown).map((property) => property.name) ?? []\n const restSchema = object ? { ...object, properties: object.properties.filter((property) => !keyOnlyNames.includes(property.name)) } : schema\n // An object with no properties left still means \"is an object\", so only a key check stands alone.\n const isOnlyKeys =\n keyOnlyNames.length > 0 &&\n restSchema.type === 'object' &&\n restSchema.properties.length === 0 &&\n restSchema.additionalProperties === undefined &&\n !restSchema.patternProperties &&\n !restSchema.propertyNames &&\n !hasChecks(restSchema)\n\n return [\n keyOnlyNames.length > 0 && `typeof value === \"object\" && value !== null && ${JSON.stringify(keyOnlyNames)}.every((key) => key in value)`,\n !isOnlyKeys && `v.is(${ctx.transform(restSchema) ?? UNKNOWN}, value)`,\n ]\n .filter(Boolean)\n .join(' && ')\n}\n\n// The `v.check` actions that run on the raw input, before an object schema drops unknown keys or fills in defaults.\nfunction inputChecks(ctx: PrinterContext, node: ast.SchemaNode): Array<string> {\n const { min, max } = node.type === 'object' ? node : {}\n const keySchema = hasKeyCheck(node) ? ctx.transform(node.propertyNames) : null\n const patternKeys = hasPatternKeyCheck(node)\n ? `${JSON.stringify(node.properties.map((property) => property.name))}.includes(key) || ${Object.keys(node.patternProperties)\n .map((pattern) => `${toRegExpString(pattern, ctx.options.regexType === 'constructor' ? 'RegExp' : null)}.test(key)`)\n .join(' || ')}`\n : null\n\n return [\n min !== undefined && `v.check((value) => ${NOT_OBJECT} || Object.keys(value).length >= ${min}, \"Object must have at least ${min} properties\")`,\n max !== undefined && `v.check((value) => ${NOT_OBJECT} || Object.keys(value).length <= ${max}, \"Object must have at most ${max} properties\")`,\n keySchema &&\n `v.check((value) => ${NOT_OBJECT} || Object.keys(value).every((key) => v.is(${keySchema}, key)), \"Object keys must match the property names schema\")`,\n patternKeys && `v.check((value) => ${NOT_OBJECT} || Object.keys(value).every((key) => ${patternKeys}), \"Object keys must be declared or match a pattern\")`,\n ...(node.conditionals ?? []).map(\n (entry) =>\n `v.check((value) => (${conditionExpression(ctx, entry.if)} ? ${conditionExpression(ctx, entry.then)} : ${conditionExpression(ctx, entry.else)}), \"Value does not meet a conditional schema\")`,\n ),\n ].filter((check): check is string => Boolean(check))\n}\n\ntype Handler<K extends ast.SchemaType> = (this: ThisParameterType<NonNullable<PrinterValibotNodes['any']>>, node: ast.SchemaNodeByType[K]) => string | null\n\n// Wraps each handler so its output first checks the raw input: `v.pipe(v.unknown(), ...checks, schema)`.\nfunction withInputChecks(nodes: PrinterValibotNodes, isSkipped: (node: ast.SchemaNode) => boolean): PrinterValibotNodes {\n const wrapHandler = <K extends ast.SchemaType>(type: K): Array<[K, Handler<K>]> => {\n const handler: Handler<K> | undefined = nodes[type]\n if (!handler) return []\n const checkedHandler: Handler<K> = function (node) {\n const output = handler.call(this, node)\n if (!output || isSkipped(node) || !hasChecks(node)) return output\n\n return pipe(UNKNOWN, [...inputChecks(this, node), output])\n }\n return [[type, checkedHandler]]\n }\n\n return Object.fromEntries(Object.values(ast.schema.types).flatMap(wrapHandler))\n}\n\n/**\n * The handlers that print differently per direction. `date` and `time` decode a wire string into a\n * `Date` on responses and encode it back on requests. Only `representation: 'date'` fields convert.\n * `time` has no date part, so it decodes onto `1970-01-01` and encodes back to `HH:mm:ssZ`, with milliseconds when it has them.\n */\nconst directionalNodes: PrinterValibotNodes = {\n date(node) {\n if (node.representation !== 'date') return 'v.pipe(v.string(), v.isoDate())'\n if (this.options.direction === 'encode') {\n return node.format === 'date'\n ? 'v.pipe(v.date(), v.transform((value) => value.toISOString().slice(0, 10)))'\n : 'v.pipe(v.date(), v.transform((value) => value.toISOString()))'\n }\n if (shouldCoerce(this.options.coercion, 'dates')) return 'v.pipe(v.unknown(), v.toDate())'\n\n return node.format === 'date'\n ? 'v.pipe(v.string(), v.isoDate(), v.transform((value) => new Date(value)))'\n : 'v.pipe(v.string(), v.isoTimestamp(), v.transform((value) => new Date(value)))'\n },\n time(node) {\n // Valibot's time actions reject fractional seconds, which an OpenAPI `time` allows, so a time string stays unchecked.\n if (node.representation === 'string') return 'v.string()'\n // An OpenAPI `time` is an RFC 3339 full-time: it ends in `Z` or an offset, and can carry milliseconds.\n if (this.options.direction === 'encode') return 'v.pipe(v.date(), v.transform((value) => value.toISOString().slice(11).replace(\".000Z\", \"Z\")))'\n\n // A time without an offset is read as UTC. The trailing `v.date()` rejects the Invalid Date a malformed time turns into.\n return 'v.pipe(v.string(), v.transform((value) => new Date(`1970-01-01T${value}${/(?:z|[+-]\\\\d{2}:\\\\d{2})$/i.test(value) ? \"\" : \"Z\"}`)), v.date())'\n },\n}\n\ntype DirectionProbeContext = { options: PrinterValibotOptions; transform: () => null; base: () => null; import: () => void }\n\n// Runs the handler of a node once per direction and reports whether the two outputs differ.\nfunction variesByDirection({ node, printerOptions }: { node: ast.SchemaNode; printerOptions: PrinterValibotOptions }): boolean {\n const handler = printerOptions.nodes?.[node.type] ?? directionalNodes[node.type]\n if (!handler) return false\n\n const call = (direction: 'encode' | 'decode') => {\n const context: DirectionProbeContext = { options: { ...printerOptions, direction }, transform: () => null, base: () => null, import: () => {} }\n return (handler as (this: DirectionProbeContext, node: ast.SchemaNode) => string | null).call(context, node)\n }\n\n return call('decode') !== call('encode')\n}\n\n/**\n * Whether the schema contains a node that prints differently per direction, so it decodes on\n * responses and encodes on requests. Follows a `$ref` through its resolved schema.\n */\nexport function containsDirectionalNode({ node, printerOptions }: { node: ast.SchemaNode | undefined; printerOptions: PrinterValibotOptions }): boolean {\n if (!node) return false\n const { resolver, nodes, coercion, dateType } = printerOptions\n // A `printer.nodes` override has no string key, so it searches without a cache.\n const cache =\n resolver && !nodes\n ? resolver.memo(`valibotDirectionalNodes:${shouldCoerce(coercion, 'dates')}:${dateType}`, () => new WeakMap<ast.SchemaNode, ast.SchemaNode | null>())\n : undefined\n\n return ast.schema.find(node, { predicate: (schema) => variesByDirection({ node: schema, printerOptions }), followRefs: true, cache }) !== undefined\n}\n\n/**\n * Names of the `$ref` schemas a request schema reads from their `${name}InputSchema` variant.\n */\nexport function collectDirectionalRefNames({ node, printerOptions }: { node: ast.SchemaNode; printerOptions: PrinterValibotOptions }): Array<string> {\n return ast.node.collect<string>(node, {\n schema: (n) =>\n n.type === ast.schema.types.ref && n.ref && containsDirectionalNode({ node: n, printerOptions }) ? (ast.ref.getName(n) ?? undefined) : undefined,\n })\n}\n\n/**\n * Valibot v1 printer. Turns a `SchemaNode` into the code of a Valibot schema.\n *\n * @example\n * ```ts\n * const printer = printerValibot({})\n *\n * printer.print(ast.factory.createSchema({ type: 'string', min: 1 })) // 'v.pipe(v.string(), v.minLength(1))'\n * ```\n */\nexport const printerValibot = createPrinter<PrinterValibotFactory>((options) => {\n // Read once: `isObjectSchemaNode` and `strictMember` need the full set for every node.\n const { cyclicSchemas } = options\n // A const whose schema carries a `default` is a `v.optional(...)` wrapper, which has no `.entries`.\n const isObjectNode = (node: ast.SchemaNode) => {\n const resolved = ast.ref.mergeSchema(node)\n return isObjectSchemaNode(node, cyclicSchemas) && resolved.default === undefined && !hasPatternKeyCheck(resolved)\n }\n // The node `print` reads without its input checks, because `v.omit` needs the bare object. Nested nodes keep theirs.\n let uncheckedNode: ast.SchemaNode | null = null\n const unionsWithSiblings = new WeakSet<ast.SchemaNode>()\n // An OpenAPI 3.0 `nullable: true` set on an array item or union member, which only a property or a root applies.\n const printNullable = (schema: ast.SchemaNode, output: string | null) => (output && schema.nullable ? `v.nullable(${output})` : output)\n const formatString = (action: string, node: LengthConstraints) => pipe('v.string()', [action, ...lengthActions(node, options.regexType)])\n\n // Whether an `allOf` prints as one `v.object` with the entries of every member, and not as `v.intersect`.\n const mergesToObject = (node: ast.SchemaNode): boolean => {\n const [first, ...rest] = ast.schema.narrow(node, ast.schema.types.intersection)?.members ?? []\n if (!first || rest.length === 0) return false\n const baseObject = ast.schema.narrow(ast.ref.mergeSchema(first), ast.schema.types.object)\n // A rest schema or a key pattern cannot move into the merged object, so that base stays in `v.intersect`.\n const hasRest =\n Boolean(baseObject?.patternProperties) || (baseObject?.additionalProperties !== undefined && typeof baseObject.additionalProperties !== 'boolean')\n\n return !hasRest && isObjectNode(first) && isObjectComposableIntersection(node, cyclicSchemas)\n }\n // Whether the schema prints with `.entries`, which `v.omit` reads. A `v.union` and a `v.intersect` have none.\n const printsEntries = (node: ast.SchemaNode): boolean => {\n const ref = ast.schema.narrow(node, ast.schema.types.ref)\n if (ref?.schema && ref.schema !== ref) return printsEntries(ref.schema)\n // An unresolved ref has no schema to read, so it counts as an object, as it does for `v.variant`.\n if (ref) return true\n\n return node.type === ast.schema.types.object ? node.properties.length > 0 : mergesToObject(node)\n }\n\n // Prints the schema without `keysToOmit`. `v.omit` takes a bare object schema, so each wrapper is peeled off first.\n function omitKeys(this: PrinterContext, { node, transformed, keysToOmit }: { node: ast.SchemaNode; transformed: string; keysToOmit: Array<string> }): string {\n const target = ast.schema.narrow(node, 'ref')?.schema ?? node\n const keys = `[${keysToOmit.map((key) => text.quote(key)).join(', ')}]`\n\n // A circular const is typed `v.GenericSchema`, which `v.omit` does not take. The generator prints that object inline.\n if (transformed.startsWith('v.lazy(')) return transformed\n const base = `${transformed}${unwrapChain(node, this.options.direction)}`\n if (!hasChecks(target)) return `v.omit(${base}, ${keys})`\n // `withInputChecks` printed `v.pipe(v.unknown(), ...checks, object)`. `v.omit` takes the object only, so the checks go back around it.\n if (node.type === ast.schema.types.ref) {\n const count = countChecks(target)\n const checks = Array.from({ length: count }, (_, index) => `${base}.pipe[${index + 1}]`)\n\n return pipe(UNKNOWN, [...checks, `v.omit(${base}.pipe[${count + 1}], ${keys})`])\n }\n\n uncheckedNode = node\n try {\n return pipe(UNKNOWN, [...inputChecks(this, node), `v.omit(${this.transform(node)}, ${keys})`])\n } finally {\n uncheckedNode = null\n }\n }\n\n const nodes: PrinterValibotNodes = {\n any: () => 'v.any()',\n unknown: () => UNKNOWN,\n void: () => 'v.void()',\n never: () => 'v.never()',\n boolean: () => 'v.boolean()',\n null: () => 'v.null()',\n blob: () => 'v.blob()',\n ipv4: () => 'v.pipe(v.string(), v.ipv4())',\n ipv6: () => 'v.pipe(v.string(), v.ipv6())',\n string(node) {\n const coerce = shouldCoerce(this.options.coercion, 'strings')\n const format = stringFormatActions.get(node.format) ?? (node.content?.encoding?.toLowerCase() === 'base64' ? 'v.base64()' : undefined)\n const pattern = node.pattern ?? integerFormatPattern(node.format)\n const actions = [coerce && 'v.toString()', format, ...lengthActions({ ...node, pattern }, this.options.regexType)]\n\n const contentNode = ast.schema.getEmbeddedJson(node)\n if (!contentNode) return pipe(coerce ? UNKNOWN : 'v.string()', actions)\n // The string holds wire JSON whichever way the string itself travels, so its schema always decodes.\n const { direction } = this.options\n this.options.direction = 'decode'\n let content: string | null\n try {\n content = this.transform(contentNode)\n } finally {\n this.options.direction = direction\n }\n\n return pipe(coerce ? UNKNOWN : 'v.string()', [\n ...actions,\n content &&\n `v.check((value) => { try { return v.is(${content}, JSON.parse(value)) } catch { return false } }, \"String must hold JSON that matches its content schema\")`,\n ])\n },\n uuid: (node) => formatString('v.uuid()', node),\n email: (node) => formatString('v.email()', node),\n url: (node) => formatString('v.url()', node),\n number(node) {\n const coerce = shouldCoerce(this.options.coercion, 'numbers')\n\n return pipe(coerce ? UNKNOWN : 'v.number()', [coerce && 'v.toNumber()', ...numberActions(node)])\n },\n integer(node) {\n const coerce = shouldCoerce(this.options.coercion, 'numbers')\n\n return pipe(coerce ? UNKNOWN : 'v.number()', [coerce && 'v.toNumber()', 'v.integer()', ...numberActions(withFormatRange(node, 'integer'))])\n },\n bigint(node) {\n // JSON carries a 64-bit integer as a number or a string, so both convert.\n return pipe('v.union([v.bigint(), v.number(), v.string()])', [\n 'v.toBigint()',\n ...numberActions(withFormatRange({ ...bigintConstraints(node), format: node.format }, 'bigint'), true),\n ])\n },\n ...directionalNodes,\n datetime(node) {\n // `v.isoTimestamp()` needs a `Z` or an offset, so a local date-time stays an unchecked string.\n const isLocal = node.local || this.options.dateType === 'stringLocal'\n\n return isLocal ? 'v.string()' : 'v.pipe(v.string(), v.isoTimestamp())'\n },\n enum(node) {\n return buildEnum(ast.schema.getLiterals(node).filter((value) => value !== null))\n },\n ref(node) {\n if (!node.name) return null\n const refName = ast.ref.getName(node)\n if (!refName) return null\n // A request schema reads a component with a direction-dependent field from its `${name}InputSchema` variant.\n const useInputVariant = node.ref != null && this.options.direction === 'encode' && containsDirectionalNode({ node, printerOptions: this.options })\n const resolver = this.options.resolver\n const resolvedName = node.ref ? ((useInputVariant ? resolver?.schema.inputName(refName) : resolver?.name(refName)) ?? refName) : node.name\n\n return node.ref && cyclicSchemas?.has(refName) ? `v.lazy(() => ${resolvedName})` : resolvedName\n },\n object(node) {\n const hasProperties = node.properties.length > 0\n const patterns = node.patternProperties ? Object.entries(node.patternProperties) : []\n const shape = buildObject(objectEntries(this, node.properties))\n const keySchema = node.propertyNames ? this.transform(node.propertyNames) : null\n // `additionalProperties: false` still permits patternProperties keys, so only a pattern-free object is strict.\n const isStrict = node.additionalProperties === false && patterns.length === 0\n\n if (node.additionalProperties && node.additionalProperties !== true) {\n const rest = this.transform(node.additionalProperties)\n if (rest) return hasProperties ? `v.objectWithRest(${shape}, ${rest})` : `v.record(${keySchema ?? 'v.string()'}, ${rest})`\n }\n if (isStrict) return `v.strictObject(${shape})`\n if (!hasProperties && patterns.length === 0 && keySchema) return `v.record(${keySchema}, ${UNKNOWN})`\n if (node.additionalProperties === true) return `v.looseObject(${shape})`\n\n if (patterns.length > 0) {\n const values = [...new Set(patterns.map(([, schema]) => printNullable(schema, this.transform(schema) ?? UNKNOWN)!))]\n const value = values.length === 1 ? values[0]! : `v.union(${buildList(values)})`\n // With fixed properties a record would reject the declared keys, so the rest schema checks the value only.\n if (hasProperties) return `v.objectWithRest(${shape}, ${value})`\n const keyPattern = patterns.length === 1 ? patterns[0]![0] : patterns.map(([pattern]) => `(${pattern})`).join('|')\n\n return `v.record(${pipe('v.string()', lengthActions({ pattern: keyPattern }, this.options.regexType))}, ${value})`\n }\n\n return `v.object(${shape})`\n },\n array(node) {\n const items = (node.items ?? []).map((item) => printNullable(item, this.transform(item))).filter((item): item is string => Boolean(item))\n const inner = items.length > 1 ? `v.union(${buildList(items)})` : (items[0] ?? UNKNOWN)\n\n return pipe(`v.array(${inner})`, [\n ...lengthActions({ min: node.min, max: node.max }, this.options.regexType),\n node.unique && 'v.check((items) => new Set(items).size === items.length, \"Array entries must be unique\")',\n node.contains && containsCheck(this, node.contains),\n ])\n },\n tuple(node) {\n const items = buildList((node.items ?? []).map((item) => printNullable(item, this.transform(item))).filter((item): item is string => Boolean(item)))\n // OpenAPI 3.1 `items` next to `prefixItems` types the elements after the positional ones.\n const rest = node.rest ? this.transform(node.rest) : null\n\n return pipe(rest ? `v.tupleWithRest(${items}, ${rest})` : `v.tuple(${items})`, [node.contains && containsCheck(this, node.contains)])\n },\n union(node) {\n const nodeMembers = node.members ?? []\n const { discriminatorPropertyName } = node\n // `v.variant` takes object schemas only. Intersections, wrapped objects, and `v.lazy` refs fall back to `v.union`.\n const isDiscriminated = !!discriminatorPropertyName && nodeMembers.every(isObjectNode)\n // `v.union` returns the first member that matches, and an object member drops the keys it does not\n // know. A strict member rejects those keys instead, so a `oneOf` value reaches the member it belongs to.\n const isXor = node.strategy === 'one' && !isDiscriminated && this.options.oneOfType === 'xor'\n const isStrict = node.strategy === 'one' && !isXor && !isDiscriminated && !unionsWithSiblings.has(node)\n const members = nodeMembers\n .map((member) => {\n const output = this.transform(isStrict ? strictOneOfNode(member) : member)\n return printNullable(member, output && isStrict ? strictMember({ member: output, node: member, cyclicSchemas }) : output)\n })\n .filter((member): member is string => Boolean(member))\n\n if (members.length === 0) return ''\n if (members.length === 1) return members[0]!\n\n if (isDiscriminated) return `v.variant(${text.quote(discriminatorPropertyName)}, ${buildList(members)})`\n const union = `v.union(${buildList(members)})`\n // Valibot has no xor schema, so a check on the raw input counts the members that match.\n return isXor\n ? `((schema) => v.pipe(v.unknown(), v.check((value) => schema.options.filter((member) => v.is(member, value)).length === 1, \"Value must match exactly one schema\"), schema))(${union})`\n : union\n },\n intersection(node) {\n const members = node.members ?? []\n const [first, ...rest] = members\n if (!first) return ''\n // A union next to sibling properties shares its value with them, so its members cannot be strict.\n const hasSiblingProperties = members.some((member) => member.type === ast.schema.types.object && member.properties.length > 0)\n const transform = (member: ast.SchemaNode) => {\n if (!hasSiblingProperties) return this.transform(member)\n unionsWithSiblings.add(member)\n try {\n return this.transform(member)\n } finally {\n unionsWithSiblings.delete(member)\n }\n }\n\n const firstBase = transform(first)\n if (!firstBase) return ''\n\n // An object `allOf` is a merge: one `v.object` with the entries of every member stays usable in `v.variant` and `v.omit`.\n const base = ast.ref.mergeSchema(first)\n const baseObject = ast.schema.narrow(base, ast.schema.types.object)\n if (mergesToObject(node)) {\n // A discriminated `oneOf` base already pins its discriminator to a literal, which a sibling `type: string` would widen.\n const discriminator = ast.schema.narrow(first, ast.schema.types.union)?.discriminatorPropertyName\n // Keyed by name: a property two members declare is one key of the object literal, and the last member wins.\n const properties = new Map(\n preserveRequiredProperties(members)\n .slice(1)\n .flatMap((member) => ast.schema.narrow(member, ast.schema.types.object)?.properties ?? [])\n .filter((property) => property.name !== discriminator)\n .map((property) => [property.name, property] as const),\n )\n\n const additional = baseObject?.additionalProperties\n const ctor = additional === true ? 'v.looseObject' : additional === false ? 'v.strictObject' : 'v.object'\n\n return `${ctor}(${buildObject([`...${firstBase}.entries`, ...objectEntries(this, [...properties.values()])])})`\n }\n\n const schemas = [firstBase]\n const actions: Array<string> = []\n for (const member of rest) {\n const constraints = memberActions({ member, base, regexType: this.options.regexType })\n const transformed = constraints.length ? null : transform(member)\n actions.push(...constraints)\n if (transformed) schemas.push(transformed)\n }\n\n return pipe(schemas.length > 1 ? `v.intersect(${buildList(schemas)})` : firstBase, actions)\n },\n }\n\n return {\n name: 'valibot',\n options,\n nodes: withInputChecks(nodes, (node) => node === uncheckedNode),\n overrides: options.nodes,\n print(node) {\n const transformed = this.transform(node)\n if (!transformed) return null\n\n const { keysToOmit, direction } = this.options\n const meta = ast.ref.mergeSchema(node)\n const canOmit = keysToOmit?.length && printsEntries(node)\n const value = canOmit ? omitKeys.call(this, { node, transformed, keysToOmit }) : transformed\n\n return applyModifiers({\n value,\n schema: node,\n nullable: meta.nullable,\n optional: meta.optional,\n nullish: meta.nullish,\n defaultValue: meta.default,\n title: hasMetadata(node) ? meta.title : undefined,\n description: hasMetadata(node) ? meta.description : undefined,\n examples: hasMetadata(node) ? meta.examples : undefined,\n direction,\n })\n },\n }\n})\n","import {\n buildContentTypeEntries,\n buildOptionsSchema,\n buildParamRefsSchema,\n buildParamsSchema,\n buildResponseUnionSchema,\n buildResponses,\n getCircularNames,\n getOasAdapter,\n resolveOperationFile,\n schemaComments,\n toResponseContent,\n} from '@internals/shared'\nimport { ast, defineGenerator } from '@kubb/kit'\nimport { File, jsxRenderer } from '@kubb/renderer-jsx'\nimport { Valibot } from '../components/Valibot.tsx'\nimport { collectDirectionalRefNames, containsDirectionalNode, printerValibot } from '../printers/printerValibot.ts'\nimport type { PrinterValibotOptions } from '../printers/printerValibot.ts'\nimport type { PluginValibot, ResolverValibot } from '../types.ts'\n\ntype Direction = NonNullable<PrinterValibotOptions['direction']>\n\n/**\n * The printer for one direction, built once per plugin per build. A `keysToOmit` list and a\n * `printer.nodes` override differ per node and have no string key, so they get a fresh printer.\n */\nfunction getPrinter(resolver: ResolverValibot, options: PrinterValibotOptions, direction: Direction) {\n const build = () => printerValibot({ ...options, direction })\n if (options.nodes || options.keysToOmit?.length) return build()\n\n return resolver.memo(\n `valibotPrinter:${[direction, JSON.stringify(options.coercion), options.regexType, options.oneOfType, options.dateType].join(':')}`,\n build,\n )\n}\n\n// A request schema is typed by the value the caller passes, every other schema by the value it returns.\nconst inferKinds = { encode: 'InferInput', decode: 'InferOutput' } as const\n\n/**\n * Built-in generator for `@kubb/plugin-valibot`. Emits one Valibot schema per schema in the spec,\n * plus the parameter, request, and response schemas of each operation.\n */\nexport const valibotGenerator = defineGenerator<PluginValibot>({\n name: 'valibot',\n renderer: jsxRenderer,\n schema(node, ctx) {\n const { adapter, config, resolver, root } = ctx\n const { output, regexType, oneOfType, coercion, inferred, typeGuards, importPath, group, printer } = ctx.options\n\n if (!node.name) {\n return\n }\n\n const cyclicSchemas = getCircularNames(ctx)\n const dateType = getOasAdapter(adapter).options.dateType\n const printerOptions: PrinterValibotOptions = { regexType, oneOfType, coercion, dateType, resolver, cyclicSchemas, nodes: printer?.nodes }\n // Rendered twice: the schema decodes, and its `${name}InputSchema` variant encodes.\n const hasDirectionalNode = containsDirectionalNode({ node, printerOptions })\n const inputImports = hasDirectionalNode\n ? collectDirectionalRefNames({ node, printerOptions }).map((schemaName) => ({\n name: [resolver.schema.inputName(schemaName)],\n path: resolver.file({ name: schemaName, extname: '.ts', root, output, group: group ?? undefined }).path,\n }))\n : []\n const imports = [\n ...new Map(\n [...resolver.imports({ node, root, output, group: group ?? undefined, checks: true }), ...inputImports].map(\n (imp) => [`${Array.isArray(imp.name) ? imp.name.join(',') : imp.name}|${imp.path}`, imp] as const,\n ),\n ).values(),\n ]\n const inputName = resolver.schema.inputName(node.name)\n const meta = {\n name: resolver.name(node.name),\n file: resolver.file({ name: node.name, extname: '.ts', root, output, group: group ?? undefined }),\n } as const\n\n return (\n <File\n baseName={meta.file.baseName}\n path={meta.file.path}\n meta={meta.file.meta}\n banner={resolver.default.banner(ctx.meta, { output, config, file: { path: meta.file.path, baseName: meta.file.baseName } })}\n footer={resolver.default.footer(ctx.meta, { output, config, file: { path: meta.file.path, baseName: meta.file.baseName } })}\n >\n <File.Import name=\"v\" path={importPath} isNameSpace />\n {imports.map((imp) => (\n <File.Import key={[node.name, imp.path, imp.name].join('-')} root={meta.file.path} path={imp.path} name={imp.name} />\n ))}\n\n <Valibot\n name={meta.name}\n node={node}\n printer={getPrinter(resolver, printerOptions, 'decode')}\n inferTypeName={inferred ? resolver.schema.typeName(node.name) : null}\n typeGuards={typeGuards}\n isName={resolver.schema.isName(node.name)}\n assertName={resolver.schema.assertName(node.name)}\n cyclic={cyclicSchemas.has(node.name)}\n comments={schemaComments(node)}\n />\n {hasDirectionalNode && (\n <Valibot\n name={inputName}\n node={node}\n printer={getPrinter(resolver, printerOptions, 'encode')}\n inferTypeName={inferred ? resolver.schema.inputTypeName(node.name) : null}\n inferKind=\"InferInput\"\n typeGuards={typeGuards}\n isName={resolver.schema.isName(inputName)}\n assertName={resolver.schema.assertName(inputName)}\n cyclic={cyclicSchemas.has(node.name)}\n comments={schemaComments(node)}\n />\n )}\n </File>\n )\n },\n operation(node, ctx) {\n if (!ast.http.isOperation(node)) return null\n const { adapter, config, resolver, root } = ctx\n const { output, regexType, oneOfType, coercion, inferred, importPath, group, printer } = ctx.options\n const dateType = getOasAdapter(adapter).options.dateType\n\n const meta = {\n file: resolveOperationFile({ ctx, node, resolver, root, output, group }),\n } as const\n\n const cyclicSchemas = getCircularNames(ctx)\n const printerOptions: PrinterValibotOptions = { regexType, oneOfType, coercion, dateType, resolver, cyclicSchemas, nodes: printer?.nodes }\n\n function renderSchemaEntry({\n schema,\n name,\n keysToOmit,\n direction = 'decode',\n }: {\n schema: ast.SchemaNode | null\n name: string\n keysToOmit?: Array<string> | null\n direction?: Direction\n }) {\n if (!schema) return null\n // A circular const is typed `v.GenericSchema`, which `v.omit` does not take, so its object prints here without the keys.\n const refName = schema.type === 'ref' ? ast.ref.getName(schema) : null\n const target = schema.type === 'ref' ? schema.schema : undefined\n if (keysToOmit?.length && target && refName && cyclicSchemas.has(refName)) {\n const declaresKey = (node: ast.SchemaNode) => keysToOmit.some((propertyName) => ast.schema.findProperties({ node, propertyName }).length > 0)\n // Drops the keys from an object, from every `allOf` member, and from a `$ref` member that declares one, which prints inline.\n const withoutKeys = (node: ast.SchemaNode, seen = new Set<ast.SchemaNode>()): ast.SchemaNode => {\n if (node.type === 'object') return { ...node, properties: node.properties.filter((property) => !keysToOmit.includes(property.name)) }\n if (node.type === 'intersection') return { ...node, members: (node.members ?? []).map((member) => withoutKeys(member, seen)) }\n if (node.type !== 'ref' || !node.schema || seen.has(node.schema) || !declaresKey(node.schema)) return node\n\n // A copy per branch: the set stops a cycle, and a schema that two members reference prints inline in both.\n return withoutKeys(node.schema, new Set(seen).add(node.schema))\n }\n const inline = withoutKeys(target)\n if (inline.type === 'object' || inline.type === 'intersection') return renderSchemaEntry({ schema: inline, name, direction })\n }\n\n const inputRefNames = direction === 'encode' ? new Set(collectDirectionalRefNames({ node: schema, printerOptions })) : null\n const imports = resolver.imports({\n node: schema,\n root,\n output,\n group: group ?? undefined,\n checks: true,\n name: (schemaName) => (inputRefNames?.has(schemaName) ? resolver.schema.inputName(schemaName) : resolver.name(schemaName)),\n })\n\n return (\n <>\n {imports.map((imp) => (\n <File.Import key={[name, imp.path, imp.name].join('-')} root={meta.file.path} path={imp.path} name={imp.name} />\n ))}\n {/* A circular component schema carries the `v.GenericSchema` annotation at its own definition.\n Annotating the operation schema too would erase its inferred type to `unknown`. */}\n <Valibot\n name={name}\n node={schema}\n printer={getPrinter(resolver, { ...printerOptions, keysToOmit }, direction)}\n inferTypeName={inferred ? resolver.schema.type(name) : null}\n inferKind={inferKinds[direction]}\n comments={schemaComments(schema)}\n />\n </>\n )\n }\n\n // Several content types for one name: one schema per content type, then the union of them.\n const renderContentTypeVariants = (entries: Parameters<typeof buildContentTypeEntries>[0], baseName: string, direction?: Direction) => (\n <>{buildContentTypeEntries(entries, baseName).map((entry) => renderSchemaEntry({ ...entry, direction }))}</>\n )\n const renderResponseUnion = (responses: Array<ast.ResponseNode>, name: string, fallbackUnknown: boolean) =>\n renderSchemaEntry({ schema: buildResponseUnionSchema({ node, responses, name, resolver, fallbackUnknown }), name })\n\n const paramSchemas = node.parameters.map((param) =>\n renderSchemaEntry({ schema: param.schema, name: resolver.param.name(node, param), direction: 'encode' }),\n )\n\n const responseSchemas = node.responses.map((res) => {\n const content = (res.content ?? []).map((entry, _, content) => toResponseContent(entry, content))\n const variants = content.filter((entry) => entry.schema)\n if (variants.length > 1) {\n return renderContentTypeVariants(content, resolver.response.status(node, res.statusCode))\n }\n const primary = variants[0] ?? content[0]\n return renderSchemaEntry({\n schema: primary?.schema ?? null,\n name: resolver.response.status(node, res.statusCode),\n keysToOmit: primary?.keysToOmit,\n })\n })\n\n const responseHeaderSchemas = node.responses.map((res) =>\n res.headers?.length ? renderSchemaEntry({ schema: buildParamsSchema(res.headers), name: resolver.response.headers(node, res.statusCode) }) : null,\n )\n\n const responsesWithSchema = node.responses.filter((res) => res.content?.some((entry) => entry.schema))\n // The response schema covers success (2xx) bodies only.\n const successResponsesWithSchema = responsesWithSchema.filter((res) => ast.http.status.isSuccess(res))\n const responseUnionSchema = responsesWithSchema.length > 0 ? renderResponseUnion(successResponsesWithSchema, resolver.response.response(node), true) : null\n\n // The error schema covers every non-2xx response, including the OpenAPI `default`.\n const errorResponsesWithSchema = responsesWithSchema.filter((res) => !ast.http.status.isSuccess(res))\n const errorUnionSchema = errorResponsesWithSchema.length > 0 ? renderResponseUnion(errorResponsesWithSchema, resolver.response.error(node), false) : null\n\n const requestBodyContent = node.requestBody?.content ?? []\n const requestSchema = (() => {\n if (requestBodyContent.length === 0) return null\n if (requestBodyContent.length === 1) {\n const entry = requestBodyContent[0]!\n if (!entry.schema) return null\n return renderSchemaEntry({\n schema: entry.schema,\n name: resolver.response.body(node),\n keysToOmit: entry.keysToOmit,\n direction: 'encode',\n })\n }\n return renderContentTypeVariants(requestBodyContent, resolver.response.body(node), 'encode')\n })()\n\n // Grouped path, query, headers, and cookies schemas, one object per group.\n const { path, query, header, cookie } = ast.http.groupParameters(node)\n\n const paramGroupSchemas = (\n [\n { kind: 'path', params: path },\n { kind: 'query', params: query },\n { kind: 'headers', params: header },\n { kind: 'cookies', params: cookie },\n ] as const\n )\n .filter(({ params }) => params.length > 0)\n .map(({ kind, params }) =>\n renderSchemaEntry({\n schema: buildParamRefsSchema({ node, params, resolver }),\n name: resolver.param[kind](node, params[0]!),\n direction: 'encode',\n }),\n )\n\n // The combined options object and the per-status record back `resolver.response.options(node)` and\n // `resolver.response.responses(node)`, for callers that take their types from this plugin.\n const optionsSchema = inferred\n ? renderSchemaEntry({ schema: buildOptionsSchema(node, resolver), name: resolver.name(`${node.operationId} Options`), direction: 'encode' })\n : null\n const responsesSchema = inferred ? renderSchemaEntry({ schema: buildResponses(node, resolver), name: resolver.response.responses(node) }) : null\n\n return (\n <File\n baseName={meta.file.baseName}\n path={meta.file.path}\n meta={meta.file.meta}\n banner={resolver.default.banner(ctx.meta, { output, config, file: { path: meta.file.path, baseName: meta.file.baseName } })}\n footer={resolver.default.footer(ctx.meta, { output, config, file: { path: meta.file.path, baseName: meta.file.baseName } })}\n >\n <File.Import name=\"v\" path={importPath} isNameSpace />\n {paramSchemas}\n {responseSchemas}\n {responseHeaderSchemas}\n {responseUnionSchema}\n {errorUnionSchema}\n {requestSchema}\n {paramGroupSchemas}\n {optionsSchema}\n {responsesSchema}\n </File>\n )\n },\n})\n","","","import { createCasedFile, createOperationParamResolver, createOperationResponseResolver, operationKey } from '@internals/shared'\nimport { ensureValidVarName } from '@internals/utils'\nimport { casing, createResolver } from '@kubb/kit'\nimport type { PluginValibot } from '../types.ts'\n\n/**\n * Default resolver for `@kubb/plugin-valibot`. Schema and file names are camelCase with a `Schema`\n * suffix, and inferred types are PascalCase.\n *\n * @example\n * ```ts\n * resolverValibot.name('list pets') // 'listPetsSchema'\n * resolverValibot.schema.typeName('pet') // 'PetSchemaType'\n * ```\n */\nexport const resolverValibot = createResolver<PluginValibot>({\n pluginName: 'plugin-valibot',\n name(name) {\n return this.memo(`name:${name}`, () => ensureValidVarName(casing.camel(name, { suffix: 'schema' })))\n },\n file: createCasedFile((part) => casing.camel(part, { suffix: 'schema' })),\n schema: {\n typeName(name) {\n return this.memo(`typeName:${name}`, () => ensureValidVarName(casing.pascal(name, { suffix: 'schema type' })))\n },\n type(name) {\n return this.memo(`type:${name}`, () => ensureValidVarName(casing.pascal(name, { suffix: 'type' })))\n },\n inputName(name) {\n return this.name(`${name} input`)\n },\n inputTypeName(name) {\n return this.schema.typeName(`${name} input`)\n },\n isName(name) {\n return ensureValidVarName(casing.camel(name, { prefix: 'is' }))\n },\n assertName(name) {\n return ensureValidVarName(casing.camel(name, { prefix: 'assert' }))\n },\n },\n param: createOperationParamResolver(),\n response: {\n ...createOperationResponseResolver(),\n error(node) {\n const name = this.name(`${node.operationId} Error`)\n return this.resolveName({ key: operationKey(node, 'response', 'error'), name })\n },\n options(node) {\n const name = this.schema.type(this.name(`${node.operationId} Options`))\n return this.resolveName({ key: operationKey(node, 'response', 'options'), name })\n },\n },\n})\n","import { addGenerator, defineExtension, Resolver, setMacros, setResolver } from '@kubb/kit'\nimport { compatibility } from '../kubb-extension.json'\nimport { version } from '../package.json'\nimport { valibotGenerator } from './generators/valibotGenerator.tsx'\nimport { resolverValibot } from './resolvers/resolverValibot.ts'\nimport type { PluginValibot } from './types.ts'\n\n/**\n * Canonical plugin name for `@kubb/plugin-valibot`. Used for driver lookups and cross-plugin\n * dependency references.\n */\nexport const pluginValibotName = 'plugin-valibot' satisfies PluginValibot['name']\n\n/**\n * Generates Valibot v1 schemas from an OpenAPI spec. Use them to validate API responses at\n * runtime, build form schemas, or pass them to any library that takes a Standard Schema.\n *\n * @example\n * ```ts\n * import { defineConfig } from 'kubb/config'\n * import { pluginValibot } from '@kubb/plugin-valibot'\n *\n * export default defineConfig({\n * input: './petStore.yaml',\n * output: { path: './src/gen' },\n * plugins: [\n * pluginValibot({\n * output: { path: './valibot' },\n * inferred: true,\n * }),\n * ],\n * })\n * ```\n */\nexport const pluginValibot = defineExtension<PluginValibot>({\n kind: 'plugin',\n meta: { name: pluginValibotName, version, compatibility },\n setup(options) {\n const {\n output = { path: 'valibot', barrel: { type: 'named' } },\n group,\n exclude = [],\n include,\n override = [],\n importPath = 'valibot',\n inferred = false,\n regexType = 'literal',\n oneOfType = 'union',\n coercion = false,\n typeGuards = false,\n printer,\n resolver: userResolver,\n macros: userMacros,\n } = options\n\n setResolver(userResolver ? Resolver.merge(resolverValibot, userResolver) : resolverValibot)\n if (userMacros?.length) {\n setMacros(userMacros)\n }\n addGenerator(valibotGenerator)\n\n return {\n output,\n exclude,\n include,\n override,\n group: group ?? null,\n importPath,\n inferred,\n regexType,\n oneOfType,\n coercion,\n typeGuards,\n printer,\n }\n },\n})\n\nexport default pluginValibot\n"],"mappings":";;;;;;;;;;;;AAIA,MAAM,gCAAgB,IAAI,IAAI;CAC5B;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACF,CAAU;;;;;;;;;;;AAYV,SAAgB,eAAe,MAAuB;CACpD,IAAI,CAAC,QAAQ,cAAc,IAAI,IAAiB,GAC9C,OAAO;CAET,OAAO,aAAa,IAAI;AAC1B;;;;;;;;;;;;;;;;;AAkBA,SAAgB,mBAAmB,MAAsB;CACvD,IAAI,CAAC,QAAQ,eAAe,IAAI,GAC9B,OAAO;CAET,OAAO,IAAI;AACb;;;;;;;;;;;;;;AAeA,SAAgB,aAAa,MAAuB;CAClD,OAAO,6BAA6B,KAAK,IAAI;AAC/C;;;;;;;;;;;;;AC7FA,SAAgB,YAAY,SAAgC;CAC1D,IAAI,QAAQ,WAAW,GAAG,OAAO;CAGjC,OAAO,MAFM,QAAQ,KAAK,UAAU,GAAGA,UAAAA,KAAK,OAAO,EAAE,MAAM,MAAM,CAAC,EAAE,EAAE,CAAC,CAAC,KAAK,IAE7D,EAAE;AACpB;;;;;;;;;;;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