@kubb/ast 5.22.0 → 5.23.1

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.
Files changed (155) hide show
  1. package/dist/base-IpYuh3ZP.d.cts +173 -0
  2. package/dist/base-IpYuh3ZP.d.ts +173 -0
  3. package/dist/constants-Ckeonm-D.js +141 -0
  4. package/dist/constants-Ckeonm-D.js.map +1 -0
  5. package/dist/constants-CquR083U.cjs +152 -0
  6. package/dist/constants-CquR083U.cjs.map +1 -0
  7. package/dist/factory.cjs +23 -0
  8. package/dist/factory.d.cts +4 -0
  9. package/dist/factory.d.ts +4 -0
  10. package/dist/factory.js +4 -0
  11. package/dist/file-BVqSiSvV.d.cts +624 -0
  12. package/dist/file-Cg0T6cgz.cjs +319 -0
  13. package/dist/file-Cg0T6cgz.cjs.map +1 -0
  14. package/dist/file-CnuL8oUj.js +283 -0
  15. package/dist/file-CnuL8oUj.js.map +1 -0
  16. package/dist/file-CvlMAp_d.js +131 -0
  17. package/dist/file-CvlMAp_d.js.map +1 -0
  18. package/dist/file-Dd50jPkH.cjs +142 -0
  19. package/dist/file-Dd50jPkH.cjs.map +1 -0
  20. package/dist/file-xJnBQPGq.d.ts +624 -0
  21. package/dist/file.cjs +3 -0
  22. package/dist/file.d.cts +2 -0
  23. package/dist/file.d.ts +2 -0
  24. package/dist/file.js +1 -0
  25. package/dist/graph-BcwFCvei.js +144 -0
  26. package/dist/graph-BcwFCvei.js.map +1 -0
  27. package/dist/graph-DcIY6tQb.cjs +173 -0
  28. package/dist/graph-DcIY6tQb.cjs.map +1 -0
  29. package/dist/graph.cjs +6 -0
  30. package/dist/graph.d.cts +2 -0
  31. package/dist/graph.d.ts +2 -0
  32. package/dist/graph.js +1 -0
  33. package/dist/guards-B8qDgSaT.d.cts +23 -0
  34. package/dist/guards-COVJE6TU.cjs +41 -0
  35. package/dist/guards-COVJE6TU.cjs.map +1 -0
  36. package/dist/guards-D-h9R_sV.d.ts +23 -0
  37. package/dist/guards-DlJkKsT1.js +30 -0
  38. package/dist/guards-DlJkKsT1.js.map +1 -0
  39. package/dist/http-Bm5lhVK4.cjs +12 -0
  40. package/dist/http-Bm5lhVK4.cjs.map +1 -0
  41. package/dist/http-DwboM6pK.js +7 -0
  42. package/dist/http-DwboM6pK.js.map +1 -0
  43. package/dist/http.cjs +4 -0
  44. package/dist/http.d.cts +3 -0
  45. package/dist/http.d.ts +3 -0
  46. package/dist/http.js +2 -0
  47. package/dist/index-BWd95onW.d.cts +5 -0
  48. package/dist/index-Bb1kqq8H.d.cts +20 -0
  49. package/dist/index-BngGJux5.d.cts +12 -0
  50. package/dist/index-BwnMIoLl.d.ts +24 -0
  51. package/dist/index-C-vhkzwR.d.cts +79 -0
  52. package/dist/index-CAGuKv6t.d.ts +74 -0
  53. package/dist/index-CFH4ZC7q.d.ts +44 -0
  54. package/dist/index-CIqwy4EE.d.cts +74 -0
  55. package/dist/index-Cc2K3OzU.d.cts +11 -0
  56. package/dist/index-Cc2K3OzU.d.ts +11 -0
  57. package/dist/index-Csf8xsCc.d.cts +46 -0
  58. package/dist/index-D3M2spDR.d.ts +12 -0
  59. package/dist/index-DNiIem0x.d.ts +79 -0
  60. package/dist/index-DSVef1pp.d.cts +24 -0
  61. package/dist/index-DU_jYpBt.d.cts +44 -0
  62. package/dist/index-DYDha-3I.d.cts +67 -0
  63. package/dist/index-DaHsMJ_S.d.ts +5 -0
  64. package/dist/index-Dp50LM3a.d.ts +67 -0
  65. package/dist/index-cpjUxIik.d.ts +46 -0
  66. package/dist/index-eGkM4FE9.d.ts +20 -0
  67. package/dist/index.cjs +87 -2131
  68. package/dist/index.cjs.map +1 -1
  69. package/dist/index.d.cts +25 -2745
  70. package/dist/index.d.ts +25 -2745
  71. package/dist/index.js +40 -2052
  72. package/dist/index.js.map +1 -1
  73. package/dist/json-DH7_lcWm.js +74 -0
  74. package/dist/json-DH7_lcWm.js.map +1 -0
  75. package/dist/json-DURdtz9A.cjs +91 -0
  76. package/dist/json-DURdtz9A.cjs.map +1 -0
  77. package/dist/json.cjs +4 -0
  78. package/dist/json.d.cts +2 -0
  79. package/dist/json.d.ts +2 -0
  80. package/dist/json.js +1 -0
  81. package/dist/macro-D0KfNtff.js +104 -0
  82. package/dist/macro-D0KfNtff.js.map +1 -0
  83. package/dist/macro-DrTBT7fh.cjs +127 -0
  84. package/dist/macro-DrTBT7fh.cjs.map +1 -0
  85. package/dist/macro.cjs +4 -0
  86. package/dist/macro.d.cts +2 -0
  87. package/dist/macro.d.ts +2 -0
  88. package/dist/macro.js +1 -0
  89. package/dist/mediaType-CRjggmoG.js +19 -0
  90. package/dist/mediaType-CRjggmoG.js.map +1 -0
  91. package/dist/mediaType-D8uIO8sG.cjs +35 -0
  92. package/dist/mediaType-D8uIO8sG.cjs.map +1 -0
  93. package/dist/mediaType.cjs +4 -0
  94. package/dist/mediaType.d.cts +2 -0
  95. package/dist/mediaType.d.ts +2 -0
  96. package/dist/mediaType.js +1 -0
  97. package/dist/node-DjcETnc8.cjs +19 -0
  98. package/dist/node-DjcETnc8.cjs.map +1 -0
  99. package/dist/node-Djh-mZB2.js +14 -0
  100. package/dist/node-Djh-mZB2.js.map +1 -0
  101. package/dist/node.cjs +9 -0
  102. package/dist/node.d.cts +4 -0
  103. package/dist/node.d.ts +4 -0
  104. package/dist/node.js +5 -0
  105. package/dist/nodeText-DRb_rVd1.cjs +58 -0
  106. package/dist/nodeText-DRb_rVd1.cjs.map +1 -0
  107. package/dist/nodeText-DVVDZQjF.js +47 -0
  108. package/dist/nodeText-DVVDZQjF.js.map +1 -0
  109. package/dist/nodes-BB60Bq2H.cjs +320 -0
  110. package/dist/nodes-BB60Bq2H.cjs.map +1 -0
  111. package/dist/nodes-CWMa9xhW.js +231 -0
  112. package/dist/nodes-CWMa9xhW.js.map +1 -0
  113. package/dist/operation-BgRyVS7z.d.ts +1272 -0
  114. package/dist/operation-X7chCdL2.d.cts +1272 -0
  115. package/dist/optionality-D-zqzVMH.cjs +22 -0
  116. package/dist/optionality-D-zqzVMH.cjs.map +1 -0
  117. package/dist/optionality-DISn8ytP.js +17 -0
  118. package/dist/optionality-DISn8ytP.js.map +1 -0
  119. package/dist/promise-BOdlgT0N.cjs +50 -0
  120. package/dist/promise-BOdlgT0N.cjs.map +1 -0
  121. package/dist/promise-RpnEev9D.js +45 -0
  122. package/dist/promise-RpnEev9D.js.map +1 -0
  123. package/dist/ref-Bu7PoHar.js +22 -0
  124. package/dist/ref-Bu7PoHar.js.map +1 -0
  125. package/dist/ref-P0ZLT1Bg.cjs +39 -0
  126. package/dist/ref-P0ZLT1Bg.cjs.map +1 -0
  127. package/dist/ref.cjs +7 -0
  128. package/dist/ref.d.cts +2 -0
  129. package/dist/ref.d.ts +2 -0
  130. package/dist/ref.js +3 -0
  131. package/dist/refs-CYHpRlQo.cjs +131 -0
  132. package/dist/refs-CYHpRlQo.cjs.map +1 -0
  133. package/dist/refs-YCV3CznS.js +102 -0
  134. package/dist/refs-YCV3CznS.js.map +1 -0
  135. package/dist/rolldown-runtime-BV8xUvPy.cjs +52 -0
  136. package/dist/rolldown-runtime-BYyVTPww.js +16 -0
  137. package/dist/schema-2ZAQk7qE.js +44 -0
  138. package/dist/schema-2ZAQk7qE.js.map +1 -0
  139. package/dist/schema-BIErWqgc.cjs +214 -0
  140. package/dist/schema-BIErWqgc.cjs.map +1 -0
  141. package/dist/schema-DloctnMm.js +179 -0
  142. package/dist/schema-DloctnMm.js.map +1 -0
  143. package/dist/schema-hxMlgCrV.cjs +49 -0
  144. package/dist/schema-hxMlgCrV.cjs.map +1 -0
  145. package/dist/schema.cjs +16 -0
  146. package/dist/schema.d.cts +5 -0
  147. package/dist/schema.d.ts +5 -0
  148. package/dist/schema.js +6 -0
  149. package/dist/visitor-BZozlXBF.d.ts +179 -0
  150. package/dist/visitor-Bw_opzjF.d.cts +179 -0
  151. package/dist/visitor-DTrzvA3R.cjs +382 -0
  152. package/dist/visitor-DTrzvA3R.cjs.map +1 -0
  153. package/dist/visitor-NoQSUQTu.js +347 -0
  154. package/dist/visitor-NoQSUQTu.js.map +1 -0
  155. package/package.json +101 -1
