@kubb/ast 5.0.0-beta.29 → 5.0.0-beta.30

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/dist/index.d.ts CHANGED
@@ -190,6 +190,105 @@ declare const mediaTypes: {
190
190
  readonly videoMp4: "video/mp4";
191
191
  };
192
192
  //#endregion
193
+ //#region src/dialect.d.ts
194
+ /**
195
+ * The spec-specific decisions a schema parser makes while converting a source
196
+ * document's schemas into Kubb AST nodes.
197
+ *
198
+ * Everything else in an adapter's schema pipeline is generic JSON Schema shared
199
+ * across specs; the dialect is the one seam where a spec differs — the
200
+ * "dialect layer" analogue of a database driver targeting Postgres vs MySQL.
201
+ * Pair it with {@link dispatch}: the rule table decides *which* converter runs,
202
+ * the dialect answers the spec-specific questions inside them.
203
+ *
204
+ * The guard methods (`isReference`, `isDiscriminator`) are type predicates so
205
+ * converters narrow the schema after a check; the type parameters carry those
206
+ * narrowed types through.
207
+ *
208
+ * Scope: this is the seam for the **JSON Schema family** — OpenAPI, AsyncAPI, and
209
+ * plain JSON Schema all share `$ref`, `allOf`/`oneOf`, `enum`, and `format`, and
210
+ * differ only in these few decisions. A spec built on a different type system
211
+ * (e.g. GraphQL, with non-null wrappers, interfaces, and named-type references
212
+ * instead of `$ref`) does not implement a `SchemaDialect`; it reuses the universal
213
+ * layer directly — the `Adapter` port, the AST factories, and {@link dispatch}
214
+ * with its own rule table — to emit the same nodes.
215
+ *
216
+ * @typeParam TSchema - The adapter's schema object type (e.g. an OpenAPI `SchemaObject`).
217
+ * @typeParam TRef - The narrowed `$ref` pointer type `isReference` proves.
218
+ * @typeParam TDiscriminated - The narrowed discriminated-schema type `isDiscriminator` proves.
219
+ * @typeParam TDocument - The source document `resolveRef` resolves against.
220
+ */
221
+ type SchemaDialect<TSchema = unknown, TRef = TSchema, TDiscriminated = TSchema, TDocument = unknown> = {
222
+ /** Identifies the dialect in logs and while debugging dispatch. */name: string; /** Whether a schema should be treated as nullable. */
223
+ isNullable: (schema?: TSchema) => boolean; /** Whether a value is a `$ref` pointer object. */
224
+ isReference: (value?: unknown) => value is TRef; /** Whether a schema carries a structured discriminator (polymorphism). */
225
+ isDiscriminator: (value?: unknown) => value is TDiscriminated; /** Whether a schema represents binary data (converted to a `blob` node). */
226
+ isBinary: (schema: TSchema) => boolean; /** Resolves a local `$ref` pointer against the document, or nullish when it cannot. */
227
+ resolveRef: <TResolved>(document: TDocument, ref: string) => TResolved | null | undefined;
228
+ };
229
+ /**
230
+ * Identity helper that types a {@link SchemaDialect} for an adapter. Like
231
+ * `defineParser`, it adds no runtime behavior — it pins the dialect's type for
232
+ * inference and gives adapter authors a discoverable anchor.
233
+ *
234
+ * @example
235
+ * ```ts
236
+ * export const oasDialect = defineSchemaDialect({
237
+ * name: 'oas',
238
+ * isNullable,
239
+ * isReference,
240
+ * isDiscriminator,
241
+ * isBinary: (schema) => schema.type === 'string' && schema.contentMediaType === 'application/octet-stream',
242
+ * resolveRef,
243
+ * })
244
+ * ```
245
+ */
246
+ declare function defineSchemaDialect<TSchema, TRef, TDiscriminated, TDocument>(dialect: SchemaDialect<TSchema, TRef, TDiscriminated, TDocument>): SchemaDialect<TSchema, TRef, TDiscriminated, TDocument>;
247
+ //#endregion
248
+ //#region src/dispatch.d.ts
249
+ /**
250
+ * One entry in an ordered dispatch table: a predicate paired with a converter.
251
+ *
252
+ * @typeParam TContext - Per-input context handed to every rule. A spec adapter typically
253
+ * pre-computes this once per node (the source spec node plus derived fields like a
254
+ * normalized type or resolved options) so individual rules stay cheap predicates.
255
+ * @typeParam TNode - The node a rule produces, e.g. a Kubb AST `SchemaNode`.
256
+ */
257
+ type DispatchRule<TContext, TNode> = {
258
+ /** Identifies the rule when reading the table or debugging which branch ran. */name: string; /** Returns `true` when this rule is responsible for the given context. */
259
+ match: (context: TContext) => boolean;
260
+ /**
261
+ * Produces a node for the context, or `null` to fall through to the next rule.
262
+ *
263
+ * Returning `null` lets a broad `match` defer: e.g. "has a `format`" matches many schemas,
264
+ * but only some formats are convertible — the rest fall through to plain `type` handling.
265
+ */
266
+ convert: (context: TContext) => TNode | null;
267
+ };
268
+ /**
269
+ * Walks an ordered list of {@link DispatchRule}s and returns the first node produced.
270
+ *
271
+ * This is the shared backbone for spec adapters (OpenAPI today, AsyncAPI and others later).
272
+ * The contract an adapter follows is intentionally minimal:
273
+ *
274
+ * context → [rule.match → rule.convert] → node
275
+ *
276
+ * An adapter derives a context from a source spec node, then declares an ordered table of
277
+ * rules mapping spec shapes onto Kubb AST nodes. To add support for a new spec, write a new
278
+ * context type and a new rules table — the traversal here is reused unchanged.
279
+ *
280
+ * Order is significant: earlier rules win, so list higher-precedence or more specific shapes
281
+ * first (e.g. composition keywords before plain `type`). A rule whose `match` returns `true`
282
+ * may still `convert` to `null` to defer to later rules. When no rule produces a node this
283
+ * returns `null`, leaving the caller to apply its own fallback.
284
+ *
285
+ * @example
286
+ * ```ts
287
+ * const node = dispatch(schemaRules, schemaContext) ?? createSchema({ type: fallbackType })
288
+ * ```
289
+ */
290
+ declare function dispatch<TContext, TNode>(rules: ReadonlyArray<DispatchRule<TContext, TNode>>, context: TContext): TNode | null;
291
+ //#endregion
193
292
  //#region src/nodes/base.d.ts
194
293
  /**
195
294
  * `kind` values used by AST nodes.
@@ -199,7 +298,7 @@ declare const mediaTypes: {
199
298
  * const kind: NodeKind = 'Schema'
200
299
  * ```
201
300
  */
202
- type NodeKind = 'Input' | 'Output' | 'Operation' | 'Schema' | 'Property' | 'Parameter' | 'Response' | 'FunctionParameter' | 'ParameterGroup' | 'FunctionParameters' | 'Type' | 'ParamsType' | 'File' | 'Import' | 'Export' | 'Source' | 'Const' | 'Function' | 'ArrowFunction' | 'Text' | 'Break' | 'Jsx';
301
+ type NodeKind = 'Input' | 'Output' | 'Operation' | 'Schema' | 'Property' | 'Parameter' | 'Response' | 'RequestBody' | 'Content' | 'FunctionParameter' | 'ParameterGroup' | 'FunctionParameters' | 'Type' | 'ParamsType' | 'File' | 'Import' | 'Export' | 'Source' | 'Const' | 'Function' | 'ArrowFunction' | 'Text' | 'Break' | 'Jsx';
203
302
  /**
204
303
  * Base shape shared by all AST nodes.
205
304
  *
@@ -510,1087 +609,1123 @@ type JsxNode = BaseNode & {
510
609
  */
511
610
  type CodeNode = ConstNode | TypeNode | FunctionNode | ArrowFunctionNode | TextNode | BreakNode | JsxNode;
512
611
  //#endregion
513
- //#region src/nodes/file.d.ts
514
- /**
515
- * Supported file extensions.
516
- */
517
- type Extname = '.ts' | '.js' | '.tsx' | '.json' | `.${string}`;
518
- type ImportName = string | Array<string | {
519
- propertyName: string;
520
- name?: string;
521
- }>;
612
+ //#region src/nodes/property.d.ts
522
613
  /**
523
- * Represents a language-agnostic import/dependency declaration.
524
- *
525
- * @example Named import (TypeScript: `import { useState } from 'react'`)
526
- * ```ts
527
- * createImport({ name: ['useState'], path: 'react' })
528
- * ```
529
- *
530
- * @example Default import (TypeScript: `import React from 'react'`)
531
- * ```ts
532
- * createImport({ name: 'React', path: 'react' })
533
- * ```
534
- *
535
- * @example Type-only import (TypeScript: `import type { FC } from 'react'`)
536
- * ```ts
537
- * createImport({ name: ['FC'], path: 'react', isTypeOnly: true })
538
- * ```
614
+ * AST node representing one named object property.
539
615
  *
540
- * @example Namespace import (TypeScript: `import * as React from 'react'`)
616
+ * @example
541
617
  * ```ts
542
- * createImport({ name: 'React', path: 'react', isNameSpace: true })
618
+ * const property: PropertyNode = {
619
+ * kind: 'Property',
620
+ * name: 'id',
621
+ * schema: createSchema({ type: 'integer' }),
622
+ * required: true,
623
+ * }
543
624
  * ```
544
625
  */
545
- type ImportNode = BaseNode & {
546
- kind: 'Import';
547
- /**
548
- * Import name(s) to be used.
549
- * @example ['useState']
550
- * @example 'React'
551
- */
552
- name: ImportName;
626
+ type PropertyNode = BaseNode & {
553
627
  /**
554
- * Path for the import.
555
- * @example '@kubb/core'
628
+ * Node kind.
556
629
  */
557
- path: string;
630
+ kind: 'Property';
558
631
  /**
559
- * Add type-only import prefix.
560
- * - `true` generates `import type { Type } from './path'`
561
- * - `false` generates `import { Type } from './path'`
562
- * @default false
632
+ * Property key.
563
633
  */
564
- isTypeOnly?: boolean | null;
634
+ name: string;
565
635
  /**
566
- * Import entire module as namespace.
567
- * - `true` generates `import * as Name from './path'`
568
- * - `false` generates standard import
569
- * @default false
636
+ * Property schema.
570
637
  */
571
- isNameSpace?: boolean | null;
638
+ schema: SchemaNode;
572
639
  /**
573
- * When set, the import path is resolved relative to this root.
640
+ * Whether the property is required.
574
641
  */
575
- root?: string | null;
642
+ required: boolean;
576
643
  };
644
+ //#endregion
645
+ //#region src/nodes/schema.d.ts
646
+ type PrimitiveSchemaType =
577
647
  /**
578
- * Represents a language-agnostic export/public API declaration.
579
- *
580
- * @example Named export (TypeScript: `export { Pets } from './Pets'`)
581
- * ```ts
582
- * createExport({ name: ['Pets'], path: './Pets' })
583
- * ```
584
- *
585
- * @example Type-only export (TypeScript: `export type { Pet } from './Pet'`)
586
- * ```ts
587
- * createExport({ name: ['Pet'], path: './Pet', isTypeOnly: true })
588
- * ```
589
- *
590
- * @example Wildcard export (TypeScript: `export * from './utils'`)
591
- * ```ts
592
- * createExport({ path: './utils' })
593
- * ```
594
- *
595
- * @example Namespace alias (TypeScript: `export * as utils from './utils'`)
596
- * ```ts
597
- * createExport({ name: 'utils', path: './utils', asAlias: true })
598
- * ```
648
+ * Text value.
599
649
  */
600
- type ExportNode = BaseNode & {
601
- kind: 'Export';
650
+ 'string'
651
+ /**
652
+ * Floating-point number.
653
+ */
654
+ | 'number'
655
+ /**
656
+ * Integer number.
657
+ */
658
+ | 'integer'
659
+ /**
660
+ * Big integer number.
661
+ */
662
+ | 'bigint'
663
+ /**
664
+ * Boolean value.
665
+ */
666
+ | 'boolean'
667
+ /**
668
+ * Null value.
669
+ */
670
+ | 'null'
671
+ /**
672
+ * Any value.
673
+ */
674
+ | 'any'
675
+ /**
676
+ * Unknown value.
677
+ */
678
+ | 'unknown'
679
+ /**
680
+ * No value (`void`).
681
+ */
682
+ | 'void'
683
+ /**
684
+ * Never value.
685
+ */
686
+ | 'never'
687
+ /**
688
+ * Object value.
689
+ */
690
+ | 'object'
691
+ /**
692
+ * Array value.
693
+ */
694
+ | 'array'
695
+ /**
696
+ * Date value.
697
+ */
698
+ | 'date';
699
+ /**
700
+ * Composite schema types.
701
+ */
702
+ type ComplexSchemaType = 'tuple' | 'union' | 'intersection' | 'enum';
703
+ /**
704
+ * Schema types that need special handling in generators.
705
+ */
706
+ type SpecialSchemaType = 'ref' | 'datetime' | 'time' | 'uuid' | 'email' | 'url' | 'ipv4' | 'ipv6' | 'blob';
707
+ /**
708
+ * All schema type strings.
709
+ */
710
+ type SchemaType = PrimitiveSchemaType | ComplexSchemaType | SpecialSchemaType;
711
+ /**
712
+ * Scalar schema types without extra object/array/ref structure.
713
+ */
714
+ type ScalarSchemaType = Exclude<SchemaType, 'object' | 'array' | 'tuple' | 'union' | 'intersection' | 'enum' | 'ref' | 'datetime' | 'date' | 'time' | 'string' | 'number' | 'integer' | 'bigint' | 'url' | 'uuid' | 'email'>;
715
+ /**
716
+ * Fields shared by all schema nodes.
717
+ */
718
+ type SchemaNodeBase = BaseNode & {
602
719
  /**
603
- * Export name(s) to be used. When omitted, generates a wildcard export.
604
- * @example ['useState']
605
- * @example 'React'
720
+ * Node kind.
606
721
  */
607
- name?: string | Array<string> | null;
722
+ kind: 'Schema';
608
723
  /**
609
- * Path for the export.
610
- * @example '@kubb/core'
724
+ * Schema name for named definitions (for example, `"Pet"`).
725
+ * Inline schemas omit this field.
726
+ * `null` means kubb has processed this and determined there is no applicable name.
727
+ * `undefined` means the name has not been set yet.
611
728
  */
612
- path: string;
729
+ name?: string | null;
613
730
  /**
614
- * Add type-only export prefix.
615
- * - `true` generates `export type { Type } from './path'`
616
- * - `false` generates `export { Type } from './path'`
617
- * @default false
731
+ * Short schema title.
618
732
  */
619
- isTypeOnly?: boolean | null;
733
+ title?: string;
620
734
  /**
621
- * Export as an aliased namespace.
622
- * - `true` generates `export * as aliasName from './path'`
623
- * - `false` generates a standard export
624
- * @default false
735
+ * Schema description text.
625
736
  */
626
- asAlias?: boolean | null;
627
- };
628
- /**
629
- * Represents a fragment of source code within a file.
630
- *
631
- * @example Named exportable source
632
- * ```ts
633
- * createSource({ name: 'Pet', nodes: [createText('export type Pet = { id: number }')], isExportable: true, isIndexable: true })
634
- * ```
635
- *
636
- * @example Inline unnamed code block
637
- * ```ts
638
- * createSource({ nodes: [createText('const x = 1')] })
639
- * ```
640
- */
641
- type SourceNode = BaseNode & {
642
- kind: 'Source';
737
+ description?: string;
643
738
  /**
644
- * Optional name identifying this source (used for deduplication and barrel generation).
739
+ * Whether `null` is allowed.
645
740
  */
646
- name?: string | null;
741
+ nullable?: boolean;
647
742
  /**
648
- * Mark this source as a type-only export.
649
- * @default false
743
+ * Whether the field is optional.
650
744
  */
651
- isTypeOnly?: boolean | null;
745
+ optional?: boolean;
652
746
  /**
653
- * Include `export` keyword in the generated source.
654
- * @default false
747
+ * Both optional and nullable (`optional` + `nullable`).
655
748
  */
656
- isExportable?: boolean | null;
749
+ nullish?: boolean;
657
750
  /**
658
- * Include this source in barrel/index file generation.
659
- * @default false
751
+ * Whether the schema is deprecated.
660
752
  */
661
- isIndexable?: boolean | null;
753
+ deprecated?: boolean;
662
754
  /**
663
- * Structured child nodes representing the content of this source fragment, in DOM order.
664
- * Each entry is a {@link CodeNode}; use {@link TextNode} for raw string content.
755
+ * Whether the schema is read-only.
665
756
  */
666
- nodes?: Array<CodeNode>;
667
- };
668
- /**
669
- * Represents a fully resolved file in the AST.
670
- *
671
- * Created via `createFile()`, which computes the `id`, `name`, and `extname` from the input
672
- * and deduplicates `imports`, `exports`, and `sources`.
673
- *
674
- * @example
675
- * ```ts
676
- * const file = createFile({
677
- * baseName: 'petStore.ts',
678
- * path: 'src/models/petStore.ts',
679
- * sources: [createSource({ name: 'Pet', nodes: [createText('export type Pet = { id: number }')], isExportable: true })],
680
- * imports: [createImport({ name: ['z'], path: 'zod' })],
681
- * exports: [createExport({ name: ['Pet'], path: './petStore' })],
682
- * })
683
- * // file.id = SHA256 hash of the path
684
- * // file.name = 'petStore'
685
- * // file.extname = '.ts'
686
- * ```
687
- */
688
- type FileNode<TMeta extends object = object> = BaseNode & {
689
- kind: 'File';
757
+ readOnly?: boolean;
690
758
  /**
691
- * Unique identifier derived from a SHA256 hash of the file path. Computed
692
- * by `createFile`; callers do not need to provide it.
759
+ * Whether the schema is write-only.
693
760
  */
694
- id: string;
761
+ writeOnly?: boolean;
695
762
  /**
696
- * File name without extension, derived from `baseName`.
697
- * @link https://nodejs.org/api/path.html#pathformatpathobject
763
+ * Default value.
698
764
  */
699
- name: string;
765
+ default?: unknown;
700
766
  /**
701
- * File base name, including extension.
702
- * Based on UNIX basename: `${name}${extname}`
703
- * @link https://nodejs.org/api/path.html#pathbasenamepath-suffix
767
+ * Example value.
704
768
  */
705
- baseName: `${string}.${string}`;
769
+ example?: unknown;
706
770
  /**
707
- * Full qualified path to the file.
771
+ * Base primitive type.
772
+ * For example, this is `'string'` for a `uuid` schema.
708
773
  */
709
- path: string;
774
+ primitive?: PrimitiveSchemaType;
710
775
  /**
711
- * File extension extracted from `baseName`.
776
+ * Schema `format` value.
712
777
  */
713
- extname: Extname;
778
+ format?: string;
779
+ };
780
+ /**
781
+ * Object schema with ordered properties.
782
+ *
783
+ * @example
784
+ * ```ts
785
+ * const objectSchema: ObjectSchemaNode = {
786
+ * kind: 'Schema',
787
+ * type: 'object',
788
+ * properties: [],
789
+ * }
790
+ * ```
791
+ */
792
+ type ObjectSchemaNode = SchemaNodeBase & {
714
793
  /**
715
- * Deduplicated list of source code fragments.
794
+ * Schema type discriminator.
716
795
  */
717
- sources: Array<SourceNode>;
796
+ type: 'object';
718
797
  /**
719
- * Deduplicated list of import declarations.
798
+ * Primitive type always `'object'` for object schemas.
720
799
  */
721
- imports: Array<ImportNode>;
800
+ primitive: 'object';
722
801
  /**
723
- * Deduplicated list of export declarations.
802
+ * Ordered object properties.
724
803
  */
725
- exports: Array<ExportNode>;
804
+ properties: Array<PropertyNode>;
726
805
  /**
727
- * Optional metadata attached to this file (used by plugins for barrel generation etc.).
806
+ * Additional object properties behavior:
807
+ * - `true`: allow any value
808
+ * - `false`: reject unknown properties (maps to `.strict()` in Zod)
809
+ * - `SchemaNode`: allow values that match that schema
810
+ * - `undefined`: no additional properties constraint (open object)
728
811
  */
729
- meta?: TMeta;
812
+ additionalProperties?: SchemaNode | boolean;
730
813
  /**
731
- * Optional banner prepended to the generated file content.
732
- * Accepts `null` so `resolver.resolveBanner()` results can be passed directly.
814
+ * Pattern-based property schemas.
733
815
  */
734
- banner?: string | null;
816
+ patternProperties?: Record<string, SchemaNode>;
735
817
  /**
736
- * Optional footer appended to the generated file content.
737
- * Accepts `null` so `resolver.resolveFooter()` results can be passed directly.
818
+ * Minimum number of properties allowed.
738
819
  */
739
- footer?: string | null;
820
+ minProperties?: number;
821
+ /**
822
+ * Maximum number of properties allowed.
823
+ */
824
+ maxProperties?: number;
740
825
  };
741
- //#endregion
742
- //#region src/nodes/function.d.ts
743
826
  /**
744
- * AST node representing a language-agnostic type expression used as a function parameter
745
- * type annotation. Each language printer renders the variant into its own syntax.
746
- *
747
- * - `struct` — an inline anonymous type grouping named fields.
748
- * TypeScript renders as `{ petId: string; name?: string }`.
749
- * - `member` — a single named field accessed from a named group type.
750
- * TypeScript renders as `PathParams['petId']`.
751
- *
752
- * @example Reference variant
753
- * ```ts
754
- * createParamsType({ variant: 'reference', name: 'QueryParams' })
755
- * // QueryParams
756
- * ```
757
- *
758
- * @example Struct variant
759
- * ```ts
760
- * createParamsType({ variant: 'struct', properties: [{ name: 'petId', optional: false, type: createParamsType({ variant: 'reference', name: 'string' }) }] })
761
- * // { petId: string }
762
- * ```
827
+ * Array-like schema (`array` or `tuple`).
763
828
  *
764
- * @example Member variant
829
+ * @example
765
830
  * ```ts
766
- * createParamsType({ variant: 'member', base: 'PathParams', key: 'petId' })
767
- * // PathParams['petId']
831
+ * const arraySchema: ArraySchemaNode = {
832
+ * kind: 'Schema',
833
+ * type: 'array',
834
+ * items: [],
835
+ * }
768
836
  * ```
769
837
  */
770
- type ParamsTypeNode = BaseNode & {
771
- /**
772
- * Node kind.
773
- */
774
- kind: 'ParamsType';
775
- } & ({
838
+ type ArraySchemaNode = SchemaNodeBase & {
776
839
  /**
777
- * Reference variant a plain type name or identifier.
778
- * TypeScript renders as-is, e.g. `string`, `QueryParams`, `Partial<Config>`.
840
+ * Schema type discriminator (`array` or `tuple`).
779
841
  */
780
- variant: 'reference';
842
+ type: 'array' | 'tuple';
781
843
  /**
782
- * The full type name string, e.g. `'string'`, `'QueryParams'`, `'Partial<Config>'`.
844
+ * Item schemas.
783
845
  */
784
- name: string;
785
- } | {
846
+ items?: Array<SchemaNode>;
786
847
  /**
787
- * Struct variant an inline anonymous type grouping named fields.
788
- * TypeScript renders as `{ key: Type; other?: OtherType }`.
848
+ * Tuple rest-item schema for elements beyond positional `items`.
789
849
  */
790
- variant: 'struct';
850
+ rest?: SchemaNode;
791
851
  /**
792
- * Properties of the struct type.
852
+ * Minimum item count (or tuple length).
793
853
  */
794
- properties: Array<{
795
- name: string;
796
- optional: boolean;
797
- type: ParamsTypeNode;
798
- }>;
799
- } | {
854
+ min?: number;
800
855
  /**
801
- * Member variant a single named field accessed from a group type.
802
- * TypeScript renders as `Base['key']`.
856
+ * Maximum item count (or tuple length).
803
857
  */
804
- variant: 'member';
858
+ max?: number;
805
859
  /**
806
- * Base type name, e.g. `'DeletePetPathParams'`.
860
+ * Whether all items must be unique.
807
861
  */
808
- base: string;
862
+ unique?: boolean;
863
+ };
864
+ /**
865
+ * Shared shape for union and intersection schemas.
866
+ */
867
+ type CompositeSchemaNodeBase = SchemaNodeBase & {
809
868
  /**
810
- * The field name to access, e.g. `'petId'`.
869
+ * Member schemas.
811
870
  */
812
- key: string;
813
- });
871
+ members?: Array<SchemaNode>;
872
+ };
814
873
  /**
815
- * AST node for one function parameter.
816
- *
817
- * @example Required parameter
818
- * `name: Type`
819
- *
820
- * @example Optional parameter
821
- * `name?: Type`
822
- *
823
- * @example Parameter with default value
824
- * `name: Type = defaultValue`
874
+ * Union schema, often from `oneOf` or `anyOf`.
825
875
  *
826
- * @example Rest parameter
827
- * `...name: Type[]`
876
+ * @example
877
+ * ```ts
878
+ * const unionSchema: UnionSchemaNode = {
879
+ * kind: 'Schema',
880
+ * type: 'union',
881
+ * members: [],
882
+ * }
883
+ * ```
828
884
  */
829
- type FunctionParameterNode = BaseNode & {
830
- /**
831
- * Node kind.
832
- */
833
- kind: 'FunctionParameter';
885
+ type UnionSchemaNode = CompositeSchemaNodeBase & {
834
886
  /**
835
- * Parameter name in the generated signature.
887
+ * Schema type discriminator.
836
888
  */
837
- name: string;
889
+ type: 'union';
838
890
  /**
839
- * Type annotation as a structured {@link ParamsTypeNode}.
840
- * Omit for untyped output.
841
- *
842
- * @example Reference type node
843
- * `{ kind: 'ParamsType', variant: 'reference', name: 'string' }` → `petId: string`
844
- *
845
- * @example Struct type node
846
- * `{ kind: 'ParamsType', variant: 'struct', properties: [...] }` → `{ key: Type; other?: OtherType }`
847
- *
848
- * @example Member type node
849
- * `{ kind: 'ParamsType', variant: 'member', base: 'PathParams', key: 'petId' }` → `PathParams['petId']`
891
+ * Discriminator property name from OpenAPI `discriminator.propertyName`.
850
892
  */
851
- type?: ParamsTypeNode;
893
+ discriminatorPropertyName?: string;
852
894
  /**
853
- * When `true` the parameter is emitted as a rest parameter.
854
- *
855
- * @example Rest parameter
856
- * `...name: Type[]`
895
+ * Logical strategy applied to union members: 'one' means exactly one member must be valid (from `oneOf`),
896
+ * 'any' means any number of members can be valid (from `anyOf`).
857
897
  */
858
- rest?: boolean;
859
- }
860
- /**
861
- * Optional parameter — rendered with `?` and may be omitted by the caller.
862
- * Cannot be combined with `default` because a defaulted parameter is already optional.
863
- */
864
- & ({
865
- optional: true;
866
- default?: never;
867
- }
898
+ strategy?: 'one' | 'any';
899
+ };
868
900
  /**
869
- * Required parameter, or a parameter with a default value.
870
- *
871
- * @example Required
872
- * `name: Type`
901
+ * Intersection schema, often from `allOf`.
873
902
  *
874
- * @example With default
875
- * `name: Type = default`
903
+ * @example
904
+ * ```ts
905
+ * const intersectionSchema: IntersectionSchemaNode = {
906
+ * kind: 'Schema',
907
+ * type: 'intersection',
908
+ * members: [],
909
+ * }
910
+ * ```
876
911
  */
877
- | {
878
- optional?: false;
879
- default?: string;
880
- });
912
+ type IntersectionSchemaNode = CompositeSchemaNodeBase & {
913
+ /**
914
+ * Schema type discriminator.
915
+ */
916
+ type: 'intersection';
917
+ };
881
918
  /**
882
- * AST node for a group of related function parameters treated as a single unit.
883
- *
884
- * Each language printer decides how to render this group:
885
- * - TypeScript/JS: destructured object `{ key1, key2 }: { key1: Type1; key2: Type2 } = {}`
886
- * - Python: keyword-only args or a typed dict parameter
887
- * - C# / Kotlin: named record / data-class parameter
888
- *
889
- * When `inline` is `true`, the group is spread as individual top-level parameters
890
- * rather than wrapped in a single grouped construct.
891
- *
892
- * @example Grouped destructuring
893
- * `{ id, name }: { id: string; name: string } = {}`
894
- *
895
- * @example Inline (spread as individual parameters)
896
- * `id: string, name: string`
919
+ * One named enum item.
897
920
  */
898
- type ParameterGroupNode = BaseNode & {
921
+ type EnumValueNode = {
899
922
  /**
900
- * Node kind.
923
+ * Enum item name.
901
924
  */
902
- kind: 'ParameterGroup';
925
+ name: string;
903
926
  /**
904
- * The individual parameters that form the group.
905
- * Rendered as a destructured object or spread inline when `inline` is `true`.
927
+ * Enum item value.
906
928
  */
907
- properties: Array<FunctionParameterNode>;
929
+ value: string | number | boolean;
908
930
  /**
909
- * Optional explicit type annotation for the whole group.
910
- * When absent, printers auto-compute it from `properties`.
931
+ * Primitive type of the enum value.
911
932
  */
912
- type?: ParamsTypeNode;
933
+ primitive: Extract<PrimitiveSchemaType, 'string' | 'number' | 'boolean'>;
934
+ };
935
+ /**
936
+ * Enum schema node.
937
+ *
938
+ * @example
939
+ * ```ts
940
+ * const enumSchema: EnumSchemaNode = {
941
+ * kind: 'Schema',
942
+ * type: 'enum',
943
+ * enumValues: ['a', 'b'],
944
+ * }
945
+ * ```
946
+ */
947
+ type EnumSchemaNode = SchemaNodeBase & {
913
948
  /**
914
- * When `true`, `properties` are emitted as individual top-level parameters instead of
915
- * being wrapped in a single grouped construct.
916
- *
917
- * @default false
949
+ * Schema type discriminator.
918
950
  */
919
- inline?: boolean;
951
+ type: 'enum';
920
952
  /**
921
- * Whether the group as a whole is optional.
922
- * If omitted, printers infer this from child properties.
953
+ * Enum values in simple form.
923
954
  */
924
- optional?: boolean;
955
+ enumValues?: Array<string | number | boolean | null>;
925
956
  /**
926
- * Default value for the group, written verbatim after `=`.
927
- * Commonly `'{}'` to allow omitting the argument entirely.
957
+ * Enum values in named form.
958
+ * If present, this is used instead of `enumValues`.
928
959
  */
929
- default?: string;
960
+ namedEnumValues?: Array<EnumValueNode>;
930
961
  };
931
962
  /**
932
- * AST node for a complete function parameter list.
933
- *
934
- * Printers are responsible for sorting (`required` → `optional` → `defaulted`).
935
- * Nodes are plain immutable data.
963
+ * Reference schema that points to another schema definition.
936
964
  *
937
- * Renders differently depending on the output mode:
938
- * - `declaration` → `(id: string, config: Config = {})` — function declaration parameters
939
- * - `call` → `(id, { method, url })` — function call arguments
940
- * - `keys` → `{ id, config }` — key names only (for destructuring)
941
- * - `values` → `{ id: id, config: config }` — key → value pairs
965
+ * @example
966
+ * ```ts
967
+ * const refSchema: RefSchemaNode = {
968
+ * kind: 'Schema',
969
+ * type: 'ref',
970
+ * ref: '#/components/schemas/Pet',
971
+ * }
972
+ * ```
942
973
  */
943
- type FunctionParametersNode = BaseNode & {
974
+ type RefSchemaNode = SchemaNodeBase & {
944
975
  /**
945
- * Node kind.
976
+ * Schema type discriminator.
946
977
  */
947
- kind: 'FunctionParameters';
978
+ type: 'ref';
948
979
  /**
949
- * Ordered parameter nodes.
980
+ * Referenced schema name.
981
+ * `null` means Kubb has processed this and determined there is no applicable name.
950
982
  */
951
- params: ReadonlyArray<FunctionParameterNode | ParameterGroupNode>;
983
+ name?: string | null;
984
+ /**
985
+ * Original `$ref` path, for example, `#/components/schemas/Order`.
986
+ * Used to resolve names later.
987
+ */
988
+ ref?: string;
989
+ /**
990
+ * Pattern copied from a sibling `pattern` field.
991
+ */
992
+ pattern?: string;
993
+ /**
994
+ * The fully-parsed schema that this ref resolves to.
995
+ * Populated during OAS parsing when the referenced definition can be resolved.
996
+ * `null` when the ref cannot be resolved or is part of a circular chain.
997
+ * `undefined` when resolution has not been attempted.
998
+ *
999
+ * Useful for inspecting the referenced schema's structure (e.g. `primitive`, `properties`)
1000
+ * without following the reference manually.
1001
+ */
1002
+ schema?: SchemaNode | null;
952
1003
  };
953
1004
  /**
954
- * Union of all function-parameter AST node variants used by the function-parameter printer.
955
- */
956
- type FunctionParamNode = FunctionParameterNode | ParameterGroupNode | FunctionParametersNode | ParamsTypeNode;
957
- /**
958
- * Handler map keys — one per `FunctionParamNode` kind.
959
- */
960
- type FunctionNodeType = 'functionParameter' | 'parameterGroup' | 'functionParameters' | 'paramsType';
961
- //#endregion
962
- //#region src/nodes/property.d.ts
963
- /**
964
- * AST node representing one named object property.
1005
+ * Datetime schema.
965
1006
  *
966
1007
  * @example
967
1008
  * ```ts
968
- * const property: PropertyNode = {
969
- * kind: 'Property',
970
- * name: 'id',
971
- * schema: createSchema({ type: 'integer' }),
972
- * required: true,
973
- * }
1009
+ * const datetimeSchema: DatetimeSchemaNode = { kind: 'Schema', type: 'datetime' }
974
1010
  * ```
975
1011
  */
976
- type PropertyNode = BaseNode & {
977
- /**
978
- * Node kind.
979
- */
980
- kind: 'Property';
1012
+ type DatetimeSchemaNode = SchemaNodeBase & {
981
1013
  /**
982
- * Property key.
1014
+ * Schema type discriminator.
983
1015
  */
984
- name: string;
1016
+ type: 'datetime';
985
1017
  /**
986
- * Property schema.
1018
+ * Whether the datetime includes a timezone offset (`dateType: 'stringOffset'`).
987
1019
  */
988
- schema: SchemaNode;
1020
+ offset?: boolean;
989
1021
  /**
990
- * Whether the property is required.
1022
+ * Whether the datetime is local (no timezone, `dateType: 'stringLocal'`).
991
1023
  */
992
- required: boolean;
1024
+ local?: boolean;
993
1025
  };
994
- //#endregion
995
- //#region src/nodes/schema.d.ts
996
- type PrimitiveSchemaType =
997
- /**
998
- * Text value.
999
- */
1000
- 'string'
1001
- /**
1002
- * Floating-point number.
1003
- */
1004
- | 'number'
1005
- /**
1006
- * Integer number.
1007
- */
1008
- | 'integer'
1009
- /**
1010
- * Big integer number.
1011
- */
1012
- | 'bigint'
1013
- /**
1014
- * Boolean value.
1015
- */
1016
- | 'boolean'
1017
- /**
1018
- * Null value.
1019
- */
1020
- | 'null'
1021
- /**
1022
- * Any value.
1023
- */
1024
- | 'any'
1025
- /**
1026
- * Unknown value.
1027
- */
1028
- | 'unknown'
1029
- /**
1030
- * No value (`void`).
1031
- */
1032
- | 'void'
1033
- /**
1034
- * Never value.
1035
- */
1036
- | 'never'
1037
- /**
1038
- * Object value.
1039
- */
1040
- | 'object'
1041
- /**
1042
- * Array value.
1043
- */
1044
- | 'array'
1045
- /**
1046
- * Date value.
1047
- */
1048
- | 'date';
1049
- /**
1050
- * Composite schema types.
1051
- */
1052
- type ComplexSchemaType = 'tuple' | 'union' | 'intersection' | 'enum';
1053
1026
  /**
1054
- * Schema types that need special handling in generators.
1027
+ * Shared base for `date` and `time` schemas.
1055
1028
  */
1056
- type SpecialSchemaType = 'ref' | 'datetime' | 'time' | 'uuid' | 'email' | 'url' | 'ipv4' | 'ipv6' | 'blob';
1029
+ type TemporalSchemaNodeBase<T extends 'date' | 'time'> = SchemaNodeBase & {
1030
+ /**
1031
+ * Schema type discriminator.
1032
+ */
1033
+ type: T;
1034
+ /**
1035
+ * Output representation in generated code.
1036
+ */
1037
+ representation: 'date' | 'string';
1038
+ };
1057
1039
  /**
1058
- * All schema type strings.
1040
+ * Date schema node.
1041
+ *
1042
+ * @example
1043
+ * ```ts
1044
+ * const dateSchema: DateSchemaNode = { kind: 'Schema', type: 'date', representation: 'string' }
1045
+ * ```
1059
1046
  */
1060
- type SchemaType = PrimitiveSchemaType | ComplexSchemaType | SpecialSchemaType;
1047
+ type DateSchemaNode = TemporalSchemaNodeBase<'date'>;
1061
1048
  /**
1062
- * Scalar schema types without extra object/array/ref structure.
1049
+ * Time schema node.
1050
+ *
1051
+ * @example
1052
+ * ```ts
1053
+ * const timeSchema: TimeSchemaNode = { kind: 'Schema', type: 'time', representation: 'string' }
1054
+ * ```
1063
1055
  */
1064
- type ScalarSchemaType = Exclude<SchemaType, 'object' | 'array' | 'tuple' | 'union' | 'intersection' | 'enum' | 'ref' | 'datetime' | 'date' | 'time' | 'string' | 'number' | 'integer' | 'bigint' | 'url' | 'uuid' | 'email'>;
1056
+ type TimeSchemaNode = TemporalSchemaNodeBase<'time'>;
1065
1057
  /**
1066
- * Fields shared by all schema nodes.
1058
+ * String schema node.
1059
+ *
1060
+ * @example
1061
+ * ```ts
1062
+ * const stringSchema: StringSchemaNode = { kind: 'Schema', type: 'string' }
1063
+ * ```
1067
1064
  */
1068
- type SchemaNodeBase = BaseNode & {
1069
- /**
1070
- * Node kind.
1071
- */
1072
- kind: 'Schema';
1073
- /**
1074
- * Schema name for named definitions (for example, `"Pet"`).
1075
- * Inline schemas omit this field.
1076
- * `null` means kubb has processed this and determined there is no applicable name.
1077
- * `undefined` means the name has not been set yet.
1078
- */
1079
- name?: string | null;
1080
- /**
1081
- * Short schema title.
1082
- */
1083
- title?: string;
1084
- /**
1085
- * Schema description text.
1086
- */
1087
- description?: string;
1065
+ type StringSchemaNode = SchemaNodeBase & {
1088
1066
  /**
1089
- * Whether `null` is allowed.
1067
+ * Schema type discriminator.
1090
1068
  */
1091
- nullable?: boolean;
1069
+ type: 'string';
1092
1070
  /**
1093
- * Whether the field is optional.
1071
+ * Minimum string length.
1094
1072
  */
1095
- optional?: boolean;
1073
+ min?: number;
1096
1074
  /**
1097
- * Both optional and nullable (`optional` + `nullable`).
1075
+ * Maximum string length.
1098
1076
  */
1099
- nullish?: boolean;
1077
+ max?: number;
1100
1078
  /**
1101
- * Whether the schema is deprecated.
1079
+ * Regex pattern.
1102
1080
  */
1103
- deprecated?: boolean;
1081
+ pattern?: string;
1082
+ };
1083
+ /**
1084
+ * Numeric schema (`number`, `integer`, or `bigint`).
1085
+ *
1086
+ * @example
1087
+ * ```ts
1088
+ * const numberSchema: NumberSchemaNode = { kind: 'Schema', type: 'number' }
1089
+ * ```
1090
+ */
1091
+ type NumberSchemaNode = SchemaNodeBase & {
1104
1092
  /**
1105
- * Whether the schema is read-only.
1093
+ * Schema type discriminator.
1106
1094
  */
1107
- readOnly?: boolean;
1095
+ type: 'number' | 'integer' | 'bigint';
1108
1096
  /**
1109
- * Whether the schema is write-only.
1097
+ * Minimum value.
1110
1098
  */
1111
- writeOnly?: boolean;
1099
+ min?: number;
1112
1100
  /**
1113
- * Default value.
1101
+ * Maximum value.
1114
1102
  */
1115
- default?: unknown;
1103
+ max?: number;
1116
1104
  /**
1117
- * Example value.
1105
+ * Exclusive minimum value.
1118
1106
  */
1119
- example?: unknown;
1107
+ exclusiveMinimum?: number;
1120
1108
  /**
1121
- * Base primitive type.
1122
- * For example, this is `'string'` for a `uuid` schema.
1109
+ * Exclusive maximum value.
1123
1110
  */
1124
- primitive?: PrimitiveSchemaType;
1111
+ exclusiveMaximum?: number;
1125
1112
  /**
1126
- * Schema `format` value.
1113
+ * The value must be a multiple of this number.
1127
1114
  */
1128
- format?: string;
1115
+ multipleOf?: number;
1129
1116
  };
1130
1117
  /**
1131
- * Object schema with ordered properties.
1118
+ * Scalar schema with no extra constraints.
1132
1119
  *
1133
1120
  * @example
1134
1121
  * ```ts
1135
- * const objectSchema: ObjectSchemaNode = {
1136
- * kind: 'Schema',
1137
- * type: 'object',
1138
- * properties: [],
1139
- * }
1122
+ * const anySchema: ScalarSchemaNode = { kind: 'Schema', type: 'any' }
1140
1123
  * ```
1141
1124
  */
1142
- type ObjectSchemaNode = SchemaNodeBase & {
1125
+ type ScalarSchemaNode = SchemaNodeBase & {
1143
1126
  /**
1144
1127
  * Schema type discriminator.
1145
1128
  */
1146
- type: 'object';
1147
- /**
1148
- * Primitive type — always `'object'` for object schemas.
1149
- */
1150
- primitive: 'object';
1151
- /**
1152
- * Ordered object properties.
1153
- */
1154
- properties: Array<PropertyNode>;
1129
+ type: ScalarSchemaType;
1130
+ };
1131
+ /**
1132
+ * URL schema node.
1133
+ * Can include an OpenAPI-style path template for template literal types.
1134
+ *
1135
+ * @example
1136
+ * ```ts
1137
+ * const urlSchema: UrlSchemaNode = { kind: 'Schema', type: 'url', path: '/pets/{petId}' }
1138
+ * ```
1139
+ */
1140
+ type UrlSchemaNode = SchemaNodeBase & {
1155
1141
  /**
1156
- * Additional object properties behavior:
1157
- * - `true`: allow any value
1158
- * - `false`: reject unknown properties (maps to `.strict()` in Zod)
1159
- * - `SchemaNode`: allow values that match that schema
1160
- * - `undefined`: no additional properties constraint (open object)
1142
+ * Schema type discriminator.
1161
1143
  */
1162
- additionalProperties?: SchemaNode | boolean;
1144
+ type: 'url';
1163
1145
  /**
1164
- * Pattern-based property schemas.
1146
+ * OpenAPI-style path template, for example, `'/pets/{petId}'`.
1165
1147
  */
1166
- patternProperties?: Record<string, SchemaNode>;
1148
+ path?: string;
1167
1149
  /**
1168
- * Minimum number of properties allowed.
1150
+ * Minimum string length.
1169
1151
  */
1170
- minProperties?: number;
1152
+ min?: number;
1171
1153
  /**
1172
- * Maximum number of properties allowed.
1154
+ * Maximum string length.
1173
1155
  */
1174
- maxProperties?: number;
1156
+ max?: number;
1175
1157
  };
1176
1158
  /**
1177
- * Array-like schema (`array` or `tuple`).
1159
+ * Format-string schema for string-based formats that support length constraints.
1178
1160
  *
1179
1161
  * @example
1180
1162
  * ```ts
1181
- * const arraySchema: ArraySchemaNode = {
1182
- * kind: 'Schema',
1183
- * type: 'array',
1184
- * items: [],
1185
- * }
1163
+ * const uuidSchema: FormatStringSchemaNode = { kind: 'Schema', type: 'uuid', min: 36, max: 36 }
1186
1164
  * ```
1187
1165
  */
1188
- type ArraySchemaNode = SchemaNodeBase & {
1189
- /**
1190
- * Schema type discriminator (`array` or `tuple`).
1191
- */
1192
- type: 'array' | 'tuple';
1193
- /**
1194
- * Item schemas.
1195
- */
1196
- items?: Array<SchemaNode>;
1166
+ type FormatStringSchemaNode = SchemaNodeBase & {
1197
1167
  /**
1198
- * Tuple rest-item schema for elements beyond positional `items`.
1168
+ * Schema type discriminator.
1199
1169
  */
1200
- rest?: SchemaNode;
1170
+ type: 'uuid' | 'email';
1201
1171
  /**
1202
- * Minimum item count (or tuple length).
1172
+ * Minimum string length.
1203
1173
  */
1204
1174
  min?: number;
1205
1175
  /**
1206
- * Maximum item count (or tuple length).
1176
+ * Maximum string length.
1207
1177
  */
1208
1178
  max?: number;
1179
+ };
1180
+ /**
1181
+ * IPv4 address schema node.
1182
+ *
1183
+ * @example
1184
+ * ```ts
1185
+ * const ipv4Schema: Ipv4SchemaNode = { kind: 'Schema', type: 'ipv4' }
1186
+ * ```
1187
+ */
1188
+ type Ipv4SchemaNode = SchemaNodeBase & {
1209
1189
  /**
1210
- * Whether all items must be unique.
1190
+ * Schema type discriminator.
1211
1191
  */
1212
- unique?: boolean;
1192
+ type: 'ipv4';
1213
1193
  };
1214
1194
  /**
1215
- * Shared shape for union and intersection schemas.
1195
+ * IPv6 address schema node.
1196
+ *
1197
+ * @example
1198
+ * ```ts
1199
+ * const ipv6Schema: Ipv6SchemaNode = { kind: 'Schema', type: 'ipv6' }
1200
+ * ```
1216
1201
  */
1217
- type CompositeSchemaNodeBase = SchemaNodeBase & {
1202
+ type Ipv6SchemaNode = SchemaNodeBase & {
1218
1203
  /**
1219
- * Member schemas.
1204
+ * Schema type discriminator.
1220
1205
  */
1221
- members?: Array<SchemaNode>;
1206
+ type: 'ipv6';
1222
1207
  };
1223
1208
  /**
1224
- * Union schema, often from `oneOf` or `anyOf`.
1209
+ * Mapping from schema type literals to concrete schema node types.
1210
+ * Used by `narrowSchema`.
1211
+ */
1212
+ type SchemaNodeByType = {
1213
+ object: ObjectSchemaNode;
1214
+ array: ArraySchemaNode;
1215
+ tuple: ArraySchemaNode;
1216
+ union: UnionSchemaNode;
1217
+ intersection: IntersectionSchemaNode;
1218
+ enum: EnumSchemaNode;
1219
+ ref: RefSchemaNode;
1220
+ datetime: DatetimeSchemaNode;
1221
+ date: DateSchemaNode;
1222
+ time: TimeSchemaNode;
1223
+ string: StringSchemaNode;
1224
+ number: NumberSchemaNode;
1225
+ integer: NumberSchemaNode;
1226
+ bigint: NumberSchemaNode;
1227
+ boolean: ScalarSchemaNode;
1228
+ null: ScalarSchemaNode;
1229
+ any: ScalarSchemaNode;
1230
+ unknown: ScalarSchemaNode;
1231
+ void: ScalarSchemaNode;
1232
+ never: ScalarSchemaNode;
1233
+ uuid: FormatStringSchemaNode;
1234
+ email: FormatStringSchemaNode;
1235
+ url: UrlSchemaNode;
1236
+ ipv4: Ipv4SchemaNode;
1237
+ ipv6: Ipv6SchemaNode;
1238
+ blob: ScalarSchemaNode;
1239
+ };
1240
+ /**
1241
+ * Union of all schema node types.
1242
+ */
1243
+ type SchemaNode = ObjectSchemaNode | ArraySchemaNode | UnionSchemaNode | IntersectionSchemaNode | EnumSchemaNode | RefSchemaNode | DatetimeSchemaNode | DateSchemaNode | TimeSchemaNode | StringSchemaNode | NumberSchemaNode | UrlSchemaNode | FormatStringSchemaNode | Ipv4SchemaNode | Ipv6SchemaNode | ScalarSchemaNode;
1244
+ //#endregion
1245
+ //#region src/nodes/content.d.ts
1246
+ /**
1247
+ * AST node representing one content-type entry of a request body or response.
1248
+ *
1249
+ * One entry per content type declared in the spec (e.g. `application/json`,
1250
+ * `multipart/form-data`), each carrying its own body schema.
1225
1251
  *
1226
1252
  * @example
1227
1253
  * ```ts
1228
- * const unionSchema: UnionSchemaNode = {
1229
- * kind: 'Schema',
1230
- * type: 'union',
1231
- * members: [],
1254
+ * const content: ContentNode = {
1255
+ * kind: 'Content',
1256
+ * contentType: 'application/json',
1257
+ * schema: createSchema({ type: 'string' }),
1232
1258
  * }
1233
1259
  * ```
1234
1260
  */
1235
- type UnionSchemaNode = CompositeSchemaNodeBase & {
1261
+ type ContentNode = BaseNode & {
1236
1262
  /**
1237
- * Schema type discriminator.
1263
+ * Node kind.
1238
1264
  */
1239
- type: 'union';
1265
+ kind: 'Content';
1240
1266
  /**
1241
- * Discriminator property name from OpenAPI `discriminator.propertyName`.
1267
+ * The content type for this entry (e.g. `'application/json'`).
1242
1268
  */
1243
- discriminatorPropertyName?: string;
1269
+ contentType: string;
1244
1270
  /**
1245
- * Logical strategy applied to union members: 'one' means exactly one member must be valid (from `oneOf`),
1246
- * 'any' means any number of members can be valid (from `anyOf`).
1271
+ * Body schema for this content type.
1247
1272
  */
1248
- strategy?: 'one' | 'any';
1273
+ schema?: SchemaNode;
1274
+ /**
1275
+ * Property keys to exclude from the generated type via `Omit<Type, Keys>`.
1276
+ * Set when a referenced schema has `readOnly`/`writeOnly` fields that should be omitted.
1277
+ */
1278
+ keysToOmit?: Array<string> | null;
1249
1279
  };
1280
+ //#endregion
1281
+ //#region src/nodes/file.d.ts
1250
1282
  /**
1251
- * Intersection schema, often from `allOf`.
1283
+ * Supported file extensions.
1284
+ */
1285
+ type Extname = '.ts' | '.js' | '.tsx' | '.json' | `.${string}`;
1286
+ type ImportName = string | Array<string | {
1287
+ propertyName: string;
1288
+ name?: string;
1289
+ }>;
1290
+ /**
1291
+ * Represents a language-agnostic import/dependency declaration.
1252
1292
  *
1253
- * @example
1293
+ * @example Named import (TypeScript: `import { useState } from 'react'`)
1254
1294
  * ```ts
1255
- * const intersectionSchema: IntersectionSchemaNode = {
1256
- * kind: 'Schema',
1257
- * type: 'intersection',
1258
- * members: [],
1259
- * }
1295
+ * createImport({ name: ['useState'], path: 'react' })
1296
+ * ```
1297
+ *
1298
+ * @example Default import (TypeScript: `import React from 'react'`)
1299
+ * ```ts
1300
+ * createImport({ name: 'React', path: 'react' })
1301
+ * ```
1302
+ *
1303
+ * @example Type-only import (TypeScript: `import type { FC } from 'react'`)
1304
+ * ```ts
1305
+ * createImport({ name: ['FC'], path: 'react', isTypeOnly: true })
1306
+ * ```
1307
+ *
1308
+ * @example Namespace import (TypeScript: `import * as React from 'react'`)
1309
+ * ```ts
1310
+ * createImport({ name: 'React', path: 'react', isNameSpace: true })
1260
1311
  * ```
1261
1312
  */
1262
- type IntersectionSchemaNode = CompositeSchemaNodeBase & {
1313
+ type ImportNode = BaseNode & {
1314
+ kind: 'Import';
1263
1315
  /**
1264
- * Schema type discriminator.
1316
+ * Import name(s) to be used.
1317
+ * @example ['useState']
1318
+ * @example 'React'
1265
1319
  */
1266
- type: 'intersection';
1320
+ name: ImportName;
1321
+ /**
1322
+ * Path for the import.
1323
+ * @example '@kubb/core'
1324
+ */
1325
+ path: string;
1326
+ /**
1327
+ * Add type-only import prefix.
1328
+ * - `true` generates `import type { Type } from './path'`
1329
+ * - `false` generates `import { Type } from './path'`
1330
+ * @default false
1331
+ */
1332
+ isTypeOnly?: boolean | null;
1333
+ /**
1334
+ * Import entire module as namespace.
1335
+ * - `true` generates `import * as Name from './path'`
1336
+ * - `false` generates standard import
1337
+ * @default false
1338
+ */
1339
+ isNameSpace?: boolean | null;
1340
+ /**
1341
+ * When set, the import path is resolved relative to this root.
1342
+ */
1343
+ root?: string | null;
1267
1344
  };
1268
1345
  /**
1269
- * One named enum item.
1346
+ * Represents a language-agnostic export/public API declaration.
1347
+ *
1348
+ * @example Named export (TypeScript: `export { Pets } from './Pets'`)
1349
+ * ```ts
1350
+ * createExport({ name: ['Pets'], path: './Pets' })
1351
+ * ```
1352
+ *
1353
+ * @example Type-only export (TypeScript: `export type { Pet } from './Pet'`)
1354
+ * ```ts
1355
+ * createExport({ name: ['Pet'], path: './Pet', isTypeOnly: true })
1356
+ * ```
1357
+ *
1358
+ * @example Wildcard export (TypeScript: `export * from './utils'`)
1359
+ * ```ts
1360
+ * createExport({ path: './utils' })
1361
+ * ```
1362
+ *
1363
+ * @example Namespace alias (TypeScript: `export * as utils from './utils'`)
1364
+ * ```ts
1365
+ * createExport({ name: 'utils', path: './utils', asAlias: true })
1366
+ * ```
1270
1367
  */
1271
- type EnumValueNode = {
1368
+ type ExportNode = BaseNode & {
1369
+ kind: 'Export';
1272
1370
  /**
1273
- * Enum item name.
1371
+ * Export name(s) to be used. When omitted, generates a wildcard export.
1372
+ * @example ['useState']
1373
+ * @example 'React'
1274
1374
  */
1275
- name: string;
1375
+ name?: string | Array<string> | null;
1276
1376
  /**
1277
- * Enum item value.
1377
+ * Path for the export.
1378
+ * @example '@kubb/core'
1278
1379
  */
1279
- value: string | number | boolean;
1380
+ path: string;
1280
1381
  /**
1281
- * Primitive type of the enum value.
1382
+ * Add type-only export prefix.
1383
+ * - `true` generates `export type { Type } from './path'`
1384
+ * - `false` generates `export { Type } from './path'`
1385
+ * @default false
1282
1386
  */
1283
- primitive: Extract<PrimitiveSchemaType, 'string' | 'number' | 'boolean'>;
1387
+ isTypeOnly?: boolean | null;
1388
+ /**
1389
+ * Export as an aliased namespace.
1390
+ * - `true` generates `export * as aliasName from './path'`
1391
+ * - `false` generates a standard export
1392
+ * @default false
1393
+ */
1394
+ asAlias?: boolean | null;
1284
1395
  };
1285
1396
  /**
1286
- * Enum schema node.
1397
+ * Represents a fragment of source code within a file.
1287
1398
  *
1288
- * @example
1399
+ * @example Named exportable source
1289
1400
  * ```ts
1290
- * const enumSchema: EnumSchemaNode = {
1291
- * kind: 'Schema',
1292
- * type: 'enum',
1293
- * enumValues: ['a', 'b'],
1294
- * }
1401
+ * createSource({ name: 'Pet', nodes: [createText('export type Pet = { id: number }')], isExportable: true, isIndexable: true })
1402
+ * ```
1403
+ *
1404
+ * @example Inline unnamed code block
1405
+ * ```ts
1406
+ * createSource({ nodes: [createText('const x = 1')] })
1295
1407
  * ```
1296
1408
  */
1297
- type EnumSchemaNode = SchemaNodeBase & {
1409
+ type SourceNode = BaseNode & {
1410
+ kind: 'Source';
1411
+ /**
1412
+ * Optional name identifying this source (used for deduplication and barrel generation).
1413
+ */
1414
+ name?: string | null;
1415
+ /**
1416
+ * Mark this source as a type-only export.
1417
+ * @default false
1418
+ */
1419
+ isTypeOnly?: boolean | null;
1298
1420
  /**
1299
- * Schema type discriminator.
1421
+ * Include `export` keyword in the generated source.
1422
+ * @default false
1300
1423
  */
1301
- type: 'enum';
1424
+ isExportable?: boolean | null;
1302
1425
  /**
1303
- * Enum values in simple form.
1426
+ * Include this source in barrel/index file generation.
1427
+ * @default false
1304
1428
  */
1305
- enumValues?: Array<string | number | boolean | null>;
1429
+ isIndexable?: boolean | null;
1306
1430
  /**
1307
- * Enum values in named form.
1308
- * If present, this is used instead of `enumValues`.
1431
+ * Structured child nodes representing the content of this source fragment, in DOM order.
1432
+ * Each entry is a {@link CodeNode}; use {@link TextNode} for raw string content.
1309
1433
  */
1310
- namedEnumValues?: Array<EnumValueNode>;
1434
+ nodes?: Array<CodeNode>;
1311
1435
  };
1312
1436
  /**
1313
- * Reference schema that points to another schema definition.
1437
+ * Represents a fully resolved file in the AST.
1438
+ *
1439
+ * Created via `createFile()`, which computes the `id`, `name`, and `extname` from the input
1440
+ * and deduplicates `imports`, `exports`, and `sources`.
1314
1441
  *
1315
1442
  * @example
1316
1443
  * ```ts
1317
- * const refSchema: RefSchemaNode = {
1318
- * kind: 'Schema',
1319
- * type: 'ref',
1320
- * ref: '#/components/schemas/Pet',
1321
- * }
1444
+ * const file = createFile({
1445
+ * baseName: 'petStore.ts',
1446
+ * path: 'src/models/petStore.ts',
1447
+ * sources: [createSource({ name: 'Pet', nodes: [createText('export type Pet = { id: number }')], isExportable: true })],
1448
+ * imports: [createImport({ name: ['z'], path: 'zod' })],
1449
+ * exports: [createExport({ name: ['Pet'], path: './petStore' })],
1450
+ * })
1451
+ * // file.id = SHA256 hash of the path
1452
+ * // file.name = 'petStore'
1453
+ * // file.extname = '.ts'
1322
1454
  * ```
1323
1455
  */
1324
- type RefSchemaNode = SchemaNodeBase & {
1456
+ type FileNode<TMeta extends object = object> = BaseNode & {
1457
+ kind: 'File';
1325
1458
  /**
1326
- * Schema type discriminator.
1459
+ * Unique identifier derived from a SHA256 hash of the file path. Computed
1460
+ * by `createFile`; callers do not need to provide it.
1327
1461
  */
1328
- type: 'ref';
1462
+ id: string;
1329
1463
  /**
1330
- * Referenced schema name.
1331
- * `null` means Kubb has processed this and determined there is no applicable name.
1464
+ * File name without extension, derived from `baseName`.
1465
+ * @link https://nodejs.org/api/path.html#pathformatpathobject
1332
1466
  */
1333
- name?: string | null;
1467
+ name: string;
1334
1468
  /**
1335
- * Original `$ref` path, for example, `#/components/schemas/Order`.
1336
- * Used to resolve names later.
1469
+ * File base name, including extension.
1470
+ * Based on UNIX basename: `${name}${extname}`
1471
+ * @link https://nodejs.org/api/path.html#pathbasenamepath-suffix
1337
1472
  */
1338
- ref?: string;
1473
+ baseName: `${string}.${string}`;
1339
1474
  /**
1340
- * Pattern copied from a sibling `pattern` field.
1475
+ * Full qualified path to the file.
1341
1476
  */
1342
- pattern?: string;
1477
+ path: string;
1343
1478
  /**
1344
- * The fully-parsed schema that this ref resolves to.
1345
- * Populated during OAS parsing when the referenced definition can be resolved.
1346
- * `null` when the ref cannot be resolved or is part of a circular chain.
1347
- * `undefined` when resolution has not been attempted.
1348
- *
1349
- * Useful for inspecting the referenced schema's structure (e.g. `primitive`, `properties`)
1350
- * without following the reference manually.
1479
+ * File extension extracted from `baseName`.
1351
1480
  */
1352
- schema?: SchemaNode | null;
1353
- };
1354
- /**
1355
- * Datetime schema.
1356
- *
1357
- * @example
1358
- * ```ts
1359
- * const datetimeSchema: DatetimeSchemaNode = { kind: 'Schema', type: 'datetime' }
1360
- * ```
1361
- */
1362
- type DatetimeSchemaNode = SchemaNodeBase & {
1481
+ extname: Extname;
1363
1482
  /**
1364
- * Schema type discriminator.
1483
+ * Deduplicated list of source code fragments.
1365
1484
  */
1366
- type: 'datetime';
1485
+ sources: Array<SourceNode>;
1367
1486
  /**
1368
- * Whether the datetime includes a timezone offset (`dateType: 'stringOffset'`).
1487
+ * Deduplicated list of import declarations.
1369
1488
  */
1370
- offset?: boolean;
1489
+ imports: Array<ImportNode>;
1371
1490
  /**
1372
- * Whether the datetime is local (no timezone, `dateType: 'stringLocal'`).
1491
+ * Deduplicated list of export declarations.
1373
1492
  */
1374
- local?: boolean;
1375
- };
1376
- /**
1377
- * Shared base for `date` and `time` schemas.
1378
- */
1379
- type TemporalSchemaNodeBase<T extends 'date' | 'time'> = SchemaNodeBase & {
1493
+ exports: Array<ExportNode>;
1380
1494
  /**
1381
- * Schema type discriminator.
1495
+ * Optional metadata attached to this file (used by plugins for barrel generation etc.).
1382
1496
  */
1383
- type: T;
1497
+ meta?: TMeta;
1384
1498
  /**
1385
- * Output representation in generated code.
1499
+ * Optional banner prepended to the generated file content.
1500
+ * Accepts `null` so `resolver.resolveBanner()` results can be passed directly.
1386
1501
  */
1387
- representation: 'date' | 'string';
1502
+ banner?: string | null;
1503
+ /**
1504
+ * Optional footer appended to the generated file content.
1505
+ * Accepts `null` so `resolver.resolveFooter()` results can be passed directly.
1506
+ */
1507
+ footer?: string | null;
1388
1508
  };
1509
+ //#endregion
1510
+ //#region src/nodes/function.d.ts
1389
1511
  /**
1390
- * Date schema node.
1512
+ * AST node representing a language-agnostic type expression used as a function parameter
1513
+ * type annotation. Each language printer renders the variant into its own syntax.
1391
1514
  *
1392
- * @example
1515
+ * - `struct` — an inline anonymous type grouping named fields.
1516
+ * TypeScript renders as `{ petId: string; name?: string }`.
1517
+ * - `member` — a single named field accessed from a named group type.
1518
+ * TypeScript renders as `PathParams['petId']`.
1519
+ *
1520
+ * @example Reference variant
1393
1521
  * ```ts
1394
- * const dateSchema: DateSchemaNode = { kind: 'Schema', type: 'date', representation: 'string' }
1522
+ * createParamsType({ variant: 'reference', name: 'QueryParams' })
1523
+ * // QueryParams
1395
1524
  * ```
1396
- */
1397
- type DateSchemaNode = TemporalSchemaNodeBase<'date'>;
1398
- /**
1399
- * Time schema node.
1400
1525
  *
1401
- * @example
1526
+ * @example Struct variant
1402
1527
  * ```ts
1403
- * const timeSchema: TimeSchemaNode = { kind: 'Schema', type: 'time', representation: 'string' }
1528
+ * createParamsType({ variant: 'struct', properties: [{ name: 'petId', optional: false, type: createParamsType({ variant: 'reference', name: 'string' }) }] })
1529
+ * // { petId: string }
1404
1530
  * ```
1405
- */
1406
- type TimeSchemaNode = TemporalSchemaNodeBase<'time'>;
1407
- /**
1408
- * String schema node.
1409
1531
  *
1410
- * @example
1532
+ * @example Member variant
1411
1533
  * ```ts
1412
- * const stringSchema: StringSchemaNode = { kind: 'Schema', type: 'string' }
1534
+ * createParamsType({ variant: 'member', base: 'PathParams', key: 'petId' })
1535
+ * // PathParams['petId']
1413
1536
  * ```
1414
1537
  */
1415
- type StringSchemaNode = SchemaNodeBase & {
1538
+ type ParamsTypeNode = BaseNode & {
1416
1539
  /**
1417
- * Schema type discriminator.
1540
+ * Node kind.
1418
1541
  */
1419
- type: 'string';
1542
+ kind: 'ParamsType';
1543
+ } & ({
1420
1544
  /**
1421
- * Minimum string length.
1545
+ * Reference variant — a plain type name or identifier.
1546
+ * TypeScript renders as-is, e.g. `string`, `QueryParams`, `Partial<Config>`.
1422
1547
  */
1423
- min?: number;
1548
+ variant: 'reference';
1424
1549
  /**
1425
- * Maximum string length.
1550
+ * The full type name string, e.g. `'string'`, `'QueryParams'`, `'Partial<Config>'`.
1426
1551
  */
1427
- max?: number;
1552
+ name: string;
1553
+ } | {
1428
1554
  /**
1429
- * Regex pattern.
1555
+ * Struct variant — an inline anonymous type grouping named fields.
1556
+ * TypeScript renders as `{ key: Type; other?: OtherType }`.
1430
1557
  */
1431
- pattern?: string;
1432
- };
1433
- /**
1434
- * Numeric schema (`number`, `integer`, or `bigint`).
1435
- *
1436
- * @example
1437
- * ```ts
1438
- * const numberSchema: NumberSchemaNode = { kind: 'Schema', type: 'number' }
1439
- * ```
1440
- */
1441
- type NumberSchemaNode = SchemaNodeBase & {
1558
+ variant: 'struct';
1442
1559
  /**
1443
- * Schema type discriminator.
1560
+ * Properties of the struct type.
1444
1561
  */
1445
- type: 'number' | 'integer' | 'bigint';
1562
+ properties: Array<{
1563
+ name: string;
1564
+ optional: boolean;
1565
+ type: ParamsTypeNode;
1566
+ }>;
1567
+ } | {
1446
1568
  /**
1447
- * Minimum value.
1569
+ * Member variant — a single named field accessed from a group type.
1570
+ * TypeScript renders as `Base['key']`.
1448
1571
  */
1449
- min?: number;
1572
+ variant: 'member';
1450
1573
  /**
1451
- * Maximum value.
1574
+ * Base type name, e.g. `'DeletePetPathParams'`.
1452
1575
  */
1453
- max?: number;
1576
+ base: string;
1454
1577
  /**
1455
- * Exclusive minimum value.
1578
+ * The field name to access, e.g. `'petId'`.
1456
1579
  */
1457
- exclusiveMinimum?: number;
1580
+ key: string;
1581
+ });
1582
+ /**
1583
+ * AST node for one function parameter.
1584
+ *
1585
+ * @example Required parameter
1586
+ * `name: Type`
1587
+ *
1588
+ * @example Optional parameter
1589
+ * `name?: Type`
1590
+ *
1591
+ * @example Parameter with default value
1592
+ * `name: Type = defaultValue`
1593
+ *
1594
+ * @example Rest parameter
1595
+ * `...name: Type[]`
1596
+ */
1597
+ type FunctionParameterNode = BaseNode & {
1458
1598
  /**
1459
- * Exclusive maximum value.
1599
+ * Node kind.
1460
1600
  */
1461
- exclusiveMaximum?: number;
1601
+ kind: 'FunctionParameter';
1462
1602
  /**
1463
- * The value must be a multiple of this number.
1603
+ * Parameter name in the generated signature.
1464
1604
  */
1465
- multipleOf?: number;
1466
- };
1605
+ name: string;
1606
+ /**
1607
+ * Type annotation as a structured {@link ParamsTypeNode}.
1608
+ * Omit for untyped output.
1609
+ *
1610
+ * @example Reference type node
1611
+ * `{ kind: 'ParamsType', variant: 'reference', name: 'string' }` → `petId: string`
1612
+ *
1613
+ * @example Struct type node
1614
+ * `{ kind: 'ParamsType', variant: 'struct', properties: [...] }` → `{ key: Type; other?: OtherType }`
1615
+ *
1616
+ * @example Member type node
1617
+ * `{ kind: 'ParamsType', variant: 'member', base: 'PathParams', key: 'petId' }` → `PathParams['petId']`
1618
+ */
1619
+ type?: ParamsTypeNode;
1620
+ /**
1621
+ * When `true` the parameter is emitted as a rest parameter.
1622
+ *
1623
+ * @example Rest parameter
1624
+ * `...name: Type[]`
1625
+ */
1626
+ rest?: boolean;
1627
+ }
1467
1628
  /**
1468
- * Scalar schema with no extra constraints.
1629
+ * Optional parameter — rendered with `?` and may be omitted by the caller.
1630
+ * Cannot be combined with `default` because a defaulted parameter is already optional.
1631
+ */
1632
+ & ({
1633
+ optional: true;
1634
+ default?: never;
1635
+ }
1636
+ /**
1637
+ * Required parameter, or a parameter with a default value.
1469
1638
  *
1470
- * @example
1471
- * ```ts
1472
- * const anySchema: ScalarSchemaNode = { kind: 'Schema', type: 'any' }
1473
- * ```
1639
+ * @example Required
1640
+ * `name: Type`
1641
+ *
1642
+ * @example With default
1643
+ * `name: Type = default`
1474
1644
  */
1475
- type ScalarSchemaNode = SchemaNodeBase & {
1476
- /**
1477
- * Schema type discriminator.
1478
- */
1479
- type: ScalarSchemaType;
1480
- };
1645
+ | {
1646
+ optional?: false;
1647
+ default?: string;
1648
+ });
1481
1649
  /**
1482
- * URL schema node.
1483
- * Can include an OpenAPI-style path template for template literal types.
1650
+ * AST node for a group of related function parameters treated as a single unit.
1484
1651
  *
1485
- * @example
1486
- * ```ts
1487
- * const urlSchema: UrlSchemaNode = { kind: 'Schema', type: 'url', path: '/pets/{petId}' }
1488
- * ```
1652
+ * Each language printer decides how to render this group:
1653
+ * - TypeScript/JS: destructured object `{ key1, key2 }: { key1: Type1; key2: Type2 } = {}`
1654
+ * - Python: keyword-only args or a typed dict parameter
1655
+ * - C# / Kotlin: named record / data-class parameter
1656
+ *
1657
+ * When `inline` is `true`, the group is spread as individual top-level parameters
1658
+ * rather than wrapped in a single grouped construct.
1659
+ *
1660
+ * @example Grouped destructuring
1661
+ * `{ id, name }: { id: string; name: string } = {}`
1662
+ *
1663
+ * @example Inline (spread as individual parameters)
1664
+ * `id: string, name: string`
1489
1665
  */
1490
- type UrlSchemaNode = SchemaNodeBase & {
1491
- /**
1492
- * Schema type discriminator.
1493
- */
1494
- type: 'url';
1666
+ type ParameterGroupNode = BaseNode & {
1495
1667
  /**
1496
- * OpenAPI-style path template, for example, `'/pets/{petId}'`.
1668
+ * Node kind.
1497
1669
  */
1498
- path?: string;
1670
+ kind: 'ParameterGroup';
1499
1671
  /**
1500
- * Minimum string length.
1672
+ * The individual parameters that form the group.
1673
+ * Rendered as a destructured object or spread inline when `inline` is `true`.
1501
1674
  */
1502
- min?: number;
1675
+ properties: Array<FunctionParameterNode>;
1503
1676
  /**
1504
- * Maximum string length.
1677
+ * Optional explicit type annotation for the whole group.
1678
+ * When absent, printers auto-compute it from `properties`.
1505
1679
  */
1506
- max?: number;
1507
- };
1508
- /**
1509
- * Format-string schema for string-based formats that support length constraints.
1510
- *
1511
- * @example
1512
- * ```ts
1513
- * const uuidSchema: FormatStringSchemaNode = { kind: 'Schema', type: 'uuid', min: 36, max: 36 }
1514
- * ```
1515
- */
1516
- type FormatStringSchemaNode = SchemaNodeBase & {
1680
+ type?: ParamsTypeNode;
1517
1681
  /**
1518
- * Schema type discriminator.
1682
+ * When `true`, `properties` are emitted as individual top-level parameters instead of
1683
+ * being wrapped in a single grouped construct.
1684
+ *
1685
+ * @default false
1519
1686
  */
1520
- type: 'uuid' | 'email';
1687
+ inline?: boolean;
1521
1688
  /**
1522
- * Minimum string length.
1689
+ * Whether the group as a whole is optional.
1690
+ * If omitted, printers infer this from child properties.
1523
1691
  */
1524
- min?: number;
1692
+ optional?: boolean;
1525
1693
  /**
1526
- * Maximum string length.
1694
+ * Default value for the group, written verbatim after `=`.
1695
+ * Commonly `'{}'` to allow omitting the argument entirely.
1527
1696
  */
1528
- max?: number;
1697
+ default?: string;
1529
1698
  };
1530
1699
  /**
1531
- * IPv4 address schema node.
1700
+ * AST node for a complete function parameter list.
1532
1701
  *
1533
- * @example
1534
- * ```ts
1535
- * const ipv4Schema: Ipv4SchemaNode = { kind: 'Schema', type: 'ipv4' }
1536
- * ```
1702
+ * Printers are responsible for sorting (`required` → `optional` → `defaulted`).
1703
+ * Nodes are plain immutable data.
1704
+ *
1705
+ * Renders differently depending on the output mode:
1706
+ * - `declaration` → `(id: string, config: Config = {})` — function declaration parameters
1707
+ * - `call` → `(id, { method, url })` — function call arguments
1708
+ * - `keys` → `{ id, config }` — key names only (for destructuring)
1709
+ * - `values` → `{ id: id, config: config }` — key → value pairs
1537
1710
  */
1538
- type Ipv4SchemaNode = SchemaNodeBase & {
1711
+ type FunctionParametersNode = BaseNode & {
1539
1712
  /**
1540
- * Schema type discriminator.
1713
+ * Node kind.
1541
1714
  */
1542
- type: 'ipv4';
1543
- };
1544
- /**
1545
- * IPv6 address schema node.
1546
- *
1547
- * @example
1548
- * ```ts
1549
- * const ipv6Schema: Ipv6SchemaNode = { kind: 'Schema', type: 'ipv6' }
1550
- * ```
1551
- */
1552
- type Ipv6SchemaNode = SchemaNodeBase & {
1715
+ kind: 'FunctionParameters';
1553
1716
  /**
1554
- * Schema type discriminator.
1717
+ * Ordered parameter nodes.
1555
1718
  */
1556
- type: 'ipv6';
1719
+ params: ReadonlyArray<FunctionParameterNode | ParameterGroupNode>;
1557
1720
  };
1558
1721
  /**
1559
- * Mapping from schema type literals to concrete schema node types.
1560
- * Used by `narrowSchema`.
1722
+ * Union of all function-parameter AST node variants used by the function-parameter printer.
1561
1723
  */
1562
- type SchemaNodeByType = {
1563
- object: ObjectSchemaNode;
1564
- array: ArraySchemaNode;
1565
- tuple: ArraySchemaNode;
1566
- union: UnionSchemaNode;
1567
- intersection: IntersectionSchemaNode;
1568
- enum: EnumSchemaNode;
1569
- ref: RefSchemaNode;
1570
- datetime: DatetimeSchemaNode;
1571
- date: DateSchemaNode;
1572
- time: TimeSchemaNode;
1573
- string: StringSchemaNode;
1574
- number: NumberSchemaNode;
1575
- integer: NumberSchemaNode;
1576
- bigint: NumberSchemaNode;
1577
- boolean: ScalarSchemaNode;
1578
- null: ScalarSchemaNode;
1579
- any: ScalarSchemaNode;
1580
- unknown: ScalarSchemaNode;
1581
- void: ScalarSchemaNode;
1582
- never: ScalarSchemaNode;
1583
- uuid: FormatStringSchemaNode;
1584
- email: FormatStringSchemaNode;
1585
- url: UrlSchemaNode;
1586
- ipv4: Ipv4SchemaNode;
1587
- ipv6: Ipv6SchemaNode;
1588
- blob: ScalarSchemaNode;
1589
- };
1724
+ type FunctionParamNode = FunctionParameterNode | ParameterGroupNode | FunctionParametersNode | ParamsTypeNode;
1590
1725
  /**
1591
- * Union of all schema node types.
1726
+ * Handler map keys one per `FunctionParamNode` kind.
1592
1727
  */
1593
- type SchemaNode = ObjectSchemaNode | ArraySchemaNode | UnionSchemaNode | IntersectionSchemaNode | EnumSchemaNode | RefSchemaNode | DatetimeSchemaNode | DateSchemaNode | TimeSchemaNode | StringSchemaNode | NumberSchemaNode | UrlSchemaNode | FormatStringSchemaNode | Ipv4SchemaNode | Ipv6SchemaNode | ScalarSchemaNode;
1728
+ type FunctionNodeType = 'functionParameter' | 'parameterGroup' | 'functionParameters' | 'paramsType';
1594
1729
  //#endregion
1595
1730
  //#region src/nodes/parameter.d.ts
1596
1731
  type ParameterLocation = 'path' | 'query' | 'header' | 'cookie';
@@ -1704,59 +1839,66 @@ type ResponseNode = BaseNode & {
1704
1839
  * response.content[1].contentType // 'application/xml'
1705
1840
  * ```
1706
1841
  */
1707
- content?: Array<{
1708
- /**
1709
- * The content type for this entry (e.g. `'application/json'`).
1710
- */
1711
- contentType: string;
1712
- /**
1713
- * Response body schema for this content type.
1714
- */
1715
- schema?: SchemaNode;
1716
- /**
1717
- * Property keys to exclude from the generated type via `Omit<Type, Keys>`.
1718
- * Set when a referenced schema has `writeOnly` fields that should not appear in response types.
1719
- */
1720
- keysToOmit?: Array<string> | null;
1721
- }>;
1842
+ content?: Array<ContentNode>;
1722
1843
  };
1723
1844
  //#endregion
1724
1845
  //#region src/nodes/operation.d.ts
1725
1846
  type HttpMethod = 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE' | 'HEAD' | 'OPTIONS' | 'TRACE';
1726
1847
  /**
1727
- * AST node representing one API operation.
1848
+ * Transport an operation belongs to.
1849
+ */
1850
+ type OperationProtocol = 'http';
1851
+ /**
1852
+ * AST node representing an operation request body.
1853
+ *
1854
+ * Body schemas live exclusively inside the `content` array (one entry per content type),
1855
+ * mirroring {@link ResponseNode}.
1728
1856
  *
1729
1857
  * @example
1730
1858
  * ```ts
1731
- * const operation: OperationNode = {
1732
- * kind: 'Operation',
1733
- * operationId: 'listPets',
1734
- * method: 'GET',
1735
- * path: '/pets',
1736
- * tags: [],
1737
- * parameters: [],
1738
- * responses: [],
1859
+ * const requestBody: RequestBodyNode = {
1860
+ * kind: 'RequestBody',
1861
+ * required: true,
1862
+ * content: [{ kind: 'Content', contentType: 'application/json', schema: createSchema({ type: 'string' }) }],
1739
1863
  * }
1740
1864
  * ```
1741
1865
  */
1742
- type OperationNode = BaseNode & {
1866
+ type RequestBodyNode = BaseNode & {
1743
1867
  /**
1744
1868
  * Node kind.
1745
1869
  */
1746
- kind: 'Operation';
1870
+ kind: 'RequestBody';
1747
1871
  /**
1748
- * Operation identifier, usually from OpenAPI `operationId`.
1872
+ * Human-readable request body description.
1749
1873
  */
1750
- operationId: string;
1874
+ description?: string;
1751
1875
  /**
1752
- * HTTP Method like 'GET'
1876
+ * Whether the request body is required (`requestBody.required: true` in the spec).
1877
+ * When `false` or absent, the generated `data` parameter should be optional.
1753
1878
  */
1754
- method: HttpMethod;
1879
+ required?: boolean;
1755
1880
  /**
1756
- * OpenAPI-style path string, for example `/pets/{petId}`.
1757
- * Path parameters retain the `{param}` notation from the original spec.
1881
+ * All available content type entries for this request body.
1882
+ *
1883
+ * When the adapter `contentType` option is set, this array contains exactly one entry for
1884
+ * that content type. Otherwise it contains one entry per content type declared in the spec,
1885
+ * so that plugins can generate code for every variant (e.g. separate hooks for
1886
+ * `application/json` and `multipart/form-data`).
1758
1887
  */
1759
- path: string;
1888
+ content?: Array<ContentNode>;
1889
+ };
1890
+ /**
1891
+ * Fields shared by every operation, regardless of transport.
1892
+ */
1893
+ type OperationNodeBase = BaseNode & {
1894
+ /**
1895
+ * Node kind.
1896
+ */
1897
+ kind: 'Operation';
1898
+ /**
1899
+ * Operation identifier, usually from OpenAPI `operationId`.
1900
+ */
1901
+ operationId: string;
1760
1902
  /**
1761
1903
  * Group labels for the operation.
1762
1904
  * Usually copied from OpenAPI `tags`.
@@ -1779,54 +1921,64 @@ type OperationNode = BaseNode & {
1779
1921
  */
1780
1922
  parameters: Array<ParameterNode>;
1781
1923
  /**
1782
- * Request body metadata for the operation.
1924
+ * Request body for the operation.
1783
1925
  */
1784
- requestBody?: {
1785
- /**
1786
- * Human-readable request body description.
1787
- */
1788
- description?: string;
1789
- /**
1790
- * Whether the request body is required (`requestBody.required: true` in the spec).
1791
- * When `false` or absent, the generated `data` parameter should be optional.
1792
- */
1793
- required?: boolean;
1794
- /**
1795
- * All available content type entries for this request body.
1796
- *
1797
- * When the adapter `contentType` option is set, this array contains exactly one entry for
1798
- * that content type. Otherwise it contains one entry per content type declared in the spec,
1799
- * so that plugins can generate code for every variant (e.g. separate hooks for
1800
- * `application/json` and `multipart/form-data`).
1801
- *
1802
- * @example
1803
- * ```ts
1804
- * // spec has both application/json and multipart/form-data
1805
- * requestBody.content[0].contentType // 'application/json'
1806
- * requestBody.content[1].contentType // 'multipart/form-data'
1807
- * ```
1808
- */
1809
- content?: Array<{
1810
- /**
1811
- * The content type for this entry (e.g. `'application/json'`).
1812
- */
1813
- contentType: string;
1814
- /**
1815
- * Request body schema for this content type.
1816
- */
1817
- schema?: SchemaNode;
1818
- /**
1819
- * Property keys to exclude from the generated request body type via `Omit<Type, Keys>`.
1820
- * Set when a referenced schema has `readOnly` fields that should be omitted in request types.
1821
- */
1822
- keysToOmit?: Array<string> | null;
1823
- }>;
1824
- };
1926
+ requestBody?: RequestBodyNode;
1825
1927
  /**
1826
1928
  * Operation responses.
1827
1929
  */
1828
1930
  responses: Array<ResponseNode>;
1829
1931
  };
1932
+ /**
1933
+ * Operation served over HTTP/REST (OpenAPI). `method` and `path` are guaranteed.
1934
+ *
1935
+ * @example
1936
+ * ```ts
1937
+ * const operation: HttpOperationNode = {
1938
+ * kind: 'Operation',
1939
+ * operationId: 'listPets',
1940
+ * protocol: 'http',
1941
+ * method: 'GET',
1942
+ * path: '/pets',
1943
+ * tags: [],
1944
+ * parameters: [],
1945
+ * responses: [],
1946
+ * }
1947
+ * ```
1948
+ */
1949
+ type HttpOperationNode = OperationNodeBase & {
1950
+ /**
1951
+ * Transport the operation belongs to.
1952
+ */
1953
+ protocol?: 'http';
1954
+ /**
1955
+ * HTTP method like `'GET'`.
1956
+ */
1957
+ method: HttpMethod;
1958
+ /**
1959
+ * OpenAPI-style path string, for example `/pets/{petId}`, with `{param}` notation preserved.
1960
+ */
1961
+ path: string;
1962
+ };
1963
+ /**
1964
+ * Operation for a non-HTTP transport. HTTP-only fields are forbidden.
1965
+ */
1966
+ type GenericOperationNode = OperationNodeBase & {
1967
+ /**
1968
+ * Transport the operation belongs to.
1969
+ */
1970
+ protocol?: Exclude<OperationProtocol, 'http'>;
1971
+ method?: never;
1972
+ path?: never;
1973
+ };
1974
+ /**
1975
+ * AST node representing one API operation.
1976
+ *
1977
+ * Discriminated on `protocol`: an {@link HttpOperationNode} (`protocol: 'http'`) guarantees
1978
+ * `method` and `path`, while a {@link GenericOperationNode} omits them. Narrow with
1979
+ * `isHttpOperationNode(node)` or `node.protocol === 'http'` before reading `method`/`path`.
1980
+ */
1981
+ type OperationNode = HttpOperationNode | GenericOperationNode;
1830
1982
  //#endregion
1831
1983
  //#region src/nodes/output.d.ts
1832
1984
  /**
@@ -1995,7 +2147,7 @@ type InputStreamNode = {
1995
2147
  * }
1996
2148
  * ```
1997
2149
  */
1998
- type Node = InputNode | OutputNode | OperationNode | SchemaNode | PropertyNode | ParameterNode | ResponseNode | FunctionParamNode | FileNode | ImportNode | ExportNode | SourceNode | ConstNode | TypeNode | ParamsTypeNode | FunctionNode | ArrowFunctionNode;
2150
+ type Node = InputNode | OutputNode | OperationNode | SchemaNode | PropertyNode | ParameterNode | ResponseNode | RequestBodyNode | ContentNode | FunctionParamNode | FileNode | ImportNode | ExportNode | SourceNode | ConstNode | TypeNode | ParamsTypeNode | FunctionNode | ArrowFunctionNode;
1999
2151
  //#endregion
2000
2152
  //#region src/infer.d.ts
2001
2153
  /**
@@ -2172,6 +2324,23 @@ declare function syncOptionality(schema: SchemaNode, required: boolean): SchemaN
2172
2324
  * ```
2173
2325
  */
2174
2326
  type DistributiveOmit<T, K extends PropertyKey> = T extends unknown ? Omit<T, K> : never;
2327
+ /**
2328
+ * Identity-preserving node update: returns `node` unchanged when every field in
2329
+ * `changes` already equals (by reference) the current value, otherwise a new node
2330
+ * with the changes applied.
2331
+ *
2332
+ * Mirrors the TypeScript compiler's `factory.updateX` contract — pair it with the
2333
+ * structural sharing in {@link transform} so a no-op rewrite doesn't allocate and
2334
+ * downstream passes can detect "nothing changed" by identity. Comparison is
2335
+ * shallow: a structurally-equal but newly-allocated array/object counts as a change.
2336
+ *
2337
+ * @example
2338
+ * ```ts
2339
+ * update(node, { name: node.name }) // -> same `node` reference
2340
+ * update(node, { name: 'renamed' }) // -> new node, `name` replaced
2341
+ * ```
2342
+ */
2343
+ declare function update<T extends Node>(node: T, changes: Partial<T>): T;
2175
2344
  type CreateSchemaObjectInput = Omit<ObjectSchemaNode, 'kind' | 'properties' | 'primitive'> & {
2176
2345
  properties?: Array<PropertyNode>;
2177
2346
  primitive?: 'object';
@@ -2243,7 +2412,30 @@ declare function createOutput(overrides?: Partial<Omit<OutputNode, 'kind'>>): Ou
2243
2412
  * })
2244
2413
  * ```
2245
2414
  */
2246
- declare function createOperation(props: Pick<OperationNode, 'operationId' | 'method' | 'path'> & Partial<Omit<OperationNode, 'kind' | 'operationId' | 'method' | 'path'>>): OperationNode;
2415
+ /**
2416
+ * Loosely-typed content entry accepted by the builders, normalized into a {@link ContentNode}.
2417
+ */
2418
+ type UserContent = Omit<ContentNode, 'kind'>;
2419
+ /**
2420
+ * Creates a `ContentNode` for a single request-body or response content type.
2421
+ */
2422
+ declare function createContent(props: UserContent): ContentNode;
2423
+ /**
2424
+ * Loosely-typed request body accepted by `createOperation`, normalized into a {@link RequestBodyNode}.
2425
+ */
2426
+ type UserRequestBody = Omit<RequestBodyNode, 'kind' | 'content'> & {
2427
+ content?: Array<UserContent>;
2428
+ };
2429
+ /**
2430
+ * Creates a `RequestBodyNode`, normalizing each content entry into a `ContentNode`.
2431
+ */
2432
+ declare function createRequestBody(props: UserRequestBody): RequestBodyNode;
2433
+ declare function createOperation(props: Pick<HttpOperationNode, 'operationId' | 'method' | 'path'> & Partial<Omit<HttpOperationNode, 'kind' | 'operationId' | 'method' | 'path' | 'requestBody'>> & {
2434
+ requestBody?: UserRequestBody;
2435
+ }): HttpOperationNode;
2436
+ declare function createOperation(props: Pick<GenericOperationNode, 'operationId'> & Partial<Omit<GenericOperationNode, 'kind' | 'operationId' | 'requestBody'>> & {
2437
+ requestBody?: UserRequestBody;
2438
+ }): GenericOperationNode;
2247
2439
  /**
2248
2440
  * Creates a `SchemaNode`, narrowed to the variant of `props.type`.
2249
2441
  * For object schemas, `properties` defaults to an empty array.
@@ -2347,7 +2539,8 @@ declare function createParameter(props: Pick<ParameterNode, 'name' | 'in' | 'sch
2347
2539
  * })
2348
2540
  * ```
2349
2541
  */
2350
- declare function createResponse(props: Pick<ResponseNode, 'statusCode'> & Partial<Omit<ResponseNode, 'kind' | 'statusCode'>> & {
2542
+ declare function createResponse(props: Pick<ResponseNode, 'statusCode'> & Partial<Omit<ResponseNode, 'kind' | 'statusCode' | 'content'>> & {
2543
+ content?: Array<UserContent>;
2351
2544
  schema?: SchemaNode;
2352
2545
  mediaType?: string | null;
2353
2546
  keysToOmit?: Array<string> | null;
@@ -2740,6 +2933,17 @@ declare const isOutputNode: (node: unknown) => node is OutputNode;
2740
2933
  * ```
2741
2934
  */
2742
2935
  declare const isOperationNode: (node: unknown) => node is OperationNode;
2936
+ /**
2937
+ * Narrows an `OperationNode` to an `HttpOperationNode`, guaranteeing `method` and `path`.
2938
+ *
2939
+ * @example
2940
+ * ```ts
2941
+ * if (isHttpOperationNode(node)) {
2942
+ * console.log(node.method, node.path)
2943
+ * }
2944
+ * ```
2945
+ */
2946
+ declare function isHttpOperationNode(node: OperationNode): node is HttpOperationNode;
2743
2947
  /**
2744
2948
  * Returns `true` when the input is a `SchemaNode`.
2745
2949
  *
@@ -3051,7 +3255,7 @@ declare function setEnumName(propNode: SchemaNode, parentName: string | null | u
3051
3255
  *
3052
3256
  * `ParentOf` uses this map to find parent types.
3053
3257
  */
3054
- type ParentNodeMap = [[InputNode, undefined], [OutputNode, undefined], [OperationNode, InputNode], [SchemaNode, InputNode | OperationNode | SchemaNode | PropertyNode | ParameterNode | ResponseNode], [PropertyNode, SchemaNode], [ParameterNode, OperationNode], [ResponseNode, OperationNode]];
3258
+ type ParentNodeMap = [[InputNode, undefined], [OutputNode, undefined], [OperationNode, InputNode], [RequestBodyNode, OperationNode], [ContentNode, RequestBodyNode | ResponseNode], [SchemaNode, InputNode | ContentNode | SchemaNode | PropertyNode | ParameterNode], [PropertyNode, SchemaNode], [ParameterNode, OperationNode], [ResponseNode, OperationNode]];
3055
3259
  /**
3056
3260
  * Resolves the parent node type for a given AST node type.
3057
3261
  *
@@ -3550,5 +3754,5 @@ declare function containsCircularRef(node: SchemaNode | undefined, {
3550
3754
  excludeName?: string;
3551
3755
  }): boolean;
3552
3756
  //#endregion
3553
- export { type ArraySchemaNode, type ArrowFunctionNode, AsyncVisitor, type BaseNode, type BreakNode, type CodeNode, CollectOptions, CollectVisitor, type ComplexSchemaType, type ConstNode, type DateSchemaNode, type DatetimeSchemaNode, DistributiveOmit, type EnumSchemaNode, type EnumValueNode, type ExportNode, type FileNode, type FormatStringSchemaNode, type FunctionNode, type FunctionNodeType, type FunctionParamNode, type FunctionParameterNode, type FunctionParametersNode, type HttpMethod, type HttpStatusCode, type ImportNode, InferSchema, InferSchemaNode, type InputMeta, type InputNode, type InputStreamNode, type IntersectionSchemaNode, type Ipv4SchemaNode, type Ipv6SchemaNode, type JSDocNode, type JsxNode, type MediaType, Node, type NodeKind, type NumberSchemaNode, type ObjectSchemaNode, type OperationNode, OperationParamsResolver, type OutputNode, type ParameterGroupNode, type ParameterLocation, type ParameterNode, type ParamsTypeNode, ParentOf, ParserOptions, type PrimitiveSchemaType, Printer, PrinterFactoryOptions, PrinterPartial, type PropertyNode, RefMap, type RefSchemaNode, type ResponseNode, ScalarPrimitive, type ScalarSchemaNode, type ScalarSchemaType, type SchemaNode, type SchemaNodeByType, type SchemaType, type SourceNode, type SpecialSchemaType, type StatusCode, type StringSchemaNode, type TextNode, type TimeSchemaNode, TransformOptions, type TypeDeclarationNode, type TypeNode, type UnionSchemaNode, type UrlSchemaNode, UserFileNode, Visitor, VisitorContext, VisitorDepth, WalkOptions, caseParams, childName, collect, collectImports, collectLazy, collectReferencedSchemaNames, collectUsedSchemaNames, containsCircularRef, createArrowFunction, createBreak, createConst, createDiscriminantNode, createExport, createFile, createFunction, createFunctionParameter, createFunctionParameters, createImport, createInput, createJsx, createOperation, createOperationParams, createOutput, createParameter, createParameterGroup, createParamsType, createPrinterFactory, createProperty, createResponse, createSchema, createSource, createStreamInput, createText, createType, definePrinter, enumPropName, extractRefName, extractStringsFromNodes, findCircularSchemas, findDiscriminator, httpMethods, isInputNode, isOperationNode, isOutputNode, isScalarPrimitive, isSchemaNode, isStringType, mediaTypes, mergeAdjacentObjects, mergeAdjacentObjectsLazy, narrowSchema, nodeKinds, resolveRefName, schemaTypes, setDiscriminatorEnum, setEnumName, simplifyUnion, syncOptionality, syncSchemaRef, transform, walk };
3757
+ export { type ArraySchemaNode, type ArrowFunctionNode, AsyncVisitor, type BaseNode, type BreakNode, type CodeNode, CollectOptions, CollectVisitor, type ComplexSchemaType, type ConstNode, type DateSchemaNode, type DatetimeSchemaNode, DispatchRule, DistributiveOmit, type EnumSchemaNode, type EnumValueNode, type ExportNode, type FileNode, type FormatStringSchemaNode, type FunctionNode, type FunctionNodeType, type FunctionParamNode, type FunctionParameterNode, type FunctionParametersNode, type GenericOperationNode, type HttpMethod, type HttpOperationNode, type HttpStatusCode, type ImportNode, InferSchema, InferSchemaNode, type InputMeta, type InputNode, type InputStreamNode, type IntersectionSchemaNode, type Ipv4SchemaNode, type Ipv6SchemaNode, type JSDocNode, type JsxNode, type MediaType, Node, type NodeKind, type NumberSchemaNode, type ObjectSchemaNode, type OperationNode, type OperationNodeBase, OperationParamsResolver, type OperationProtocol, type OutputNode, type ParameterGroupNode, type ParameterLocation, type ParameterNode, type ParamsTypeNode, ParentOf, ParserOptions, type PrimitiveSchemaType, Printer, PrinterFactoryOptions, PrinterPartial, type PropertyNode, RefMap, type RefSchemaNode, type ResponseNode, ScalarPrimitive, type ScalarSchemaNode, type ScalarSchemaType, SchemaDialect, type SchemaNode, type SchemaNodeByType, type SchemaType, type SourceNode, type SpecialSchemaType, type StatusCode, type StringSchemaNode, type TextNode, type TimeSchemaNode, TransformOptions, type TypeDeclarationNode, type TypeNode, type UnionSchemaNode, type UrlSchemaNode, UserFileNode, Visitor, VisitorContext, VisitorDepth, WalkOptions, caseParams, childName, collect, collectImports, collectLazy, collectReferencedSchemaNames, collectUsedSchemaNames, containsCircularRef, createArrowFunction, createBreak, createConst, createContent, createDiscriminantNode, createExport, createFile, createFunction, createFunctionParameter, createFunctionParameters, createImport, createInput, createJsx, createOperation, createOperationParams, createOutput, createParameter, createParameterGroup, createParamsType, createPrinterFactory, createProperty, createRequestBody, createResponse, createSchema, createSource, createStreamInput, createText, createType, definePrinter, defineSchemaDialect, dispatch, enumPropName, extractRefName, extractStringsFromNodes, findCircularSchemas, findDiscriminator, httpMethods, isHttpOperationNode, isInputNode, isOperationNode, isOutputNode, isScalarPrimitive, isSchemaNode, isStringType, mediaTypes, mergeAdjacentObjects, mergeAdjacentObjectsLazy, narrowSchema, nodeKinds, resolveRefName, schemaTypes, setDiscriminatorEnum, setEnumName, simplifyUnion, syncOptionality, syncSchemaRef, transform, update, walk };
3554
3758
  //# sourceMappingURL=index.d.ts.map