@@ -0,0 +1,1272 @@
1
+ import { n as DistributiveOmit, t as BaseNode } from "./base-IpYuh3ZP.cjs";
2
+ /**
3
+ * AST node representing one named object property.
4
+ *
5
+ * @example
6
+ * ```ts
7
+ * const property: PropertyNode = {
8
+ * kind: 'Property',
9
+ * name: 'id',
10
+ * schema: createSchema({ type: 'integer' }),
11
+ * required: true,
12
+ * }
13
+ * ```
14
+ */
15
+ type PropertyNode = BaseNode & {
16
+ kind: 'Property';
17
+ /**
18
+ * Property key.
19
+ */
20
+ name: string;
21
+ /**
22
+ * Property schema.
23
+ */
24
+ schema: SchemaNode;
25
+ /**
26
+ * Whether the property is required.
27
+ */
28
+ required: boolean;
29
+ };
30
+ /**
31
+ * Loosely-typed property accepted by `createProperty`, with `required` optional.
32
+ */
33
+ type UserPropertyNode = Pick<PropertyNode, 'name' | 'schema'> & Partial<Omit<PropertyNode, 'kind' | 'name' | 'schema'>>;
34
+ /**
35
+ * Creates a `PropertyNode`. `required` defaults to `false`, and the schema's
36
+ * `optional`/`nullish` flags are derived from it.
37
+ *
38
+ * @example
39
+ * ```ts
40
+ * const property = createProperty({
41
+ * name: 'status',
42
+ * required: true,
43
+ * schema: createSchema({ type: 'string', nullable: true }),
44
+ * })
45
+ * // required=true, no optional/nullish
46
+ * ```
47
+ */
48
+ declare function createProperty(input: UserPropertyNode): PropertyNode;
49
+ /**
50
+ * Subset of {@link SchemaType} covering the primitives plus `object`, `array`, and `date`; `schemaTypes` documents each.
51
+ */
52
+ type PrimitiveSchemaType = 'string' | 'number' | 'integer' | 'bigint' | 'boolean' | 'null' | 'any' | 'unknown' | 'void' | 'never' | 'object' | 'array' | 'date';
53
+ /**
54
+ * All schema type strings, one per key of {@link SchemaNodeByType}.
55
+ */
56
+ type SchemaType = keyof SchemaNodeByType;
57
+ /**
58
+ * Scalar schema types without extra object/array/ref structure or constraints.
59
+ */
60
+ type ScalarSchemaType = 'boolean' | 'null' | 'any' | 'unknown' | 'void' | 'never' | 'blob' | 'ipv4' | 'ipv6';
61
+ /**
62
+ * Fields shared by all schema nodes.
63
+ */
64
+ type SchemaNodeBase = BaseNode & {
65
+ /**
66
+ * Node kind.
67
+ */
68
+ kind: 'Schema';
69
+ /**
70
+ * Schema name for named definitions (for example, `"Pet"`).
71
+ * Inline schemas omit this field.
72
+ * `null` means Kubb has processed this and determined there is no applicable name.
73
+ * `undefined` means the name has not been set yet.
74
+ */
75
+ name?: string | null;
76
+ /**
77
+ * Short schema title.
78
+ */
79
+ title?: string;
80
+ /**
81
+ * Schema description text.
82
+ */
83
+ description?: string;
84
+ /**
85
+ * Whether `null` is allowed.
86
+ */
87
+ nullable?: boolean;
88
+ /**
89
+ * Whether the field is optional.
90
+ */
91
+ optional?: boolean;
92
+ /**
93
+ * Both optional and nullable (`optional` + `nullable`).
94
+ */
95
+ nullish?: boolean;
96
+ /**
97
+ * Whether the schema is deprecated.
98
+ */
99
+ deprecated?: boolean;
100
+ /**
101
+ * Whether the schema is read-only.
102
+ */
103
+ readOnly?: boolean;
104
+ /**
105
+ * Whether the schema is write-only.
106
+ */
107
+ writeOnly?: boolean;
108
+ /**
109
+ * Default value.
110
+ */
111
+ default?: unknown;
112
+ /**
113
+ * Example values from an `examples` array.
114
+ */
115
+ examples?: Array<unknown>;
116
+ /**
117
+ * Base primitive type.
118
+ * For example, this is `'string'` for a `uuid` schema.
119
+ */
120
+ primitive?: PrimitiveSchemaType;
121
+ /**
122
+ * Schema `format` value.
123
+ */
124
+ format?: string;
125
+ externalDocs?: ExternalDocs;
126
+ /**
127
+ * `if`/`then`/`else`, `dependentRequired` and `dependentSchemas`. A required `unknown` property in `if` means "key is present".
128
+ * Visitors do not walk it.
129
+ */
130
+ conditionals?: Array<{
131
+ if: SchemaNode;
132
+ then?: SchemaNode;
133
+ else?: SchemaNode;
134
+ }>;
135
+ };
136
+ /**
137
+ * Object schema with ordered properties.
138
+ *
139
+ * @example
140
+ * ```ts
141
+ * const objectSchema: ObjectSchemaNode = {
142
+ * kind: 'Schema',
143
+ * type: 'object',
144
+ * properties: [],
145
+ * }
146
+ * ```
147
+ */
148
+ type ObjectSchemaNode = SchemaNodeBase & {
149
+ /**
150
+ * Schema type discriminator.
151
+ */
152
+ type: 'object';
153
+ /**
154
+ * Primitive type, always `'object'` for object schemas.
155
+ */
156
+ primitive: 'object';
157
+ /**
158
+ * Ordered object properties.
159
+ */
160
+ properties: Array<PropertyNode>;
161
+ /**
162
+ * Additional object properties behavior:
163
+ * - `true`: allow any value
164
+ * - `false`: reject unknown properties
165
+ * - `SchemaNode`: allow values that match that schema
166
+ * - `undefined`: no additional properties constraint (open object)
167
+ */
168
+ additionalProperties?: SchemaNode | boolean;
169
+ /**
170
+ * Pattern-based property schemas.
171
+ */
172
+ patternProperties?: Record<string, SchemaNode>;
173
+ /**
174
+ * Schema that each property name must match.
175
+ *
176
+ * @example
177
+ * ```ts
178
+ * const objectSchema: ObjectSchemaNode = {
179
+ * kind: 'Schema',
180
+ * type: 'object',
181
+ * primitive: 'object',
182
+ * properties: [],
183
+ * propertyNames: { kind: 'Schema', type: 'string', primitive: 'string', pattern: '^[a-z]+$' },
184
+ * }
185
+ * ```
186
+ */
187
+ propertyNames?: SchemaNode;
188
+ /**
189
+ * Minimum number of properties allowed.
190
+ */
191
+ min?: number;
192
+ /**
193
+ * Maximum number of properties allowed.
194
+ */
195
+ max?: number;
196
+ /**
197
+ * @deprecated Use `min`. Removed in Kubb v6.
198
+ */
199
+ minProperties?: number;
200
+ /**
201
+ * @deprecated Use `max`. Removed in Kubb v6.
202
+ */
203
+ maxProperties?: number;
204
+ };
205
+ /**
206
+ * Array-like schema (`array` or `tuple`).
207
+ *
208
+ * @example
209
+ * ```ts
210
+ * const arraySchema: ArraySchemaNode = {
211
+ * kind: 'Schema',
212
+ * type: 'array',
213
+ * items: [],
214
+ * }
215
+ * ```
216
+ */
217
+ type ArraySchemaNode = SchemaNodeBase & {
218
+ /**
219
+ * Schema type discriminator (`array` or `tuple`).
220
+ */
221
+ type: 'array' | 'tuple';
222
+ /**
223
+ * Item schemas.
224
+ */
225
+ items?: Array<SchemaNode>;
226
+ /**
227
+ * Tuple rest-item schema for elements beyond positional `items`.
228
+ */
229
+ rest?: SchemaNode;
230
+ /**
231
+ * Minimum item count (or tuple length).
232
+ */
233
+ min?: number;
234
+ /**
235
+ * Maximum item count (or tuple length).
236
+ */
237
+ max?: number;
238
+ /**
239
+ * Whether all items must be unique.
240
+ */
241
+ unique?: boolean;
242
+ /**
243
+ * At least `min` (default 1) and at most `max` items match `schema`. Visitors do not walk `schema`.
244
+ */
245
+ contains?: {
246
+ schema: SchemaNode;
247
+ min?: number;
248
+ max?: number;
249
+ };
250
+ };
251
+ /**
252
+ * Shared shape for union and intersection schemas.
253
+ */
254
+ type CompositeSchemaNodeBase = SchemaNodeBase & {
255
+ /**
256
+ * Member schemas.
257
+ */
258
+ members?: Array<SchemaNode>;
259
+ };
260
+ /**
261
+ * Union schema, often from `oneOf` or `anyOf`.
262
+ *
263
+ * @example
264
+ * ```ts
265
+ * const unionSchema: UnionSchemaNode = {
266
+ * kind: 'Schema',
267
+ * type: 'union',
268
+ * members: [],
269
+ * }
270
+ * ```
271
+ */
272
+ type UnionSchemaNode = CompositeSchemaNodeBase & {
273
+ /**
274
+ * Schema type discriminator.
275
+ */
276
+ type: 'union';
277
+ /**
278
+ * Discriminator property name for a polymorphic union.
279
+ */
280
+ discriminatorPropertyName?: string;
281
+ /**
282
+ * How many union members must be valid.
283
+ * - `'one'`: exactly one member, from `oneOf`
284
+ * - `'any'`: any number of members, from `anyOf`
285
+ */
286
+ strategy?: 'one' | 'any';
287
+ };
288
+ /**
289
+ * Intersection schema, often from `allOf`.
290
+ *
291
+ * @example
292
+ * ```ts
293
+ * const intersectionSchema: IntersectionSchemaNode = {
294
+ * kind: 'Schema',
295
+ * type: 'intersection',
296
+ * members: [],
297
+ * }
298
+ * ```
299
+ */
300
+ type IntersectionSchemaNode = CompositeSchemaNodeBase & {
301
+ /**
302
+ * Schema type discriminator.
303
+ */
304
+ type: 'intersection';
305
+ };
306
+ /** Negation from `not`: the value must not match its single member. Printers that cannot express it return `null`. */
307
+ type NotSchemaNode = CompositeSchemaNodeBase & {
308
+ /** Schema type discriminator. */
309
+ type: 'not';
310
+ };
311
+ /**
312
+ * One named enum item.
313
+ */
314
+ type EnumValueNode = {
315
+ /**
316
+ * Enum item name.
317
+ */
318
+ name: string;
319
+ /**
320
+ * Enum item value.
321
+ */
322
+ value: string | number | boolean;
323
+ /**
324
+ * Primitive type of the enum value.
325
+ */
326
+ primitive: Extract<PrimitiveSchemaType, 'string' | 'number' | 'boolean'>;
327
+ /**
328
+ * Label for the enum item, taken from the `x-enumDescriptions` or
329
+ * `x-enum-descriptions` vendor extension. A printer can render it as
330
+ * a comment on the matching enum member.
331
+ */
332
+ description?: string;
333
+ };
334
+ /**
335
+ * Enum schema node.
336
+ *
337
+ * @example
338
+ * ```ts
339
+ * const enumSchema: EnumSchemaNode = {
340
+ * kind: 'Schema',
341
+ * type: 'enum',
342
+ * enumValues: ['a', 'b'],
343
+ * }
344
+ * ```
345
+ */
346
+ type EnumSchemaNode = SchemaNodeBase & {
347
+ /**
348
+ * Schema type discriminator.
349
+ */
350
+ type: 'enum';
351
+ /**
352
+ * Enum values in simple form.
353
+ */
354
+ enumValues?: Array<string | number | boolean | null>;
355
+ /**
356
+ * Enum values in named form.
357
+ * If present, this is used instead of `enumValues`.
358
+ */
359
+ namedEnumValues?: Array<EnumValueNode>;
360
+ };
361
+ /**
362
+ * Reference schema that points to another schema definition.
363
+ *
364
+ * @example
365
+ * ```ts
366
+ * const refSchema: RefSchemaNode = {
367
+ * kind: 'Schema',
368
+ * type: 'ref',
369
+ * ref: '#/components/schemas/Pet',
370
+ * }
371
+ * ```
372
+ */
373
+ type RefSchemaNode = SchemaNodeBase & {
374
+ /**
375
+ * Schema type discriminator.
376
+ */
377
+ type: 'ref';
378
+ /**
379
+ * Referenced schema name.
380
+ * `null` means Kubb has processed this and determined there is no applicable name.
381
+ */
382
+ name?: string | null;
383
+ /**
384
+ * Original `$ref` path, for example, `#/components/schemas/Order`.
385
+ * Used to resolve names later.
386
+ */
387
+ ref?: string;
388
+ /**
389
+ * Emitted name of the referenced schema when it differs from the pointer's last segment,
390
+ * for example after a collision rename (`Order` becomes `OrderSchema`) or a macro rename.
391
+ * Resolve display and import names through `ast.ref.getName`, which prefers this field and
392
+ * falls back to the pointer segment, then `name`.
393
+ */
394
+ targetName?: string;
395
+ /**
396
+ * Pattern copied from a sibling `pattern` field.
397
+ */
398
+ pattern?: string;
399
+ /**
400
+ * The fully-parsed schema this ref resolves to, so its structure (`primitive`, `properties`)
401
+ * can be read without following the reference. Populated during parsing when the
402
+ * definition resolves, `null` when it can't or the ref is circular, and `undefined` when
403
+ * resolution has not been attempted.
404
+ */
405
+ schema?: SchemaNode | null;
406
+ };
407
+ /**
408
+ * Datetime schema.
409
+ *
410
+ * @example
411
+ * ```ts
412
+ * const datetimeSchema: DatetimeSchemaNode = { kind: 'Schema', type: 'datetime' }
413
+ * ```
414
+ */
415
+ type DatetimeSchemaNode = SchemaNodeBase & {
416
+ /**
417
+ * Schema type discriminator.
418
+ */
419
+ type: 'datetime';
420
+ /**
421
+ * Whether the datetime includes a timezone offset (`dateType: 'stringOffset'`).
422
+ */
423
+ offset?: boolean;
424
+ /**
425
+ * Whether the datetime is local (no timezone, `dateType: 'stringLocal'`).
426
+ */
427
+ local?: boolean;
428
+ };
429
+ /**
430
+ * Shared base for `date` and `time` schemas.
431
+ */
432
+ type TemporalSchemaNodeBase<T extends 'date' | 'time'> = SchemaNodeBase & {
433
+ /**
434
+ * Schema type discriminator.
435
+ */
436
+ type: T;
437
+ /**
438
+ * Output representation in generated code.
439
+ */
440
+ representation: 'date' | 'string';
441
+ };
442
+ /**
443
+ * Date schema node.
444
+ *
445
+ * @example
446
+ * ```ts
447
+ * const dateSchema: DateSchemaNode = { kind: 'Schema', type: 'date', representation: 'string' }
448
+ * ```
449
+ */
450
+ type DateSchemaNode = TemporalSchemaNodeBase<'date'>;
451
+ /**
452
+ * Time schema node.
453
+ *
454
+ * @example
455
+ * ```ts
456
+ * const timeSchema: TimeSchemaNode = { kind: 'Schema', type: 'time', representation: 'string' }
457
+ * ```
458
+ */
459
+ type TimeSchemaNode = TemporalSchemaNodeBase<'time'>;
460
+ /**
461
+ * String schema node.
462
+ *
463
+ * @example
464
+ * ```ts
465
+ * const stringSchema: StringSchemaNode = { kind: 'Schema', type: 'string' }
466
+ * ```
467
+ */
468
+ type StringSchemaNode = SchemaNodeBase & {
469
+ /**
470
+ * Schema type discriminator.
471
+ */
472
+ type: 'string';
473
+ /**
474
+ * Minimum string length.
475
+ */
476
+ min?: number;
477
+ /**
478
+ * Maximum string length.
479
+ */
480
+ max?: number;
481
+ /**
482
+ * Regex pattern.
483
+ */
484
+ pattern?: string;
485
+ /**
486
+ * The value the string encodes, such as a JSON document or `base64` bytes. Visitors do not walk `schema`.
487
+ */
488
+ content?: {
489
+ mediaType?: string;
490
+ encoding?: string;
491
+ schema?: SchemaNode;
492
+ };
493
+ };
494
+ /**
495
+ * Numeric schema (`number`, `integer`, or `bigint`).
496
+ *
497
+ * @example
498
+ * ```ts
499
+ * const numberSchema: NumberSchemaNode = { kind: 'Schema', type: 'number' }
500
+ * ```
501
+ */
502
+ type NumberSchemaNode = SchemaNodeBase & {
503
+ /**
504
+ * Schema type discriminator.
505
+ */
506
+ type: 'number' | 'integer' | 'bigint';
507
+ /**
508
+ * Minimum value.
509
+ */
510
+ min?: number;
511
+ /**
512
+ * Maximum value.
513
+ */
514
+ max?: number;
515
+ /**
516
+ * Bounds the value may not equal: it must be greater than `min` and less than `max`.
517
+ */
518
+ exclusive?: {
519
+ min?: number;
520
+ max?: number;
521
+ };
522
+ /**
523
+ * @deprecated Use `exclusive.min`. Removed in Kubb v6.
524
+ */
525
+ exclusiveMinimum?: number;
526
+ /**
527
+ * @deprecated Use `exclusive.max`. Removed in Kubb v6.
528
+ */
529
+ exclusiveMaximum?: number;
530
+ /**
531
+ * The value must be a multiple of this number.
532
+ */
533
+ multipleOf?: number;
534
+ };
535
+ /**
536
+ * Scalar schema with no extra constraints.
537
+ *
538
+ * @example
539
+ * ```ts
540
+ * const anySchema: ScalarSchemaNode = { kind: 'Schema', type: 'any' }
541
+ * ```
542
+ */
543
+ type ScalarSchemaNode = SchemaNodeBase & {
544
+ /**
545
+ * Schema type discriminator.
546
+ */
547
+ type: ScalarSchemaType;
548
+ };
549
+ /**
550
+ * URL schema node.
551
+ * Can include a path template for template literal types.
552
+ *
553
+ * @example
554
+ * ```ts
555
+ * const urlSchema: UrlSchemaNode = { kind: 'Schema', type: 'url', path: '/pets/{petId}' }
556
+ * ```
557
+ */
558
+ type UrlSchemaNode = SchemaNodeBase & {
559
+ /**
560
+ * Schema type discriminator.
561
+ */
562
+ type: 'url';
563
+ /**
564
+ * Path template, for example, `'/pets/{petId}'`.
565
+ */
566
+ path?: string;
567
+ /**
568
+ * Minimum string length.
569
+ */
570
+ min?: number;
571
+ /**
572
+ * Maximum string length.
573
+ */
574
+ max?: number;
575
+ };
576
+ /**
577
+ * Format-string schema for string-based formats that support length constraints.
578
+ *
579
+ * @example
580
+ * ```ts
581
+ * const uuidSchema: FormatStringSchemaNode = { kind: 'Schema', type: 'uuid', min: 36, max: 36 }
582
+ * ```
583
+ */
584
+ type FormatStringSchemaNode = SchemaNodeBase & {
585
+ /**
586
+ * Schema type discriminator.
587
+ */
588
+ type: 'uuid' | 'email';
589
+ /**
590
+ * Minimum string length.
591
+ */
592
+ min?: number;
593
+ /**
594
+ * Maximum string length.
595
+ */
596
+ max?: number;
597
+ };
598
+ /**
599
+ * Mapping from schema type literals to concrete schema node types.
600
+ * Used by `narrowSchema`.
601
+ */
602
+ type SchemaNodeByType = {
603
+ object: ObjectSchemaNode;
604
+ array: ArraySchemaNode;
605
+ tuple: ArraySchemaNode;
606
+ union: UnionSchemaNode;
607
+ intersection: IntersectionSchemaNode;
608
+ not: NotSchemaNode;
609
+ enum: EnumSchemaNode;
610
+ ref: RefSchemaNode;
611
+ datetime: DatetimeSchemaNode;
612
+ date: DateSchemaNode;
613
+ time: TimeSchemaNode;
614
+ string: StringSchemaNode;
615
+ number: NumberSchemaNode;
616
+ integer: NumberSchemaNode;
617
+ bigint: NumberSchemaNode;
618
+ boolean: ScalarSchemaNode;
619
+ null: ScalarSchemaNode;
620
+ any: ScalarSchemaNode;
621
+ unknown: ScalarSchemaNode;
622
+ void: ScalarSchemaNode;
623
+ never: ScalarSchemaNode;
624
+ uuid: FormatStringSchemaNode;
625
+ email: FormatStringSchemaNode;
626
+ url: UrlSchemaNode;
627
+ ipv4: ScalarSchemaNode;
628
+ ipv6: ScalarSchemaNode;
629
+ blob: ScalarSchemaNode;
630
+ };
631
+ /**
632
+ * Union of all schema node types.
633
+ */
634
+ type SchemaNode = ObjectSchemaNode | ArraySchemaNode | UnionSchemaNode | IntersectionSchemaNode | NotSchemaNode | EnumSchemaNode | RefSchemaNode | DatetimeSchemaNode | DateSchemaNode | TimeSchemaNode | StringSchemaNode | NumberSchemaNode | UrlSchemaNode | FormatStringSchemaNode | ScalarSchemaNode;
635
+ type CreateSchemaObjectInput = Omit<ObjectSchemaNode, 'kind' | 'properties' | 'primitive'> & {
636
+ properties?: Array<PropertyNode>;
637
+ primitive?: 'object';
638
+ };
639
+ type CreateSchemaInput = CreateSchemaObjectInput | DistributiveOmit<Exclude<SchemaNode, ObjectSchemaNode>, 'kind'>;
640
+ type CreateSchemaOutput<T extends CreateSchemaInput> = SchemaNodeByType[T['type']] & {
641
+ kind: 'Schema';
642
+ };
643
+ /**
644
+ * Creates a `SchemaNode`, narrowed to the variant of `props.type`. Object schemas default
645
+ * `properties` to an empty array, and `primitive` is inferred from `type` when not explicitly provided.
646
+ *
647
+ * @example
648
+ * ```ts
649
+ * const scalar = createSchema({ type: 'string' })
650
+ * // { kind: 'Schema', type: 'string', primitive: 'string' }
651
+ * ```
652
+ *
653
+ * @example
654
+ * ```ts
655
+ * const object = createSchema({ type: 'object' })
656
+ * // { kind: 'Schema', type: 'object', primitive: 'object', properties: [] }
657
+ * ```
658
+ */
659
+ declare function createSchema<T extends CreateSchemaInput>(props: T): CreateSchemaOutput<T>;
660
+ declare function createSchema(props: CreateSchemaInput): SchemaNode;
661
+ /**
662
+ * A variable declared by a server URL template.
663
+ */
664
+ type InputServerVariable = {
665
+ default?: string;
666
+ enum?: Array<string>;
667
+ description?: string;
668
+ };
669
+ /**
670
+ * A server from the source document, with `{variable}` placeholders filled from their defaults.
671
+ */
672
+ type InputServer = {
673
+ url: string;
674
+ name?: string;
675
+ description?: string;
676
+ /**
677
+ * Variables of the source URL template, copied as-is. `url` already has their defaults filled in, so
678
+ * this tells a templated server apart from a literal one. Absent when the server declares none.
679
+ */
680
+ variables?: Record<string, InputServerVariable>;
681
+ };
682
+ type ExternalDocs = {
683
+ url: string;
684
+ description?: string;
685
+ };
686
+ type InputTag = {
687
+ name: string;
688
+ summary?: string;
689
+ description?: string;
690
+ /**
691
+ * Name of the tag this tag nests under. `group: { type: 'tag' }` places its files in the parent's folder.
692
+ */
693
+ parent?: string;
694
+ kind?: string;
695
+ externalDocs?: ExternalDocs;
696
+ };
697
+ type OAuthFlow = {
698
+ authorizationUrl?: string;
699
+ deviceAuthorizationUrl?: string;
700
+ tokenUrl?: string;
701
+ refreshUrl?: string;
702
+ scopes?: Record<string, string>;
703
+ };
704
+ /**
705
+ * How a client sends a credential, in the same shape as the `Auth` object the generated clients pass to `auth`.
706
+ */
707
+ type AuthCredential = {
708
+ type: 'http';
709
+ scheme: 'bearer' | 'basic' | (string & {});
710
+ bearerFormat?: string;
711
+ } | {
712
+ type: 'apiKey';
713
+ in: 'header' | 'query' | 'cookie';
714
+ name: string;
715
+ } | {
716
+ type: 'oauth2';
717
+ flows: Record<string, OAuthFlow>;
718
+ metadataUrl?: string;
719
+ } | {
720
+ type: 'openIdConnect';
721
+ url?: string;
722
+ } | {
723
+ type: 'mutualTLS';
724
+ };
725
+ /**
726
+ * One way to authenticate, keyed by `name`, which operations refer to in `auth`.
727
+ */
728
+ type AuthScheme = {
729
+ name: string;
730
+ description?: string;
731
+ deprecated?: boolean;
732
+ credential: AuthCredential;
733
+ };
734
+ /**
735
+ * One way to meet an operation's auth. Every scheme in it applies together. `scopes` are the OAuth2 or OpenID
736
+ * Connect scopes the call needs. An empty list means the call may be sent without credentials.
737
+ */
738
+ type AuthRequirement = Array<{
739
+ scheme: string;
740
+ scopes?: Array<string>;
741
+ }>;
742
+ /**
743
+ * Metadata for an API document, populated by the adapter and available to every generator.
744
+ * Every field is a plain JSON value.
745
+ *
746
+ * @example
747
+ * ```ts
748
+ * const meta: InputMeta = { title: 'Pet Store', version: '1.0.0', baseURL: 'https://api.example.com/v2' }
749
+ * ```
750
+ */
751
+ type InputMeta = {
752
+ /**
753
+ * API title from `info.title` in the source document.
754
+ */
755
+ title?: string;
756
+ /**
757
+ * API description from `info.description` in the source document.
758
+ */
759
+ description?: string;
760
+ /**
761
+ * API version string from `info.version` in the source document.
762
+ */
763
+ version?: string;
764
+ summary?: string;
765
+ termsOfService?: string;
766
+ contact?: {
767
+ name?: string;
768
+ url?: string;
769
+ email?: string;
770
+ };
771
+ license?: {
772
+ name: string;
773
+ identifier?: string;
774
+ url?: string;
775
+ };
776
+ externalDocs?: ExternalDocs;
777
+ /**
778
+ * Resolved base URL from the first matching server entry in the source document.
779
+ */
780
+ baseURL?: string | null;
781
+ servers?: Array<InputServer>;
782
+ tags?: Array<InputTag>;
783
+ auth?: Array<AuthScheme>;
784
+ /**
785
+ * Vendor extensions (`x-*` keys) from the document root, copied as-is. Absent when the root has none.
786
+ */
787
+ extensions?: Record<string, unknown>;
788
+ };
789
+ /**
790
+ * Input AST node that contains all schemas and operations for one API document.
791
+ * Produced by the adapter and consumed by all Kubb plugins.
792
+ *
793
+ * @example
794
+ * ```ts
795
+ * const input: InputNode = {
796
+ * kind: 'Input',
797
+ * schemas: [],
798
+ * operations: [],
799
+ * meta: {},
800
+ * }
801
+ * ```
802
+ */
803
+ type InputNode = BaseNode & {
804
+ /**
805
+ * Node kind.
806
+ */
807
+ kind: 'Input';
808
+ /**
809
+ * All schema nodes in the document.
810
+ */
811
+ schemas: Array<SchemaNode>;
812
+ /**
813
+ * All operation nodes in the document.
814
+ */
815
+ operations: Array<OperationNode>;
816
+ /**
817
+ * Document metadata populated by the adapter.
818
+ */
819
+ meta: InputMeta;
820
+ };
821
+ /**
822
+ * Creates an `InputNode`, defaulting `schemas`/`operations` to empty arrays and `meta` to an empty
823
+ * object. Every call allocates fresh defaults so no two inputs share them.
824
+ *
825
+ * @example
826
+ * ```ts
827
+ * const input = createInput()
828
+ * // { kind: 'Input', schemas: [], operations: [] }
829
+ * ```
830
+ */
831
+ declare function createInput(overrides?: Partial<Omit<InputNode, 'kind'>>): InputNode;
832
+ /**
833
+ * How one body property is serialized, from the `encoding` entry of its media type.
834
+ */
835
+ type EncodingNode = {
836
+ /**
837
+ * Content type of the part, for example `'application/json'` for a multipart property.
838
+ */
839
+ contentType?: string;
840
+ /**
841
+ * Serialization style of the property.
842
+ */
843
+ style?: ParameterStyle;
844
+ /**
845
+ * Whether array and object values expand into separate values.
846
+ */
847
+ explode?: boolean;
848
+ /**
849
+ * Whether reserved characters are sent as-is instead of percent-encoded.
850
+ */
851
+ allowReserved?: boolean;
852
+ encoding?: Record<string, EncodingNode>;
853
+ prefixEncoding?: Array<EncodingNode>;
854
+ itemEncoding?: EncodingNode;
855
+ };
856
+ type ExampleNode = {
857
+ name?: string;
858
+ summary?: string;
859
+ description?: string;
860
+ value?: unknown;
861
+ serializedValue?: string;
862
+ };
863
+ /**
864
+ * AST node representing one content-type entry of a request body or response.
865
+ *
866
+ * There is one entry per content type declared in the spec (e.g. `application/json`,
867
+ * `multipart/form-data`), and each entry holds its own body schema.
868
+ *
869
+ * @example
870
+ * ```ts
871
+ * const content: ContentNode = {
872
+ * kind: 'Content',
873
+ * contentType: 'application/json',
874
+ * schema: createSchema({ type: 'string' }),
875
+ * }
876
+ * ```
877
+ */
878
+ type ContentNode = BaseNode & {
879
+ /**
880
+ * Node kind.
881
+ */
882
+ kind: 'Content';
883
+ /**
884
+ * The content type for this entry (e.g. `'application/json'`), or `''` for a response without a body.
885
+ */
886
+ contentType: string;
887
+ /**
888
+ * Body schema for this content type. For a stream it is the same node as `stream.schema`.
889
+ */
890
+ schema?: SchemaNode;
891
+ /**
892
+ * Set when the content is a stream of items (an event stream, JSON Lines, a channel of messages) instead of one body.
893
+ */
894
+ stream?: {
895
+ /**
896
+ * Schema of one item, such as one event of `text/event-stream` or one line of JSON Lines.
897
+ */
898
+ schema?: SchemaNode;
899
+ /**
900
+ * What `schema` describes for an event stream.
901
+ * - `'event'` the parsed event with its `event`, `data`, `id` and `retry` fields
902
+ * - `'data'` only the `data` payload, which the client wraps in its own event type
903
+ */
904
+ shape?: 'event' | 'data';
905
+ };
906
+ /**
907
+ * Property keys to exclude from the generated type via `Omit<Type, Keys>`.
908
+ * Set when a referenced schema has `readOnly`/`writeOnly` fields that should be omitted.
909
+ */
910
+ keysToOmit?: Array<string> | null;
911
+ /**
912
+ * Serialization settings per body property that sets at least one field in the spec's `encoding`.
913
+ */
914
+ encoding?: Record<string, EncodingNode>;
915
+ examples?: Array<ExampleNode>;
916
+ /**
917
+ * Serialization of the first parts by position, for a body sent as an array of parts such as `multipart/mixed`.
918
+ */
919
+ prefixEncoding?: Array<EncodingNode>;
920
+ /**
921
+ * Serialization of every part after `prefixEncoding`, for a body sent as an array of parts such as `multipart/mixed`.
922
+ */
923
+ itemEncoding?: EncodingNode;
924
+ };
925
+ /**
926
+ * Creates a `ContentNode` for a single request-body or response content type.
927
+ */
928
+ declare const createContent: (input: Omit<ContentNode, "kind">) => ContentNode;
929
+ /**
930
+ * Where a parameter is sent. `querystring` carries the whole query string as one value, serialized per `contentType`.
931
+ */
932
+ type ParameterLocation = 'path' | 'query' | 'header' | 'cookie' | 'querystring';
933
+ /**
934
+ * Parameter serialization style, controlling how a parameter value is rendered into the request.
935
+ */
936
+ type ParameterStyle = 'matrix' | 'label' | 'form' | 'simple' | 'spaceDelimited' | 'pipeDelimited' | 'deepObject' | 'cookie';
937
+ /**
938
+ * AST node representing one operation parameter.
939
+ *
940
+ * @example
941
+ * ```ts
942
+ * const param: ParameterNode = {
943
+ * kind: 'Parameter',
944
+ * name: 'petId',
945
+ * in: 'path',
946
+ * schema: createSchema({ type: 'string' }),
947
+ * required: true,
948
+ * }
949
+ * ```
950
+ */
951
+ type ParameterNode = BaseNode & {
952
+ kind: 'Parameter';
953
+ /**
954
+ * Parameter name.
955
+ */
956
+ name: string;
957
+ /**
958
+ * Parameter location (`path`, `query`, `header`, `cookie`, or `querystring`).
959
+ */
960
+ in: ParameterLocation;
961
+ /**
962
+ * Parameter schema.
963
+ */
964
+ schema: SchemaNode;
965
+ /**
966
+ * Whether the parameter is required.
967
+ */
968
+ required: boolean;
969
+ /**
970
+ * Serialization style. Absent when the source omits it, leaving consumers to apply the
971
+ * per-location default.
972
+ */
973
+ style?: ParameterStyle;
974
+ /**
975
+ * Whether array and object values expand into separate values. Absent when the source omits it,
976
+ * leaving consumers to apply the default for the style.
977
+ */
978
+ explode?: boolean;
979
+ /**
980
+ * Whether reserved characters (RFC 3986 `:/?#[]@!$&'()*+,;=`) are sent as-is instead of
981
+ * percent-encoded. Absent when the source omits it.
982
+ */
983
+ allowReserved?: boolean;
984
+ /**
985
+ * Media type of a parameter described with `content` instead of `schema`, for example
986
+ * `application/json` when the value is sent as a JSON-encoded string. Absent for `schema` parameters.
987
+ */
988
+ contentType?: string;
989
+ /**
990
+ * Serialization settings per property of a `content` parameter, from the `encoding` of its media type. An OpenAPI 3.2
991
+ * `querystring` parameter sent as `application/x-www-form-urlencoded` uses it to set `style` and `explode` per field.
992
+ */
993
+ encoding?: Record<string, EncodingNode>;
994
+ examples?: Array<ExampleNode>;
995
+ deprecated?: boolean;
996
+ allowEmptyValue?: boolean;
997
+ };
998
+ type UserParameterNode = Pick<ParameterNode, 'name' | 'in' | 'schema'> & Partial<Omit<ParameterNode, 'kind' | 'name' | 'in' | 'schema'>>;
999
+ /**
1000
+ * Creates a `ParameterNode`. `required` defaults to `false`, and the schema's
1001
+ * `optional`/`nullish` flags are derived from it.
1002
+ *
1003
+ * @example
1004
+ * ```ts
1005
+ * const param = createParameter({
1006
+ * name: 'petId',
1007
+ * in: 'path',
1008
+ * required: true,
1009
+ * schema: createSchema({ type: 'string' }),
1010
+ * })
1011
+ * ```
1012
+ */
1013
+ declare function createParameter(input: UserParameterNode): ParameterNode;
1014
+ /**
1015
+ * AST node representing an operation request body.
1016
+ *
1017
+ * Body schemas live exclusively inside the `content` array (one entry per content type),
1018
+ * mirroring {@link ResponseNode}.
1019
+ *
1020
+ * @example
1021
+ * ```ts
1022
+ * const requestBody: RequestBodyNode = {
1023
+ * kind: 'RequestBody',
1024
+ * required: true,
1025
+ * content: [{ kind: 'Content', contentType: 'application/json', schema: createSchema({ type: 'string' }) }],
1026
+ * }
1027
+ * ```
1028
+ */
1029
+ type RequestBodyNode = BaseNode & {
1030
+ kind: 'RequestBody';
1031
+ /**
1032
+ * Request body description carried over from the spec.
1033
+ */
1034
+ description?: string;
1035
+ /**
1036
+ * Whether the request body is required (`requestBody.required: true` in the spec).
1037
+ * When `false` or absent, the generated `data` parameter should be optional.
1038
+ */
1039
+ required?: boolean;
1040
+ /**
1041
+ * Content type entries for this request body.
1042
+ *
1043
+ * When the adapter `contentType` option is set, this array contains exactly one entry for
1044
+ * that content type. Otherwise it contains one entry per content type declared in the spec,
1045
+ * so plugins can generate code for every variant (for example, separate hooks for
1046
+ * `application/json` and `multipart/form-data`).
1047
+ */
1048
+ content?: Array<ContentNode>;
1049
+ };
1050
+ /**
1051
+ * Creates a `RequestBodyNode`.
1052
+ */
1053
+ declare const createRequestBody: (input: Omit<RequestBodyNode, "kind">) => RequestBodyNode;
1054
+ type Digit = 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9;
1055
+ /**
1056
+ * Response status code literal used by operations.
1057
+ *
1058
+ * Includes three-digit HTTP status code strings, ranges such as `"2xx"`, and `"default"` for catch-all responses.
1059
+ *
1060
+ * @example
1061
+ * ```ts
1062
+ * const status: StatusCode = '200'
1063
+ * const fallback: StatusCode = 'default'
1064
+ * ```
1065
+ */
1066
+ type StatusCode = `${1 | 2 | 3 | 4 | 5}${Digit}${Digit}` | `${1 | 2 | 3 | 4 | 5}xx` | 'default';
1067
+ /**
1068
+ * AST node representing one operation response variant.
1069
+ *
1070
+ * Mirrors {@link OperationNode.requestBody}: the response body schemas live exclusively inside
1071
+ * the `content` array (one entry per content type), so the same schema is never duplicated at the
1072
+ * node root and inside `content`.
1073
+ *
1074
+ * @example
1075
+ * ```ts
1076
+ * const response: ResponseNode = {
1077
+ * kind: 'Response',
1078
+ * statusCode: '200',
1079
+ * content: [{ kind: 'Content', contentType: 'application/json', schema: createSchema({ type: 'string' }) }],
1080
+ * }
1081
+ * ```
1082
+ */
1083
+ type ResponseNode = BaseNode & {
1084
+ /**
1085
+ * Node kind.
1086
+ */
1087
+ kind: 'Response';
1088
+ /**
1089
+ * HTTP status code or `'default'` for a fallback response.
1090
+ */
1091
+ statusCode: StatusCode;
1092
+ summary?: string;
1093
+ /**
1094
+ * Optional response description.
1095
+ */
1096
+ description?: string;
1097
+ /**
1098
+ * All available content type entries for this response.
1099
+ *
1100
+ * For a response that declares content, the array holds exactly one entry for the adapter
1101
+ * `contentType` option when it is set. Otherwise it holds one entry per content type declared in
1102
+ * the spec, so that plugins can generate a union of response types (e.g. `application/json` and
1103
+ * `application/xml`). A body-less response always keeps a single entry whose `contentType` is `''`
1104
+ * and whose `schema` is the empty/`void` placeholder, even when the option is set.
1105
+ *
1106
+ * @example
1107
+ * ```ts
1108
+ * // spec response declares both application/json and application/xml
1109
+ * response.content[0].contentType // 'application/json'
1110
+ * response.content[1].contentType // 'application/xml'
1111
+ * ```
1112
+ */
1113
+ content?: Array<ContentNode>;
1114
+ /**
1115
+ * Response headers, as `in: 'header'` parameters. `Content-Type` is left out.
1116
+ */
1117
+ headers?: Array<ParameterNode>;
1118
+ links?: Record<string, ResponseLink>;
1119
+ };
1120
+ /**
1121
+ * A link to another operation. `parameters` and `requestBody` hold runtime expressions such as `$response.body#/id`.
1122
+ */
1123
+ type ResponseLink = {
1124
+ operationId?: string;
1125
+ operationRef?: string;
1126
+ parameters?: Record<string, unknown>;
1127
+ requestBody?: unknown;
1128
+ description?: string;
1129
+ server?: InputServer;
1130
+ };
1131
+ type ResponseInput = Pick<ResponseNode, 'statusCode'> & Partial<Omit<ResponseNode, 'kind' | 'statusCode' | 'content'>> & {
1132
+ content?: Array<ContentNode>;
1133
+ schema?: SchemaNode;
1134
+ mediaType?: string | null;
1135
+ keysToOmit?: Array<string> | null;
1136
+ };
1137
+ /**
1138
+ * Creates a `ResponseNode`. A single legacy `schema` (with optional `mediaType`/`keysToOmit`)
1139
+ * is normalized into one `content` entry.
1140
+ *
1141
+ * @example
1142
+ * ```ts
1143
+ * const response = createResponse({
1144
+ * statusCode: '200',
1145
+ * content: [createContent({ contentType: 'application/json', schema: createSchema({ type: 'object', properties: [] }) })],
1146
+ * })
1147
+ * ```
1148
+ */
1149
+ declare function createResponse(props: ResponseInput): ResponseNode;
1150
+ /**
1151
+ * HTTP method an operation responds to. `QUERY` is the safe, idempotent method with a request body
1152
+ * from RFC 10008, declared with the `query` field of an OpenAPI 3.2 path item. Any other name is a
1153
+ * method the source declares outside this fixed set, in the capitalization it is sent with.
1154
+ */
1155
+ type HttpMethod = 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE' | 'HEAD' | 'OPTIONS' | 'TRACE' | 'QUERY' | (string & {});
1156
+ /**
1157
+ * Fields shared by every operation, regardless of transport.
1158
+ */
1159
+ type OperationNodeBase = BaseNode & {
1160
+ /**
1161
+ * Node kind.
1162
+ */
1163
+ kind: 'Operation';
1164
+ /**
1165
+ * Stable identifier for the operation.
1166
+ */
1167
+ operationId: string;
1168
+ /**
1169
+ * Group labels for the operation.
1170
+ */
1171
+ tags: Array<string>;
1172
+ /**
1173
+ * Short one-line operation summary.
1174
+ */
1175
+ summary?: string;
1176
+ /**
1177
+ * Full operation description.
1178
+ */
1179
+ description?: string;
1180
+ /**
1181
+ * Marks the operation as deprecated.
1182
+ */
1183
+ deprecated?: boolean;
1184
+ externalDocs?: ExternalDocs;
1185
+ /**
1186
+ * Query, path, header, and cookie parameters for the operation.
1187
+ */
1188
+ parameters: Array<ParameterNode>;
1189
+ /**
1190
+ * Request body for the operation.
1191
+ */
1192
+ requestBody?: RequestBodyNode;
1193
+ /**
1194
+ * Operation responses.
1195
+ */
1196
+ responses: Array<ResponseNode>;
1197
+ /**
1198
+ * Vendor extensions (`x-*` keys) from the source operation, copied as-is. Absent when the source has none.
1199
+ */
1200
+ extensions?: Record<string, unknown>;
1201
+ /** The operation's own `servers`, else its path item's, such as an upload host. Absent when neither declares any. */
1202
+ servers?: Array<InputServer>;
1203
+ /**
1204
+ * Ways to authenticate, from the operation or else the document. Any one entry is enough. `[]` means no auth.
1205
+ */
1206
+ auth?: Array<AuthRequirement>;
1207
+ };
1208
+ /**
1209
+ * Operation served over HTTP. `method` and `path` are guaranteed.
1210
+ *
1211
+ * @example
1212
+ * ```ts
1213
+ * const operation: HttpOperationNode = {
1214
+ * kind: 'Operation',
1215
+ * operationId: 'listPets',
1216
+ * protocol: 'http',
1217
+ * method: 'GET',
1218
+ * path: '/pets',
1219
+ * tags: [],
1220
+ * parameters: [],
1221
+ * responses: [],
1222
+ * }
1223
+ * ```
1224
+ */
1225
+ type HttpOperationNode = OperationNodeBase & {
1226
+ /**
1227
+ * Transport the operation belongs to.
1228
+ */
1229
+ protocol?: 'http';
1230
+ /**
1231
+ * HTTP method like `'GET'`.
1232
+ */
1233
+ method: HttpMethod;
1234
+ /**
1235
+ * Path string, for example `/pets/{petId}`, with `{param}` notation preserved.
1236
+ */
1237
+ path: string;
1238
+ };
1239
+ /**
1240
+ * Operation for a non-HTTP transport. HTTP-only fields are forbidden.
1241
+ */
1242
+ type GenericOperationNode = OperationNodeBase & {
1243
+ protocol?: never;
1244
+ method?: never;
1245
+ path?: never;
1246
+ };
1247
+ /**
1248
+ * AST node representing one API operation.
1249
+ *
1250
+ * Discriminated on `protocol`: an {@link HttpOperationNode} (`protocol: 'http'`) guarantees
1251
+ * `method` and `path`, while a {@link GenericOperationNode} omits them. Narrow with
1252
+ * `ast.http.isOperation(node)` or `node.protocol === 'http'` before reading `method`/`path`.
1253
+ */
1254
+ type OperationNode = HttpOperationNode | GenericOperationNode;
1255
+ /**
1256
+ * Creates an `OperationNode` with default empty arrays for `tags`, `parameters`, and `responses`.
1257
+ * HTTP operations (those carrying both `method` and `path`) are tagged with `protocol: 'http'`,
1258
+ * and the request body is normalized into a `RequestBodyNode`.
1259
+ *
1260
+ * @example
1261
+ * ```ts
1262
+ * const operation = createOperation({ operationId: 'getPetById', method: 'GET', path: '/pet/{petId}' })
1263
+ * // tags, parameters, and responses are []
1264
+ * ```
1265
+ */
1266
+ declare function createOperation(props: Pick<HttpOperationNode, 'operationId' | 'method' | 'path'> & Partial<Omit<HttpOperationNode, 'kind' | 'operationId' | 'method' | 'path' | 'requestBody'>> & {
1267
+ requestBody?: Omit<RequestBodyNode, 'kind'>;
1268
+ }): HttpOperationNode;
1269
+ declare function createOperation(props: Pick<GenericOperationNode, 'operationId'> & Partial<Omit<GenericOperationNode, 'kind' | 'operationId' | 'requestBody'>> & {
1270
+ requestBody?: Omit<RequestBodyNode, 'kind'>;
1271
+ }): GenericOperationNode;
1272
+ export { ArraySchemaNode as A, ScalarSchemaNode as B, ExternalDocs as C, InputTag as D, InputServer as E, NotSchemaNode as F, StringSchemaNode as G, SchemaNode as H, NumberSchemaNode as I, UrlSchemaNode as J, TimeSchemaNode as K, ObjectSchemaNode as L, DatetimeSchemaNode as M, EnumSchemaNode as N, OAuthFlow as O, IntersectionSchemaNode as P, PrimitiveSchemaType as R, AuthScheme as S, InputNode as T, SchemaNodeByType as U, ScalarSchemaType as V, SchemaType as W, PropertyNode as X, createSchema as Y, createProperty as Z, EncodingNode as _, createOperation as a, AuthCredential as b, StatusCode as c, createRequestBody as d, ParameterLocation as f, ContentNode as g, createParameter as h, OperationNode as i, DateSchemaNode as j, createInput as k, createResponse as l, ParameterStyle as m, HttpMethod as n, ResponseLink as o, ParameterNode as p, UnionSchemaNode as q, HttpOperationNode as r, ResponseNode as s, GenericOperationNode as t, RequestBodyNode as u, ExampleNode as v, InputMeta as w, AuthRequirement as x, createContent as y, RefSchemaNode as z };