@kubb/adapter-oas 5.10.2 → 5.10.3
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.cjs +1 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1300 -0
- package/dist/index.d.ts +0 -1
- package/dist/index.js +2 -2
- package/package.json +11 -6
- package/dist/rolldown-runtime-C0LytTxp.js +0 -8
package/dist/index.d.cts
ADDED
|
@@ -0,0 +1,1300 @@
|
|
|
1
|
+
import { AdapterFactoryOptions, ast } from "@kubb/kit";
|
|
2
|
+
//#region ../../node_modules/.pnpm/@types+json-schema@7.0.15/node_modules/@types/json-schema/index.d.ts
|
|
3
|
+
// ==================================================================================================
|
|
4
|
+
// JSON Schema Draft 04
|
|
5
|
+
// ==================================================================================================
|
|
6
|
+
/**
|
|
7
|
+
* @see https://tools.ietf.org/html/draft-zyp-json-schema-03#section-5.1
|
|
8
|
+
*/
|
|
9
|
+
type JSONSchema4TypeName = "string" //
|
|
10
|
+
| "number" | "integer" | "boolean" | "object" | "array" | "null" | "any";
|
|
11
|
+
/**
|
|
12
|
+
* @see https://tools.ietf.org/html/draft-zyp-json-schema-04#section-3.5
|
|
13
|
+
*/
|
|
14
|
+
type JSONSchema4Type = string //
|
|
15
|
+
| number | boolean | JSONSchema4Object | JSONSchema4Array | null;
|
|
16
|
+
// Workaround for infinite type recursion
|
|
17
|
+
interface JSONSchema4Object {
|
|
18
|
+
[key: string]: JSONSchema4Type;
|
|
19
|
+
}
|
|
20
|
+
// Workaround for infinite type recursion
|
|
21
|
+
// https://github.com/Microsoft/TypeScript/issues/3496#issuecomment-128553540
|
|
22
|
+
interface JSONSchema4Array extends Array<JSONSchema4Type> {}
|
|
23
|
+
/**
|
|
24
|
+
* Meta schema
|
|
25
|
+
*
|
|
26
|
+
* Recommended values:
|
|
27
|
+
* - 'http://json-schema.org/schema#'
|
|
28
|
+
* - 'http://json-schema.org/hyper-schema#'
|
|
29
|
+
* - 'http://json-schema.org/draft-04/schema#'
|
|
30
|
+
* - 'http://json-schema.org/draft-04/hyper-schema#'
|
|
31
|
+
* - 'http://json-schema.org/draft-03/schema#'
|
|
32
|
+
* - 'http://json-schema.org/draft-03/hyper-schema#'
|
|
33
|
+
*
|
|
34
|
+
* @see https://tools.ietf.org/html/draft-handrews-json-schema-validation-01#section-5
|
|
35
|
+
*/
|
|
36
|
+
type JSONSchema4Version = string;
|
|
37
|
+
/**
|
|
38
|
+
* JSON Schema V4
|
|
39
|
+
* @see https://tools.ietf.org/html/draft-zyp-json-schema-04
|
|
40
|
+
*/
|
|
41
|
+
interface JSONSchema4 {
|
|
42
|
+
id?: string | undefined;
|
|
43
|
+
$ref?: string | undefined;
|
|
44
|
+
$schema?: JSONSchema4Version | undefined;
|
|
45
|
+
/**
|
|
46
|
+
* This attribute is a string that provides a short description of the
|
|
47
|
+
* instance property.
|
|
48
|
+
*
|
|
49
|
+
* @see https://tools.ietf.org/html/draft-zyp-json-schema-03#section-5.21
|
|
50
|
+
*/
|
|
51
|
+
title?: string | undefined;
|
|
52
|
+
/**
|
|
53
|
+
* This attribute is a string that provides a full description of the of
|
|
54
|
+
* purpose the instance property.
|
|
55
|
+
*
|
|
56
|
+
* @see https://tools.ietf.org/html/draft-zyp-json-schema-03#section-5.22
|
|
57
|
+
*/
|
|
58
|
+
description?: string | undefined;
|
|
59
|
+
default?: JSONSchema4Type | undefined;
|
|
60
|
+
multipleOf?: number | undefined;
|
|
61
|
+
maximum?: number | undefined;
|
|
62
|
+
exclusiveMaximum?: boolean | undefined;
|
|
63
|
+
minimum?: number | undefined;
|
|
64
|
+
exclusiveMinimum?: boolean | undefined;
|
|
65
|
+
maxLength?: number | undefined;
|
|
66
|
+
minLength?: number | undefined;
|
|
67
|
+
pattern?: string | undefined;
|
|
68
|
+
/**
|
|
69
|
+
* May only be defined when "items" is defined, and is a tuple of JSONSchemas.
|
|
70
|
+
*
|
|
71
|
+
* This provides a definition for additional items in an array instance
|
|
72
|
+
* when tuple definitions of the items is provided. This can be false
|
|
73
|
+
* to indicate additional items in the array are not allowed, or it can
|
|
74
|
+
* be a schema that defines the schema of the additional items.
|
|
75
|
+
*
|
|
76
|
+
* @see https://tools.ietf.org/html/draft-zyp-json-schema-03#section-5.6
|
|
77
|
+
*/
|
|
78
|
+
additionalItems?: boolean | JSONSchema4 | undefined;
|
|
79
|
+
/**
|
|
80
|
+
* This attribute defines the allowed items in an instance array, and
|
|
81
|
+
* MUST be a schema or an array of schemas. The default value is an
|
|
82
|
+
* empty schema which allows any value for items in the instance array.
|
|
83
|
+
*
|
|
84
|
+
* When this attribute value is a schema and the instance value is an
|
|
85
|
+
* array, then all the items in the array MUST be valid according to the
|
|
86
|
+
* schema.
|
|
87
|
+
*
|
|
88
|
+
* When this attribute value is an array of schemas and the instance
|
|
89
|
+
* value is an array, each position in the instance array MUST conform
|
|
90
|
+
* to the schema in the corresponding position for this array. This
|
|
91
|
+
* called tuple typing. When tuple typing is used, additional items are
|
|
92
|
+
* allowed, disallowed, or constrained by the "additionalItems"
|
|
93
|
+
* (Section 5.6) attribute using the same rules as
|
|
94
|
+
* "additionalProperties" (Section 5.4) for objects.
|
|
95
|
+
*
|
|
96
|
+
* @see https://tools.ietf.org/html/draft-zyp-json-schema-03#section-5.5
|
|
97
|
+
*/
|
|
98
|
+
items?: JSONSchema4 | JSONSchema4[] | undefined;
|
|
99
|
+
maxItems?: number | undefined;
|
|
100
|
+
minItems?: number | undefined;
|
|
101
|
+
uniqueItems?: boolean | undefined;
|
|
102
|
+
maxProperties?: number | undefined;
|
|
103
|
+
minProperties?: number | undefined;
|
|
104
|
+
/**
|
|
105
|
+
* This attribute indicates if the instance must have a value, and not
|
|
106
|
+
* be undefined. This is false by default, making the instance
|
|
107
|
+
* optional.
|
|
108
|
+
*
|
|
109
|
+
* @see https://tools.ietf.org/html/draft-zyp-json-schema-03#section-5.7
|
|
110
|
+
*/
|
|
111
|
+
required?: boolean | string[] | undefined;
|
|
112
|
+
/**
|
|
113
|
+
* This attribute defines a schema for all properties that are not
|
|
114
|
+
* explicitly defined in an object type definition. If specified, the
|
|
115
|
+
* value MUST be a schema or a boolean. If false is provided, no
|
|
116
|
+
* additional properties are allowed beyond the properties defined in
|
|
117
|
+
* the schema. The default value is an empty schema which allows any
|
|
118
|
+
* value for additional properties.
|
|
119
|
+
*
|
|
120
|
+
* @see https://tools.ietf.org/html/draft-zyp-json-schema-03#section-5.4
|
|
121
|
+
*/
|
|
122
|
+
additionalProperties?: boolean | JSONSchema4 | undefined;
|
|
123
|
+
definitions?: {
|
|
124
|
+
[k: string]: JSONSchema4;
|
|
125
|
+
} | undefined;
|
|
126
|
+
/**
|
|
127
|
+
* This attribute is an object with property definitions that define the
|
|
128
|
+
* valid values of instance object property values. When the instance
|
|
129
|
+
* value is an object, the property values of the instance object MUST
|
|
130
|
+
* conform to the property definitions in this object. In this object,
|
|
131
|
+
* each property definition's value MUST be a schema, and the property's
|
|
132
|
+
* name MUST be the name of the instance property that it defines. The
|
|
133
|
+
* instance property value MUST be valid according to the schema from
|
|
134
|
+
* the property definition. Properties are considered unordered, the
|
|
135
|
+
* order of the instance properties MAY be in any order.
|
|
136
|
+
*
|
|
137
|
+
* @see https://tools.ietf.org/html/draft-zyp-json-schema-03#section-5.2
|
|
138
|
+
*/
|
|
139
|
+
properties?: {
|
|
140
|
+
[k: string]: JSONSchema4;
|
|
141
|
+
} | undefined;
|
|
142
|
+
/**
|
|
143
|
+
* This attribute is an object that defines the schema for a set of
|
|
144
|
+
* property names of an object instance. The name of each property of
|
|
145
|
+
* this attribute's object is a regular expression pattern in the ECMA
|
|
146
|
+
* 262/Perl 5 format, while the value is a schema. If the pattern
|
|
147
|
+
* matches the name of a property on the instance object, the value of
|
|
148
|
+
* the instance's property MUST be valid against the pattern name's
|
|
149
|
+
* schema value.
|
|
150
|
+
*
|
|
151
|
+
* @see https://tools.ietf.org/html/draft-zyp-json-schema-03#section-5.3
|
|
152
|
+
*/
|
|
153
|
+
patternProperties?: {
|
|
154
|
+
[k: string]: JSONSchema4;
|
|
155
|
+
} | undefined;
|
|
156
|
+
dependencies?: {
|
|
157
|
+
[k: string]: JSONSchema4 | string[];
|
|
158
|
+
} | undefined;
|
|
159
|
+
/**
|
|
160
|
+
* This provides an enumeration of all possible values that are valid
|
|
161
|
+
* for the instance property. This MUST be an array, and each item in
|
|
162
|
+
* the array represents a possible value for the instance value. If
|
|
163
|
+
* this attribute is defined, the instance value MUST be one of the
|
|
164
|
+
* values in the array in order for the schema to be valid.
|
|
165
|
+
*
|
|
166
|
+
* @see https://tools.ietf.org/html/draft-zyp-json-schema-03#section-5.19
|
|
167
|
+
*/
|
|
168
|
+
enum?: JSONSchema4Type[] | undefined;
|
|
169
|
+
/**
|
|
170
|
+
* A single type, or a union of simple types
|
|
171
|
+
*/
|
|
172
|
+
type?: JSONSchema4TypeName | JSONSchema4TypeName[] | undefined;
|
|
173
|
+
allOf?: JSONSchema4[] | undefined;
|
|
174
|
+
anyOf?: JSONSchema4[] | undefined;
|
|
175
|
+
oneOf?: JSONSchema4[] | undefined;
|
|
176
|
+
not?: JSONSchema4 | undefined;
|
|
177
|
+
/**
|
|
178
|
+
* The value of this property MUST be another schema which will provide
|
|
179
|
+
* a base schema which the current schema will inherit from. The
|
|
180
|
+
* inheritance rules are such that any instance that is valid according
|
|
181
|
+
* to the current schema MUST be valid according to the referenced
|
|
182
|
+
* schema. This MAY also be an array, in which case, the instance MUST
|
|
183
|
+
* be valid for all the schemas in the array. A schema that extends
|
|
184
|
+
* another schema MAY define additional attributes, constrain existing
|
|
185
|
+
* attributes, or add other constraints.
|
|
186
|
+
*
|
|
187
|
+
* Conceptually, the behavior of extends can be seen as validating an
|
|
188
|
+
* instance against all constraints in the extending schema as well as
|
|
189
|
+
* the extended schema(s).
|
|
190
|
+
*
|
|
191
|
+
* @see https://tools.ietf.org/html/draft-zyp-json-schema-03#section-5.26
|
|
192
|
+
*/
|
|
193
|
+
extends?: string | string[] | undefined;
|
|
194
|
+
/**
|
|
195
|
+
* @see https://tools.ietf.org/html/draft-zyp-json-schema-04#section-5.6
|
|
196
|
+
*/
|
|
197
|
+
[k: string]: any;
|
|
198
|
+
format?: string | undefined;
|
|
199
|
+
}
|
|
200
|
+
// ==================================================================================================
|
|
201
|
+
// JSON Schema Draft 06
|
|
202
|
+
// ==================================================================================================
|
|
203
|
+
type JSONSchema6TypeName = "string" //
|
|
204
|
+
| "number" | "integer" | "boolean" | "object" | "array" | "null" | "any";
|
|
205
|
+
type JSONSchema6Type = string //
|
|
206
|
+
| number | boolean | JSONSchema6Object | JSONSchema6Array | null;
|
|
207
|
+
// Workaround for infinite type recursion
|
|
208
|
+
interface JSONSchema6Object {
|
|
209
|
+
[key: string]: JSONSchema6Type;
|
|
210
|
+
}
|
|
211
|
+
// Workaround for infinite type recursion
|
|
212
|
+
// https://github.com/Microsoft/TypeScript/issues/3496#issuecomment-128553540
|
|
213
|
+
interface JSONSchema6Array extends Array<JSONSchema6Type> {}
|
|
214
|
+
/**
|
|
215
|
+
* Meta schema
|
|
216
|
+
*
|
|
217
|
+
* Recommended values:
|
|
218
|
+
* - 'http://json-schema.org/schema#'
|
|
219
|
+
* - 'http://json-schema.org/hyper-schema#'
|
|
220
|
+
* - 'http://json-schema.org/draft-06/schema#'
|
|
221
|
+
* - 'http://json-schema.org/draft-06/hyper-schema#'
|
|
222
|
+
*
|
|
223
|
+
* @see https://tools.ietf.org/html/draft-handrews-json-schema-validation-01#section-5
|
|
224
|
+
*/
|
|
225
|
+
type JSONSchema6Version = string;
|
|
226
|
+
/**
|
|
227
|
+
* JSON Schema V6
|
|
228
|
+
* @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01
|
|
229
|
+
*/
|
|
230
|
+
type JSONSchema6Definition = JSONSchema6 | boolean;
|
|
231
|
+
interface JSONSchema6 {
|
|
232
|
+
$id?: string | undefined;
|
|
233
|
+
$ref?: string | undefined;
|
|
234
|
+
$schema?: JSONSchema6Version | undefined;
|
|
235
|
+
/**
|
|
236
|
+
* Must be strictly greater than 0.
|
|
237
|
+
* A numeric instance is valid only if division by this keyword's value results in an integer.
|
|
238
|
+
* @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-6.1
|
|
239
|
+
*/
|
|
240
|
+
multipleOf?: number | undefined;
|
|
241
|
+
/**
|
|
242
|
+
* Representing an inclusive upper limit for a numeric instance.
|
|
243
|
+
* This keyword validates only if the instance is less than or exactly equal to "maximum".
|
|
244
|
+
* @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-6.2
|
|
245
|
+
*/
|
|
246
|
+
maximum?: number | undefined;
|
|
247
|
+
/**
|
|
248
|
+
* Representing an exclusive upper limit for a numeric instance.
|
|
249
|
+
* This keyword validates only if the instance is strictly less than (not equal to) to "exclusiveMaximum".
|
|
250
|
+
* @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-6.3
|
|
251
|
+
*/
|
|
252
|
+
exclusiveMaximum?: number | undefined;
|
|
253
|
+
/**
|
|
254
|
+
* Representing an inclusive lower limit for a numeric instance.
|
|
255
|
+
* This keyword validates only if the instance is greater than or exactly equal to "minimum".
|
|
256
|
+
* @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-6.4
|
|
257
|
+
*/
|
|
258
|
+
minimum?: number | undefined;
|
|
259
|
+
/**
|
|
260
|
+
* Representing an exclusive lower limit for a numeric instance.
|
|
261
|
+
* This keyword validates only if the instance is strictly greater than (not equal to) to "exclusiveMinimum".
|
|
262
|
+
* @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-6.5
|
|
263
|
+
*/
|
|
264
|
+
exclusiveMinimum?: number | undefined;
|
|
265
|
+
/**
|
|
266
|
+
* Must be a non-negative integer.
|
|
267
|
+
* A string instance is valid against this keyword if its length is less than, or equal to, the value of this keyword.
|
|
268
|
+
* @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-6.6
|
|
269
|
+
*/
|
|
270
|
+
maxLength?: number | undefined;
|
|
271
|
+
/**
|
|
272
|
+
* Must be a non-negative integer.
|
|
273
|
+
* A string instance is valid against this keyword if its length is greater than, or equal to, the value of this keyword.
|
|
274
|
+
* Omitting this keyword has the same behavior as a value of 0.
|
|
275
|
+
* @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-6.7
|
|
276
|
+
*/
|
|
277
|
+
minLength?: number | undefined;
|
|
278
|
+
/**
|
|
279
|
+
* Should be a valid regular expression, according to the ECMA 262 regular expression dialect.
|
|
280
|
+
* @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-6.8
|
|
281
|
+
*/
|
|
282
|
+
pattern?: string | undefined;
|
|
283
|
+
/**
|
|
284
|
+
* This keyword determines how child instances validate for arrays, and does not directly validate the immediate instance itself.
|
|
285
|
+
* Omitting this keyword has the same behavior as an empty schema.
|
|
286
|
+
* @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-6.9
|
|
287
|
+
*/
|
|
288
|
+
items?: JSONSchema6Definition | JSONSchema6Definition[] | undefined;
|
|
289
|
+
/**
|
|
290
|
+
* This keyword determines how child instances validate for arrays, and does not directly validate the immediate instance itself.
|
|
291
|
+
* If "items" is an array of schemas, validation succeeds if every instance element
|
|
292
|
+
* at a position greater than the size of "items" validates against "additionalItems".
|
|
293
|
+
* Otherwise, "additionalItems" MUST be ignored, as the "items" schema
|
|
294
|
+
* (possibly the default value of an empty schema) is applied to all elements.
|
|
295
|
+
* Omitting this keyword has the same behavior as an empty schema.
|
|
296
|
+
* @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-6.10
|
|
297
|
+
*/
|
|
298
|
+
additionalItems?: JSONSchema6Definition | undefined;
|
|
299
|
+
/**
|
|
300
|
+
* Must be a non-negative integer.
|
|
301
|
+
* An array instance is valid against "maxItems" if its size is less than, or equal to, the value of this keyword.
|
|
302
|
+
* @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-6.11
|
|
303
|
+
*/
|
|
304
|
+
maxItems?: number | undefined;
|
|
305
|
+
/**
|
|
306
|
+
* Must be a non-negative integer.
|
|
307
|
+
* An array instance is valid against "maxItems" if its size is greater than, or equal to, the value of this keyword.
|
|
308
|
+
* Omitting this keyword has the same behavior as a value of 0.
|
|
309
|
+
* @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-6.12
|
|
310
|
+
*/
|
|
311
|
+
minItems?: number | undefined;
|
|
312
|
+
/**
|
|
313
|
+
* If this keyword has boolean value false, the instance validates successfully.
|
|
314
|
+
* If it has boolean value true, the instance validates successfully if all of its elements are unique.
|
|
315
|
+
* Omitting this keyword has the same behavior as a value of false.
|
|
316
|
+
* @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-6.13
|
|
317
|
+
*/
|
|
318
|
+
uniqueItems?: boolean | undefined;
|
|
319
|
+
/**
|
|
320
|
+
* An array instance is valid against "contains" if at least one of its elements is valid against the given schema.
|
|
321
|
+
* @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-6.14
|
|
322
|
+
*/
|
|
323
|
+
contains?: JSONSchema6Definition | undefined;
|
|
324
|
+
/**
|
|
325
|
+
* Must be a non-negative integer.
|
|
326
|
+
* An object instance is valid against "maxProperties" if its number of properties is less than, or equal to, the value of this keyword.
|
|
327
|
+
* @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-6.15
|
|
328
|
+
*/
|
|
329
|
+
maxProperties?: number | undefined;
|
|
330
|
+
/**
|
|
331
|
+
* Must be a non-negative integer.
|
|
332
|
+
* An object instance is valid against "maxProperties" if its number of properties is greater than,
|
|
333
|
+
* or equal to, the value of this keyword.
|
|
334
|
+
* Omitting this keyword has the same behavior as a value of 0.
|
|
335
|
+
* @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-6.16
|
|
336
|
+
*/
|
|
337
|
+
minProperties?: number | undefined;
|
|
338
|
+
/**
|
|
339
|
+
* Elements of this array must be unique.
|
|
340
|
+
* An object instance is valid against this keyword if every item in the array is the name of a property in the instance.
|
|
341
|
+
* Omitting this keyword has the same behavior as an empty array.
|
|
342
|
+
*
|
|
343
|
+
* @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-6.17
|
|
344
|
+
*/
|
|
345
|
+
required?: string[] | undefined;
|
|
346
|
+
/**
|
|
347
|
+
* This keyword determines how child instances validate for objects, and does not directly validate the immediate instance itself.
|
|
348
|
+
* Validation succeeds if, for each name that appears in both the instance and as a name within this keyword's value,
|
|
349
|
+
* the child instance for that name successfully validates against the corresponding schema.
|
|
350
|
+
* Omitting this keyword has the same behavior as an empty object.
|
|
351
|
+
* @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-6.18
|
|
352
|
+
*/
|
|
353
|
+
properties?: {
|
|
354
|
+
[k: string]: JSONSchema6Definition;
|
|
355
|
+
} | undefined;
|
|
356
|
+
/**
|
|
357
|
+
* This attribute is an object that defines the schema for a set of property names of an object instance.
|
|
358
|
+
* The name of each property of this attribute's object is a regular expression pattern in the ECMA 262, while the value is a schema.
|
|
359
|
+
* If the pattern matches the name of a property on the instance object, the value of the instance's property
|
|
360
|
+
* MUST be valid against the pattern name's schema value.
|
|
361
|
+
* Omitting this keyword has the same behavior as an empty object.
|
|
362
|
+
* @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-6.19
|
|
363
|
+
*/
|
|
364
|
+
patternProperties?: {
|
|
365
|
+
[k: string]: JSONSchema6Definition;
|
|
366
|
+
} | undefined;
|
|
367
|
+
/**
|
|
368
|
+
* This attribute defines a schema for all properties that are not explicitly defined in an object type definition.
|
|
369
|
+
* If specified, the value MUST be a schema or a boolean.
|
|
370
|
+
* If false is provided, no additional properties are allowed beyond the properties defined in the schema.
|
|
371
|
+
* The default value is an empty schema which allows any value for additional properties.
|
|
372
|
+
* @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-6.20
|
|
373
|
+
*/
|
|
374
|
+
additionalProperties?: JSONSchema6Definition | undefined;
|
|
375
|
+
/**
|
|
376
|
+
* This keyword specifies rules that are evaluated if the instance is an object and contains a certain property.
|
|
377
|
+
* Each property specifies a dependency.
|
|
378
|
+
* If the dependency value is an array, each element in the array must be unique.
|
|
379
|
+
* Omitting this keyword has the same behavior as an empty object.
|
|
380
|
+
* @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-6.21
|
|
381
|
+
*/
|
|
382
|
+
dependencies?: {
|
|
383
|
+
[k: string]: JSONSchema6Definition | string[];
|
|
384
|
+
} | undefined;
|
|
385
|
+
/**
|
|
386
|
+
* Takes a schema which validates the names of all properties rather than their values.
|
|
387
|
+
* Note the property name that the schema is testing will always be a string.
|
|
388
|
+
* Omitting this keyword has the same behavior as an empty schema.
|
|
389
|
+
* @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-6.22
|
|
390
|
+
*/
|
|
391
|
+
propertyNames?: JSONSchema6Definition | undefined;
|
|
392
|
+
/**
|
|
393
|
+
* This provides an enumeration of all possible values that are valid
|
|
394
|
+
* for the instance property. This MUST be an array, and each item in
|
|
395
|
+
* the array represents a possible value for the instance value. If
|
|
396
|
+
* this attribute is defined, the instance value MUST be one of the
|
|
397
|
+
* values in the array in order for the schema to be valid.
|
|
398
|
+
*
|
|
399
|
+
* @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-6.23
|
|
400
|
+
*/
|
|
401
|
+
enum?: JSONSchema6Type[] | undefined;
|
|
402
|
+
/**
|
|
403
|
+
* More readable form of a one-element "enum"
|
|
404
|
+
* @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-6.24
|
|
405
|
+
*/
|
|
406
|
+
const?: JSONSchema6Type | undefined;
|
|
407
|
+
/**
|
|
408
|
+
* A single type, or a union of simple types
|
|
409
|
+
* @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-6.25
|
|
410
|
+
*/
|
|
411
|
+
type?: JSONSchema6TypeName | JSONSchema6TypeName[] | undefined;
|
|
412
|
+
/**
|
|
413
|
+
* @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-6.26
|
|
414
|
+
*/
|
|
415
|
+
allOf?: JSONSchema6Definition[] | undefined;
|
|
416
|
+
/**
|
|
417
|
+
* @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-6.27
|
|
418
|
+
*/
|
|
419
|
+
anyOf?: JSONSchema6Definition[] | undefined;
|
|
420
|
+
/**
|
|
421
|
+
* @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-6.28
|
|
422
|
+
*/
|
|
423
|
+
oneOf?: JSONSchema6Definition[] | undefined;
|
|
424
|
+
/**
|
|
425
|
+
* @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-6.29
|
|
426
|
+
*/
|
|
427
|
+
not?: JSONSchema6Definition | undefined;
|
|
428
|
+
/**
|
|
429
|
+
* @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-7.1
|
|
430
|
+
*/
|
|
431
|
+
definitions?: {
|
|
432
|
+
[k: string]: JSONSchema6Definition;
|
|
433
|
+
} | undefined;
|
|
434
|
+
/**
|
|
435
|
+
* This attribute is a string that provides a short description of the instance property.
|
|
436
|
+
*
|
|
437
|
+
* @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-7.2
|
|
438
|
+
*/
|
|
439
|
+
title?: string | undefined;
|
|
440
|
+
/**
|
|
441
|
+
* This attribute is a string that provides a full description of the of purpose the instance property.
|
|
442
|
+
*
|
|
443
|
+
* @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-7.2
|
|
444
|
+
*/
|
|
445
|
+
description?: string | undefined;
|
|
446
|
+
/**
|
|
447
|
+
* This keyword can be used to supply a default JSON value associated with a particular schema.
|
|
448
|
+
* It is RECOMMENDED that a default value be valid against the associated schema.
|
|
449
|
+
* @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-7.3
|
|
450
|
+
*/
|
|
451
|
+
default?: JSONSchema6Type | undefined;
|
|
452
|
+
/**
|
|
453
|
+
* Array of examples with no validation effect the value of "default" is usable as an example without repeating it under this keyword
|
|
454
|
+
* @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-7.4
|
|
455
|
+
*/
|
|
456
|
+
examples?: JSONSchema6Type[] | undefined;
|
|
457
|
+
/**
|
|
458
|
+
* @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-8
|
|
459
|
+
*/
|
|
460
|
+
format?: string | undefined;
|
|
461
|
+
}
|
|
462
|
+
// ==================================================================================================
|
|
463
|
+
// JSON Schema Draft 07
|
|
464
|
+
// ==================================================================================================
|
|
465
|
+
// https://tools.ietf.org/html/draft-handrews-json-schema-validation-01
|
|
466
|
+
// --------------------------------------------------------------------------------------------------
|
|
467
|
+
/**
|
|
468
|
+
* Primitive type
|
|
469
|
+
* @see https://tools.ietf.org/html/draft-handrews-json-schema-validation-01#section-6.1.1
|
|
470
|
+
*/
|
|
471
|
+
type JSONSchema7TypeName = "string" //
|
|
472
|
+
| "number" | "integer" | "boolean" | "object" | "array" | "null";
|
|
473
|
+
/**
|
|
474
|
+
* Primitive type
|
|
475
|
+
* @see https://tools.ietf.org/html/draft-handrews-json-schema-validation-01#section-6.1.1
|
|
476
|
+
*/
|
|
477
|
+
type JSONSchema7Type = string //
|
|
478
|
+
| number | boolean | JSONSchema7Object | JSONSchema7Array | null;
|
|
479
|
+
// Workaround for infinite type recursion
|
|
480
|
+
interface JSONSchema7Object {
|
|
481
|
+
[key: string]: JSONSchema7Type;
|
|
482
|
+
}
|
|
483
|
+
// Workaround for infinite type recursion
|
|
484
|
+
// https://github.com/Microsoft/TypeScript/issues/3496#issuecomment-128553540
|
|
485
|
+
interface JSONSchema7Array extends Array<JSONSchema7Type> {}
|
|
486
|
+
/**
|
|
487
|
+
* Meta schema
|
|
488
|
+
*
|
|
489
|
+
* Recommended values:
|
|
490
|
+
* - 'http://json-schema.org/schema#'
|
|
491
|
+
* - 'http://json-schema.org/hyper-schema#'
|
|
492
|
+
* - 'http://json-schema.org/draft-07/schema#'
|
|
493
|
+
* - 'http://json-schema.org/draft-07/hyper-schema#'
|
|
494
|
+
*
|
|
495
|
+
* @see https://tools.ietf.org/html/draft-handrews-json-schema-validation-01#section-5
|
|
496
|
+
*/
|
|
497
|
+
type JSONSchema7Version = string;
|
|
498
|
+
/**
|
|
499
|
+
* JSON Schema v7
|
|
500
|
+
* @see https://tools.ietf.org/html/draft-handrews-json-schema-validation-01
|
|
501
|
+
*/
|
|
502
|
+
type JSONSchema7Definition = JSONSchema7 | boolean;
|
|
503
|
+
interface JSONSchema7 {
|
|
504
|
+
$id?: string | undefined;
|
|
505
|
+
$ref?: string | undefined;
|
|
506
|
+
$schema?: JSONSchema7Version | undefined;
|
|
507
|
+
$comment?: string | undefined;
|
|
508
|
+
/**
|
|
509
|
+
* @see https://datatracker.ietf.org/doc/html/draft-bhutton-json-schema-00#section-8.2.4
|
|
510
|
+
* @see https://datatracker.ietf.org/doc/html/draft-bhutton-json-schema-validation-00#appendix-A
|
|
511
|
+
*/
|
|
512
|
+
$defs?: {
|
|
513
|
+
[key: string]: JSONSchema7Definition;
|
|
514
|
+
} | undefined;
|
|
515
|
+
/**
|
|
516
|
+
* @see https://tools.ietf.org/html/draft-handrews-json-schema-validation-01#section-6.1
|
|
517
|
+
*/
|
|
518
|
+
type?: JSONSchema7TypeName | JSONSchema7TypeName[] | undefined;
|
|
519
|
+
enum?: JSONSchema7Type[] | undefined;
|
|
520
|
+
const?: JSONSchema7Type | undefined;
|
|
521
|
+
/**
|
|
522
|
+
* @see https://tools.ietf.org/html/draft-handrews-json-schema-validation-01#section-6.2
|
|
523
|
+
*/
|
|
524
|
+
multipleOf?: number | undefined;
|
|
525
|
+
maximum?: number | undefined;
|
|
526
|
+
exclusiveMaximum?: number | undefined;
|
|
527
|
+
minimum?: number | undefined;
|
|
528
|
+
exclusiveMinimum?: number | undefined;
|
|
529
|
+
/**
|
|
530
|
+
* @see https://tools.ietf.org/html/draft-handrews-json-schema-validation-01#section-6.3
|
|
531
|
+
*/
|
|
532
|
+
maxLength?: number | undefined;
|
|
533
|
+
minLength?: number | undefined;
|
|
534
|
+
pattern?: string | undefined;
|
|
535
|
+
/**
|
|
536
|
+
* @see https://tools.ietf.org/html/draft-handrews-json-schema-validation-01#section-6.4
|
|
537
|
+
*/
|
|
538
|
+
items?: JSONSchema7Definition | JSONSchema7Definition[] | undefined;
|
|
539
|
+
additionalItems?: JSONSchema7Definition | undefined;
|
|
540
|
+
maxItems?: number | undefined;
|
|
541
|
+
minItems?: number | undefined;
|
|
542
|
+
uniqueItems?: boolean | undefined;
|
|
543
|
+
contains?: JSONSchema7Definition | undefined;
|
|
544
|
+
/**
|
|
545
|
+
* @see https://tools.ietf.org/html/draft-handrews-json-schema-validation-01#section-6.5
|
|
546
|
+
*/
|
|
547
|
+
maxProperties?: number | undefined;
|
|
548
|
+
minProperties?: number | undefined;
|
|
549
|
+
required?: string[] | undefined;
|
|
550
|
+
properties?: {
|
|
551
|
+
[key: string]: JSONSchema7Definition;
|
|
552
|
+
} | undefined;
|
|
553
|
+
patternProperties?: {
|
|
554
|
+
[key: string]: JSONSchema7Definition;
|
|
555
|
+
} | undefined;
|
|
556
|
+
additionalProperties?: JSONSchema7Definition | undefined;
|
|
557
|
+
dependencies?: {
|
|
558
|
+
[key: string]: JSONSchema7Definition | string[];
|
|
559
|
+
} | undefined;
|
|
560
|
+
propertyNames?: JSONSchema7Definition | undefined;
|
|
561
|
+
/**
|
|
562
|
+
* @see https://tools.ietf.org/html/draft-handrews-json-schema-validation-01#section-6.6
|
|
563
|
+
*/
|
|
564
|
+
if?: JSONSchema7Definition | undefined;
|
|
565
|
+
then?: JSONSchema7Definition | undefined;
|
|
566
|
+
else?: JSONSchema7Definition | undefined;
|
|
567
|
+
/**
|
|
568
|
+
* @see https://tools.ietf.org/html/draft-handrews-json-schema-validation-01#section-6.7
|
|
569
|
+
*/
|
|
570
|
+
allOf?: JSONSchema7Definition[] | undefined;
|
|
571
|
+
anyOf?: JSONSchema7Definition[] | undefined;
|
|
572
|
+
oneOf?: JSONSchema7Definition[] | undefined;
|
|
573
|
+
not?: JSONSchema7Definition | undefined;
|
|
574
|
+
/**
|
|
575
|
+
* @see https://tools.ietf.org/html/draft-handrews-json-schema-validation-01#section-7
|
|
576
|
+
*/
|
|
577
|
+
format?: string | undefined;
|
|
578
|
+
/**
|
|
579
|
+
* @see https://tools.ietf.org/html/draft-handrews-json-schema-validation-01#section-8
|
|
580
|
+
*/
|
|
581
|
+
contentMediaType?: string | undefined;
|
|
582
|
+
contentEncoding?: string | undefined;
|
|
583
|
+
/**
|
|
584
|
+
* @see https://tools.ietf.org/html/draft-handrews-json-schema-validation-01#section-9
|
|
585
|
+
*/
|
|
586
|
+
definitions?: {
|
|
587
|
+
[key: string]: JSONSchema7Definition;
|
|
588
|
+
} | undefined;
|
|
589
|
+
/**
|
|
590
|
+
* @see https://tools.ietf.org/html/draft-handrews-json-schema-validation-01#section-10
|
|
591
|
+
*/
|
|
592
|
+
title?: string | undefined;
|
|
593
|
+
description?: string | undefined;
|
|
594
|
+
default?: JSONSchema7Type | undefined;
|
|
595
|
+
readOnly?: boolean | undefined;
|
|
596
|
+
writeOnly?: boolean | undefined;
|
|
597
|
+
examples?: JSONSchema7Type | undefined;
|
|
598
|
+
}
|
|
599
|
+
//#endregion
|
|
600
|
+
//#region ../../node_modules/.pnpm/openapi-types@12.1.3/node_modules/openapi-types/dist/index.d.ts
|
|
601
|
+
declare namespace OpenAPIV3_1 {
|
|
602
|
+
type Modify<T, R> = Omit<T, keyof R> & R;
|
|
603
|
+
type PathsWebhooksComponents<T extends {} = {}> = {
|
|
604
|
+
paths: PathsObject<T>;
|
|
605
|
+
webhooks: Record<string, PathItemObject | ReferenceObject>;
|
|
606
|
+
components: ComponentsObject;
|
|
607
|
+
};
|
|
608
|
+
export type Document<T extends {} = {}> = Modify<Omit<OpenAPIV3.Document<T>, 'paths' | 'components'>, {
|
|
609
|
+
info: InfoObject;
|
|
610
|
+
jsonSchemaDialect?: string;
|
|
611
|
+
servers?: ServerObject[];
|
|
612
|
+
} & ((Pick<PathsWebhooksComponents<T>, 'paths'> & Omit<Partial<PathsWebhooksComponents<T>>, 'paths'>) | (Pick<PathsWebhooksComponents<T>, 'webhooks'> & Omit<Partial<PathsWebhooksComponents<T>>, 'webhooks'>) | (Pick<PathsWebhooksComponents<T>, 'components'> & Omit<Partial<PathsWebhooksComponents<T>>, 'components'>))>;
|
|
613
|
+
export type InfoObject = Modify<OpenAPIV3.InfoObject, {
|
|
614
|
+
summary?: string;
|
|
615
|
+
license?: LicenseObject;
|
|
616
|
+
}>;
|
|
617
|
+
export type ContactObject = OpenAPIV3.ContactObject;
|
|
618
|
+
export type LicenseObject = Modify<OpenAPIV3.LicenseObject, {
|
|
619
|
+
identifier?: string;
|
|
620
|
+
}>;
|
|
621
|
+
export type ServerObject = Modify<OpenAPIV3.ServerObject, {
|
|
622
|
+
url: string;
|
|
623
|
+
description?: string;
|
|
624
|
+
variables?: Record<string, ServerVariableObject>;
|
|
625
|
+
}>;
|
|
626
|
+
export type ServerVariableObject = Modify<OpenAPIV3.ServerVariableObject, {
|
|
627
|
+
enum?: [string, ...string[]];
|
|
628
|
+
}>;
|
|
629
|
+
export type PathsObject<T extends {} = {}, P extends {} = {}> = Record<string, (PathItemObject<T> & P) | undefined>;
|
|
630
|
+
export type HttpMethods = OpenAPIV3.HttpMethods;
|
|
631
|
+
export type PathItemObject<T extends {} = {}> = Modify<OpenAPIV3.PathItemObject<T>, {
|
|
632
|
+
servers?: ServerObject[];
|
|
633
|
+
parameters?: (ReferenceObject | ParameterObject)[];
|
|
634
|
+
}> & { [method in HttpMethods]?: OperationObject<T>; };
|
|
635
|
+
export type OperationObject<T extends {} = {}> = Modify<OpenAPIV3.OperationObject<T>, {
|
|
636
|
+
parameters?: (ReferenceObject | ParameterObject)[];
|
|
637
|
+
requestBody?: ReferenceObject | RequestBodyObject;
|
|
638
|
+
responses?: ResponsesObject;
|
|
639
|
+
callbacks?: Record<string, ReferenceObject | CallbackObject>;
|
|
640
|
+
servers?: ServerObject[];
|
|
641
|
+
}> & T;
|
|
642
|
+
export type ExternalDocumentationObject = OpenAPIV3.ExternalDocumentationObject;
|
|
643
|
+
export type ParameterObject = OpenAPIV3.ParameterObject;
|
|
644
|
+
export type HeaderObject = OpenAPIV3.HeaderObject;
|
|
645
|
+
export type ParameterBaseObject = OpenAPIV3.ParameterBaseObject;
|
|
646
|
+
export type NonArraySchemaObjectType = OpenAPIV3.NonArraySchemaObjectType | 'null';
|
|
647
|
+
export type ArraySchemaObjectType = OpenAPIV3.ArraySchemaObjectType;
|
|
648
|
+
/**
|
|
649
|
+
* There is no way to tell typescript to require items when type is either 'array' or array containing 'array' type
|
|
650
|
+
* 'items' will be always visible as optional
|
|
651
|
+
* Casting schema object to ArraySchemaObject or NonArraySchemaObject will work fine
|
|
652
|
+
*/
|
|
653
|
+
export type SchemaObject = ArraySchemaObject | NonArraySchemaObject | MixedSchemaObject;
|
|
654
|
+
export interface ArraySchemaObject extends BaseSchemaObject {
|
|
655
|
+
type: ArraySchemaObjectType;
|
|
656
|
+
items: ReferenceObject | SchemaObject;
|
|
657
|
+
}
|
|
658
|
+
export interface NonArraySchemaObject extends BaseSchemaObject {
|
|
659
|
+
type?: NonArraySchemaObjectType;
|
|
660
|
+
}
|
|
661
|
+
interface MixedSchemaObject extends BaseSchemaObject {
|
|
662
|
+
type?: (ArraySchemaObjectType | NonArraySchemaObjectType)[];
|
|
663
|
+
items?: ReferenceObject | SchemaObject;
|
|
664
|
+
}
|
|
665
|
+
export type BaseSchemaObject = Modify<Omit<OpenAPIV3.BaseSchemaObject, 'nullable'>, {
|
|
666
|
+
examples?: OpenAPIV3.BaseSchemaObject['example'][];
|
|
667
|
+
exclusiveMinimum?: boolean | number;
|
|
668
|
+
exclusiveMaximum?: boolean | number;
|
|
669
|
+
contentMediaType?: string;
|
|
670
|
+
$schema?: string;
|
|
671
|
+
additionalProperties?: boolean | ReferenceObject | SchemaObject;
|
|
672
|
+
properties?: {
|
|
673
|
+
[name: string]: ReferenceObject | SchemaObject;
|
|
674
|
+
};
|
|
675
|
+
allOf?: (ReferenceObject | SchemaObject)[];
|
|
676
|
+
oneOf?: (ReferenceObject | SchemaObject)[];
|
|
677
|
+
anyOf?: (ReferenceObject | SchemaObject)[];
|
|
678
|
+
not?: ReferenceObject | SchemaObject;
|
|
679
|
+
discriminator?: DiscriminatorObject;
|
|
680
|
+
externalDocs?: ExternalDocumentationObject;
|
|
681
|
+
xml?: XMLObject;
|
|
682
|
+
const?: any;
|
|
683
|
+
}>;
|
|
684
|
+
export type DiscriminatorObject = OpenAPIV3.DiscriminatorObject;
|
|
685
|
+
export type XMLObject = OpenAPIV3.XMLObject;
|
|
686
|
+
export type ReferenceObject = Modify<OpenAPIV3.ReferenceObject, {
|
|
687
|
+
summary?: string;
|
|
688
|
+
description?: string;
|
|
689
|
+
}>;
|
|
690
|
+
export type ExampleObject = OpenAPIV3.ExampleObject;
|
|
691
|
+
export type MediaTypeObject = Modify<OpenAPIV3.MediaTypeObject, {
|
|
692
|
+
schema?: SchemaObject | ReferenceObject;
|
|
693
|
+
examples?: Record<string, ReferenceObject | ExampleObject>;
|
|
694
|
+
}>;
|
|
695
|
+
export type EncodingObject = OpenAPIV3.EncodingObject;
|
|
696
|
+
export type RequestBodyObject = Modify<OpenAPIV3.RequestBodyObject, {
|
|
697
|
+
content: {
|
|
698
|
+
[media: string]: MediaTypeObject;
|
|
699
|
+
};
|
|
700
|
+
}>;
|
|
701
|
+
export type ResponsesObject = Record<string, ReferenceObject | ResponseObject>;
|
|
702
|
+
export type ResponseObject = Modify<OpenAPIV3.ResponseObject, {
|
|
703
|
+
headers?: {
|
|
704
|
+
[header: string]: ReferenceObject | HeaderObject;
|
|
705
|
+
};
|
|
706
|
+
content?: {
|
|
707
|
+
[media: string]: MediaTypeObject;
|
|
708
|
+
};
|
|
709
|
+
links?: {
|
|
710
|
+
[link: string]: ReferenceObject | LinkObject;
|
|
711
|
+
};
|
|
712
|
+
}>;
|
|
713
|
+
export type LinkObject = Modify<OpenAPIV3.LinkObject, {
|
|
714
|
+
server?: ServerObject;
|
|
715
|
+
}>;
|
|
716
|
+
export type CallbackObject = Record<string, PathItemObject | ReferenceObject>;
|
|
717
|
+
export type SecurityRequirementObject = OpenAPIV3.SecurityRequirementObject;
|
|
718
|
+
export type ComponentsObject = Modify<OpenAPIV3.ComponentsObject, {
|
|
719
|
+
schemas?: Record<string, SchemaObject>;
|
|
720
|
+
responses?: Record<string, ReferenceObject | ResponseObject>;
|
|
721
|
+
parameters?: Record<string, ReferenceObject | ParameterObject>;
|
|
722
|
+
examples?: Record<string, ReferenceObject | ExampleObject>;
|
|
723
|
+
requestBodies?: Record<string, ReferenceObject | RequestBodyObject>;
|
|
724
|
+
headers?: Record<string, ReferenceObject | HeaderObject>;
|
|
725
|
+
securitySchemes?: Record<string, ReferenceObject | SecuritySchemeObject>;
|
|
726
|
+
links?: Record<string, ReferenceObject | LinkObject>;
|
|
727
|
+
callbacks?: Record<string, ReferenceObject | CallbackObject>;
|
|
728
|
+
pathItems?: Record<string, ReferenceObject | PathItemObject>;
|
|
729
|
+
}>;
|
|
730
|
+
export type SecuritySchemeObject = OpenAPIV3.SecuritySchemeObject;
|
|
731
|
+
export type HttpSecurityScheme = OpenAPIV3.HttpSecurityScheme;
|
|
732
|
+
export type ApiKeySecurityScheme = OpenAPIV3.ApiKeySecurityScheme;
|
|
733
|
+
export type OAuth2SecurityScheme = OpenAPIV3.OAuth2SecurityScheme;
|
|
734
|
+
export type OpenIdSecurityScheme = OpenAPIV3.OpenIdSecurityScheme;
|
|
735
|
+
export type TagObject = OpenAPIV3.TagObject;
|
|
736
|
+
export {};
|
|
737
|
+
}
|
|
738
|
+
declare namespace OpenAPIV3 {
|
|
739
|
+
interface Document<T extends {} = {}> {
|
|
740
|
+
openapi: string;
|
|
741
|
+
info: InfoObject;
|
|
742
|
+
servers?: ServerObject[];
|
|
743
|
+
paths: PathsObject<T>;
|
|
744
|
+
components?: ComponentsObject;
|
|
745
|
+
security?: SecurityRequirementObject[];
|
|
746
|
+
tags?: TagObject[];
|
|
747
|
+
externalDocs?: ExternalDocumentationObject;
|
|
748
|
+
'x-express-openapi-additional-middleware'?: (((request: any, response: any, next: any) => Promise<void>) | ((request: any, response: any, next: any) => void))[];
|
|
749
|
+
'x-express-openapi-validation-strict'?: boolean;
|
|
750
|
+
}
|
|
751
|
+
interface InfoObject {
|
|
752
|
+
title: string;
|
|
753
|
+
description?: string;
|
|
754
|
+
termsOfService?: string;
|
|
755
|
+
contact?: ContactObject;
|
|
756
|
+
license?: LicenseObject;
|
|
757
|
+
version: string;
|
|
758
|
+
}
|
|
759
|
+
interface ContactObject {
|
|
760
|
+
name?: string;
|
|
761
|
+
url?: string;
|
|
762
|
+
email?: string;
|
|
763
|
+
}
|
|
764
|
+
interface LicenseObject {
|
|
765
|
+
name: string;
|
|
766
|
+
url?: string;
|
|
767
|
+
}
|
|
768
|
+
interface ServerObject {
|
|
769
|
+
url: string;
|
|
770
|
+
description?: string;
|
|
771
|
+
variables?: {
|
|
772
|
+
[variable: string]: ServerVariableObject;
|
|
773
|
+
};
|
|
774
|
+
}
|
|
775
|
+
interface ServerVariableObject {
|
|
776
|
+
enum?: string[];
|
|
777
|
+
default: string;
|
|
778
|
+
description?: string;
|
|
779
|
+
}
|
|
780
|
+
interface PathsObject<T extends {} = {}, P extends {} = {}> {
|
|
781
|
+
[pattern: string]: (PathItemObject<T> & P) | undefined;
|
|
782
|
+
}
|
|
783
|
+
enum HttpMethods {
|
|
784
|
+
GET = "get",
|
|
785
|
+
PUT = "put",
|
|
786
|
+
POST = "post",
|
|
787
|
+
DELETE = "delete",
|
|
788
|
+
OPTIONS = "options",
|
|
789
|
+
HEAD = "head",
|
|
790
|
+
PATCH = "patch",
|
|
791
|
+
TRACE = "trace"
|
|
792
|
+
}
|
|
793
|
+
type PathItemObject<T extends {} = {}> = {
|
|
794
|
+
$ref?: string;
|
|
795
|
+
summary?: string;
|
|
796
|
+
description?: string;
|
|
797
|
+
servers?: ServerObject[];
|
|
798
|
+
parameters?: (ReferenceObject | ParameterObject)[];
|
|
799
|
+
} & { [method in HttpMethods]?: OperationObject<T>; };
|
|
800
|
+
type OperationObject<T extends {} = {}> = {
|
|
801
|
+
tags?: string[];
|
|
802
|
+
summary?: string;
|
|
803
|
+
description?: string;
|
|
804
|
+
externalDocs?: ExternalDocumentationObject;
|
|
805
|
+
operationId?: string;
|
|
806
|
+
parameters?: (ReferenceObject | ParameterObject)[];
|
|
807
|
+
requestBody?: ReferenceObject | RequestBodyObject;
|
|
808
|
+
responses: ResponsesObject;
|
|
809
|
+
callbacks?: {
|
|
810
|
+
[callback: string]: ReferenceObject | CallbackObject;
|
|
811
|
+
};
|
|
812
|
+
deprecated?: boolean;
|
|
813
|
+
security?: SecurityRequirementObject[];
|
|
814
|
+
servers?: ServerObject[];
|
|
815
|
+
} & T;
|
|
816
|
+
interface ExternalDocumentationObject {
|
|
817
|
+
description?: string;
|
|
818
|
+
url: string;
|
|
819
|
+
}
|
|
820
|
+
interface ParameterObject extends ParameterBaseObject {
|
|
821
|
+
name: string;
|
|
822
|
+
in: string;
|
|
823
|
+
}
|
|
824
|
+
interface HeaderObject extends ParameterBaseObject {}
|
|
825
|
+
interface ParameterBaseObject {
|
|
826
|
+
description?: string;
|
|
827
|
+
required?: boolean;
|
|
828
|
+
deprecated?: boolean;
|
|
829
|
+
allowEmptyValue?: boolean;
|
|
830
|
+
style?: string;
|
|
831
|
+
explode?: boolean;
|
|
832
|
+
allowReserved?: boolean;
|
|
833
|
+
schema?: ReferenceObject | SchemaObject;
|
|
834
|
+
example?: any;
|
|
835
|
+
examples?: {
|
|
836
|
+
[media: string]: ReferenceObject | ExampleObject;
|
|
837
|
+
};
|
|
838
|
+
content?: {
|
|
839
|
+
[media: string]: MediaTypeObject;
|
|
840
|
+
};
|
|
841
|
+
}
|
|
842
|
+
type NonArraySchemaObjectType = 'boolean' | 'object' | 'number' | 'string' | 'integer';
|
|
843
|
+
type ArraySchemaObjectType = 'array';
|
|
844
|
+
type SchemaObject = ArraySchemaObject | NonArraySchemaObject;
|
|
845
|
+
interface ArraySchemaObject extends BaseSchemaObject {
|
|
846
|
+
type: ArraySchemaObjectType;
|
|
847
|
+
items: ReferenceObject | SchemaObject;
|
|
848
|
+
}
|
|
849
|
+
interface NonArraySchemaObject extends BaseSchemaObject {
|
|
850
|
+
type?: NonArraySchemaObjectType;
|
|
851
|
+
}
|
|
852
|
+
interface BaseSchemaObject {
|
|
853
|
+
title?: string;
|
|
854
|
+
description?: string;
|
|
855
|
+
format?: string;
|
|
856
|
+
default?: any;
|
|
857
|
+
multipleOf?: number;
|
|
858
|
+
maximum?: number;
|
|
859
|
+
exclusiveMaximum?: boolean;
|
|
860
|
+
minimum?: number;
|
|
861
|
+
exclusiveMinimum?: boolean;
|
|
862
|
+
maxLength?: number;
|
|
863
|
+
minLength?: number;
|
|
864
|
+
pattern?: string;
|
|
865
|
+
additionalProperties?: boolean | ReferenceObject | SchemaObject;
|
|
866
|
+
maxItems?: number;
|
|
867
|
+
minItems?: number;
|
|
868
|
+
uniqueItems?: boolean;
|
|
869
|
+
maxProperties?: number;
|
|
870
|
+
minProperties?: number;
|
|
871
|
+
required?: string[];
|
|
872
|
+
enum?: any[];
|
|
873
|
+
properties?: {
|
|
874
|
+
[name: string]: ReferenceObject | SchemaObject;
|
|
875
|
+
};
|
|
876
|
+
allOf?: (ReferenceObject | SchemaObject)[];
|
|
877
|
+
oneOf?: (ReferenceObject | SchemaObject)[];
|
|
878
|
+
anyOf?: (ReferenceObject | SchemaObject)[];
|
|
879
|
+
not?: ReferenceObject | SchemaObject;
|
|
880
|
+
nullable?: boolean;
|
|
881
|
+
discriminator?: DiscriminatorObject;
|
|
882
|
+
readOnly?: boolean;
|
|
883
|
+
writeOnly?: boolean;
|
|
884
|
+
xml?: XMLObject;
|
|
885
|
+
externalDocs?: ExternalDocumentationObject;
|
|
886
|
+
example?: any;
|
|
887
|
+
deprecated?: boolean;
|
|
888
|
+
}
|
|
889
|
+
interface DiscriminatorObject {
|
|
890
|
+
propertyName: string;
|
|
891
|
+
mapping?: {
|
|
892
|
+
[value: string]: string;
|
|
893
|
+
};
|
|
894
|
+
}
|
|
895
|
+
interface XMLObject {
|
|
896
|
+
name?: string;
|
|
897
|
+
namespace?: string;
|
|
898
|
+
prefix?: string;
|
|
899
|
+
attribute?: boolean;
|
|
900
|
+
wrapped?: boolean;
|
|
901
|
+
}
|
|
902
|
+
interface ReferenceObject {
|
|
903
|
+
$ref: string;
|
|
904
|
+
}
|
|
905
|
+
interface ExampleObject {
|
|
906
|
+
summary?: string;
|
|
907
|
+
description?: string;
|
|
908
|
+
value?: any;
|
|
909
|
+
externalValue?: string;
|
|
910
|
+
}
|
|
911
|
+
interface MediaTypeObject {
|
|
912
|
+
schema?: ReferenceObject | SchemaObject;
|
|
913
|
+
example?: any;
|
|
914
|
+
examples?: {
|
|
915
|
+
[media: string]: ReferenceObject | ExampleObject;
|
|
916
|
+
};
|
|
917
|
+
encoding?: {
|
|
918
|
+
[media: string]: EncodingObject;
|
|
919
|
+
};
|
|
920
|
+
}
|
|
921
|
+
interface EncodingObject {
|
|
922
|
+
contentType?: string;
|
|
923
|
+
headers?: {
|
|
924
|
+
[header: string]: ReferenceObject | HeaderObject;
|
|
925
|
+
};
|
|
926
|
+
style?: string;
|
|
927
|
+
explode?: boolean;
|
|
928
|
+
allowReserved?: boolean;
|
|
929
|
+
}
|
|
930
|
+
interface RequestBodyObject {
|
|
931
|
+
description?: string;
|
|
932
|
+
content: {
|
|
933
|
+
[media: string]: MediaTypeObject;
|
|
934
|
+
};
|
|
935
|
+
required?: boolean;
|
|
936
|
+
}
|
|
937
|
+
interface ResponsesObject {
|
|
938
|
+
[code: string]: ReferenceObject | ResponseObject;
|
|
939
|
+
}
|
|
940
|
+
interface ResponseObject {
|
|
941
|
+
description: string;
|
|
942
|
+
headers?: {
|
|
943
|
+
[header: string]: ReferenceObject | HeaderObject;
|
|
944
|
+
};
|
|
945
|
+
content?: {
|
|
946
|
+
[media: string]: MediaTypeObject;
|
|
947
|
+
};
|
|
948
|
+
links?: {
|
|
949
|
+
[link: string]: ReferenceObject | LinkObject;
|
|
950
|
+
};
|
|
951
|
+
}
|
|
952
|
+
interface LinkObject {
|
|
953
|
+
operationRef?: string;
|
|
954
|
+
operationId?: string;
|
|
955
|
+
parameters?: {
|
|
956
|
+
[parameter: string]: any;
|
|
957
|
+
};
|
|
958
|
+
requestBody?: any;
|
|
959
|
+
description?: string;
|
|
960
|
+
server?: ServerObject;
|
|
961
|
+
}
|
|
962
|
+
interface CallbackObject {
|
|
963
|
+
[url: string]: PathItemObject;
|
|
964
|
+
}
|
|
965
|
+
interface SecurityRequirementObject {
|
|
966
|
+
[name: string]: string[];
|
|
967
|
+
}
|
|
968
|
+
interface ComponentsObject {
|
|
969
|
+
schemas?: {
|
|
970
|
+
[key: string]: ReferenceObject | SchemaObject;
|
|
971
|
+
};
|
|
972
|
+
responses?: {
|
|
973
|
+
[key: string]: ReferenceObject | ResponseObject;
|
|
974
|
+
};
|
|
975
|
+
parameters?: {
|
|
976
|
+
[key: string]: ReferenceObject | ParameterObject;
|
|
977
|
+
};
|
|
978
|
+
examples?: {
|
|
979
|
+
[key: string]: ReferenceObject | ExampleObject;
|
|
980
|
+
};
|
|
981
|
+
requestBodies?: {
|
|
982
|
+
[key: string]: ReferenceObject | RequestBodyObject;
|
|
983
|
+
};
|
|
984
|
+
headers?: {
|
|
985
|
+
[key: string]: ReferenceObject | HeaderObject;
|
|
986
|
+
};
|
|
987
|
+
securitySchemes?: {
|
|
988
|
+
[key: string]: ReferenceObject | SecuritySchemeObject;
|
|
989
|
+
};
|
|
990
|
+
links?: {
|
|
991
|
+
[key: string]: ReferenceObject | LinkObject;
|
|
992
|
+
};
|
|
993
|
+
callbacks?: {
|
|
994
|
+
[key: string]: ReferenceObject | CallbackObject;
|
|
995
|
+
};
|
|
996
|
+
}
|
|
997
|
+
type SecuritySchemeObject = HttpSecurityScheme | ApiKeySecurityScheme | OAuth2SecurityScheme | OpenIdSecurityScheme;
|
|
998
|
+
interface HttpSecurityScheme {
|
|
999
|
+
type: 'http';
|
|
1000
|
+
description?: string;
|
|
1001
|
+
scheme: string;
|
|
1002
|
+
bearerFormat?: string;
|
|
1003
|
+
}
|
|
1004
|
+
interface ApiKeySecurityScheme {
|
|
1005
|
+
type: 'apiKey';
|
|
1006
|
+
description?: string;
|
|
1007
|
+
name: string;
|
|
1008
|
+
in: string;
|
|
1009
|
+
}
|
|
1010
|
+
interface OAuth2SecurityScheme {
|
|
1011
|
+
type: 'oauth2';
|
|
1012
|
+
description?: string;
|
|
1013
|
+
flows: {
|
|
1014
|
+
implicit?: {
|
|
1015
|
+
authorizationUrl: string;
|
|
1016
|
+
refreshUrl?: string;
|
|
1017
|
+
scopes: {
|
|
1018
|
+
[scope: string]: string;
|
|
1019
|
+
};
|
|
1020
|
+
};
|
|
1021
|
+
password?: {
|
|
1022
|
+
tokenUrl: string;
|
|
1023
|
+
refreshUrl?: string;
|
|
1024
|
+
scopes: {
|
|
1025
|
+
[scope: string]: string;
|
|
1026
|
+
};
|
|
1027
|
+
};
|
|
1028
|
+
clientCredentials?: {
|
|
1029
|
+
tokenUrl: string;
|
|
1030
|
+
refreshUrl?: string;
|
|
1031
|
+
scopes: {
|
|
1032
|
+
[scope: string]: string;
|
|
1033
|
+
};
|
|
1034
|
+
};
|
|
1035
|
+
authorizationCode?: {
|
|
1036
|
+
authorizationUrl: string;
|
|
1037
|
+
tokenUrl: string;
|
|
1038
|
+
refreshUrl?: string;
|
|
1039
|
+
scopes: {
|
|
1040
|
+
[scope: string]: string;
|
|
1041
|
+
};
|
|
1042
|
+
};
|
|
1043
|
+
};
|
|
1044
|
+
}
|
|
1045
|
+
interface OpenIdSecurityScheme {
|
|
1046
|
+
type: 'openIdConnect';
|
|
1047
|
+
description?: string;
|
|
1048
|
+
openIdConnectUrl: string;
|
|
1049
|
+
}
|
|
1050
|
+
interface TagObject {
|
|
1051
|
+
name: string;
|
|
1052
|
+
description?: string;
|
|
1053
|
+
externalDocs?: ExternalDocumentationObject;
|
|
1054
|
+
}
|
|
1055
|
+
}
|
|
1056
|
+
//#endregion
|
|
1057
|
+
//#region src/types.d.ts
|
|
1058
|
+
/**
|
|
1059
|
+
* Media type used to pick a schema from an operation's request or response.
|
|
1060
|
+
*
|
|
1061
|
+
* @example
|
|
1062
|
+
* ```ts
|
|
1063
|
+
* const ct: ContentType = 'application/vnd.api+json'
|
|
1064
|
+
* ```
|
|
1065
|
+
*/
|
|
1066
|
+
type ContentType = 'application/json' | (string & {});
|
|
1067
|
+
/**
|
|
1068
|
+
* Extended OpenAPI 3.0 schema object that includes OpenAPI 3.1 and JSON Schema fields.
|
|
1069
|
+
* The parser uses these additional fields to handle newer spec versions.
|
|
1070
|
+
*
|
|
1071
|
+
* @example
|
|
1072
|
+
* ```ts
|
|
1073
|
+
* const schema: SchemaObject = {
|
|
1074
|
+
* type: 'string',
|
|
1075
|
+
* const: 'dog',
|
|
1076
|
+
* contentMediaType: 'application/octet-stream',
|
|
1077
|
+
* }
|
|
1078
|
+
* ```
|
|
1079
|
+
*/
|
|
1080
|
+
type SchemaObject$1 = {
|
|
1081
|
+
externalDocs?: unknown;
|
|
1082
|
+
xml?: unknown;
|
|
1083
|
+
$schema?: string;
|
|
1084
|
+
deprecated?: boolean;
|
|
1085
|
+
example?: unknown;
|
|
1086
|
+
examples?: Array<unknown>;
|
|
1087
|
+
nullable?: boolean;
|
|
1088
|
+
readOnly?: boolean;
|
|
1089
|
+
writeOnly?: boolean;
|
|
1090
|
+
discriminator?: DiscriminatorObject$1;
|
|
1091
|
+
'x-readme-ref-name'?: string;
|
|
1092
|
+
/**
|
|
1093
|
+
* OAS 3.0 vendor extension: marks a schema as nullable without using `type: ['null', ...]`.
|
|
1094
|
+
*/
|
|
1095
|
+
'x-nullable'?: boolean;
|
|
1096
|
+
/**
|
|
1097
|
+
* OAS 3.1: constrains the schema to a single fixed value (equivalent to a one-item `enum`).
|
|
1098
|
+
*/
|
|
1099
|
+
const?: string | number | boolean | null;
|
|
1100
|
+
/**
|
|
1101
|
+
* OAS 3.1: media type of the schema content. Raw `'application/octet-stream'` content maps to `blob`.
|
|
1102
|
+
*/
|
|
1103
|
+
contentMediaType?: string;
|
|
1104
|
+
/**
|
|
1105
|
+
* OAS 3.1: encoding applied to string content, such as `base64`.
|
|
1106
|
+
*/
|
|
1107
|
+
contentEncoding?: string;
|
|
1108
|
+
$ref?: string;
|
|
1109
|
+
/**
|
|
1110
|
+
* OAS 3.1: positional tuple items, replacing the multi-item `items` array from OAS 3.0.
|
|
1111
|
+
*/
|
|
1112
|
+
prefixItems?: Array<SchemaObject$1 | ReferenceObject$1>;
|
|
1113
|
+
/**
|
|
1114
|
+
* JSON Schema: maps regex patterns to sub-schemas for validating additional properties.
|
|
1115
|
+
*/
|
|
1116
|
+
patternProperties?: Record<string, SchemaObject$1 | boolean>;
|
|
1117
|
+
/**
|
|
1118
|
+
* Single-schema form of `items`. Narrowed from the base type to take precedence over the tuple overload.
|
|
1119
|
+
*
|
|
1120
|
+
* Alongside `prefixItems`, the JSON Schema boolean form applies: `items: false` closes the tuple
|
|
1121
|
+
* (no extra elements allowed), while `items: true` is equivalent to an unconstrained rest.
|
|
1122
|
+
*/
|
|
1123
|
+
items?: SchemaObject$1 | ReferenceObject$1 | boolean;
|
|
1124
|
+
/**
|
|
1125
|
+
* Allowed values for this schema.
|
|
1126
|
+
*/
|
|
1127
|
+
enum?: Array<string | number | boolean | null>;
|
|
1128
|
+
} & (OpenAPIV3_1.SchemaObject | JSONSchema4 | JSONSchema6 | JSONSchema7);
|
|
1129
|
+
/**
|
|
1130
|
+
* Normalized OpenAPI document after parsing.
|
|
1131
|
+
*/
|
|
1132
|
+
type Document = OpenAPIV3_1.Document & Record<string, unknown>;
|
|
1133
|
+
/**
|
|
1134
|
+
* Single operation object (the `get`/`post`/… entry on a path item) plus any vendor extensions.
|
|
1135
|
+
*/
|
|
1136
|
+
type OperationObject$1 = OpenAPIV3_1.OperationObject & Record<string, unknown>;
|
|
1137
|
+
/**
|
|
1138
|
+
* Path item object holding the operations and shared parameters for a single URL path.
|
|
1139
|
+
*/
|
|
1140
|
+
type PathItemObject$1 = OpenAPIV3_1.PathItemObject;
|
|
1141
|
+
/**
|
|
1142
|
+
* Discriminator object for `oneOf`/`anyOf` schemas in OpenAPI.
|
|
1143
|
+
*/
|
|
1144
|
+
type DiscriminatorObject$1 = OpenAPIV3_1.DiscriminatorObject;
|
|
1145
|
+
/**
|
|
1146
|
+
* OpenAPI reference object pointing to a schema definition via `$ref`.
|
|
1147
|
+
*/
|
|
1148
|
+
type ReferenceObject$1 = OpenAPIV3_1.ReferenceObject;
|
|
1149
|
+
/**
|
|
1150
|
+
* OpenAPI response object holding the content and headers for one status code.
|
|
1151
|
+
*/
|
|
1152
|
+
type ResponseObject$1 = OpenAPIV3_1.ResponseObject;
|
|
1153
|
+
/**
|
|
1154
|
+
* OpenAPI media type object that maps a content-type string to its schema.
|
|
1155
|
+
*/
|
|
1156
|
+
type MediaTypeObject$1 = OpenAPIV3_1.MediaTypeObject;
|
|
1157
|
+
/**
|
|
1158
|
+
* Selects which entry in the spec's `servers` array becomes the base URL and
|
|
1159
|
+
* supplies values for its `{variable}` placeholders.
|
|
1160
|
+
*/
|
|
1161
|
+
type ServerOptions = {
|
|
1162
|
+
/**
|
|
1163
|
+
* Index into the `servers` array from your OpenAPI spec. Most projects pick
|
|
1164
|
+
* `0` for the primary server. Omit to leave `baseURL` undefined.
|
|
1165
|
+
*/
|
|
1166
|
+
index?: number;
|
|
1167
|
+
/**
|
|
1168
|
+
* Override values for `{variable}` placeholders in the selected server URL.
|
|
1169
|
+
* Variables you do not provide use their `default` value from the spec.
|
|
1170
|
+
*/
|
|
1171
|
+
variables?: Record<string, string>;
|
|
1172
|
+
};
|
|
1173
|
+
/**
|
|
1174
|
+
* Configuration for the OpenAPI adapter: spec validation, content-type selection,
|
|
1175
|
+
* server URL resolution, and how schema types are derived.
|
|
1176
|
+
*
|
|
1177
|
+
* @example
|
|
1178
|
+
* ```ts
|
|
1179
|
+
* adapterOas({
|
|
1180
|
+
* validate: false,
|
|
1181
|
+
* dateType: 'date',
|
|
1182
|
+
* server: { index: 0, variables: { env: 'prod' } },
|
|
1183
|
+
* })
|
|
1184
|
+
* ```
|
|
1185
|
+
*/
|
|
1186
|
+
type AdapterOasOptions = {
|
|
1187
|
+
/**
|
|
1188
|
+
* Validate the OpenAPI spec with `@readme/openapi-parser` before parsing. Each problem is
|
|
1189
|
+
* reported as a `KUBB_INVALID_SPEC` warning and generation continues. Set to `false` to skip the
|
|
1190
|
+
* check, which also makes generation faster on a large spec.
|
|
1191
|
+
*
|
|
1192
|
+
* @default true
|
|
1193
|
+
*/
|
|
1194
|
+
validate?: boolean;
|
|
1195
|
+
/**
|
|
1196
|
+
* Media type to keep for request bodies and responses. Omit to keep every
|
|
1197
|
+
* media type an operation declares.
|
|
1198
|
+
*/
|
|
1199
|
+
contentType?: ContentType;
|
|
1200
|
+
/**
|
|
1201
|
+
* Selects the server entry used to compute the base URL for plugins that need
|
|
1202
|
+
* it, and overrides its `{variable}` placeholders. Omit to leave `baseURL`
|
|
1203
|
+
* undefined.
|
|
1204
|
+
*
|
|
1205
|
+
* @example
|
|
1206
|
+
* ```ts
|
|
1207
|
+
* // spec server: "https://api.{env}.example.com"
|
|
1208
|
+
* server: { index: 0, variables: { env: 'prod' } }
|
|
1209
|
+
* // → baseURL: "https://api.prod.example.com"
|
|
1210
|
+
* ```
|
|
1211
|
+
*/
|
|
1212
|
+
server?: ServerOptions;
|
|
1213
|
+
/**
|
|
1214
|
+
* How the `discriminator` field on `oneOf`/`anyOf` schemas is interpreted.
|
|
1215
|
+
* - `'preserve'` child schemas stay exactly as written. The discriminator
|
|
1216
|
+
* narrows types at the call site but child shapes are not modified.
|
|
1217
|
+
* - `'propagate'` Kubb pushes the discriminator property as a literal value
|
|
1218
|
+
* into each child schema, so each branch's discriminator field is precisely
|
|
1219
|
+
* typed.
|
|
1220
|
+
*
|
|
1221
|
+
* @default 'preserve'
|
|
1222
|
+
*/
|
|
1223
|
+
discriminator?: 'preserve' | 'propagate';
|
|
1224
|
+
/**
|
|
1225
|
+
* Where inline enums live.
|
|
1226
|
+
* - `'inline'` keeps each enum inline on the property that declares it.
|
|
1227
|
+
* - `'root'` lifts every inline enum to a reusable top-level schema named after its context
|
|
1228
|
+
* (e.g. `PetStatusEnum`) and references it everywhere it appears.
|
|
1229
|
+
*
|
|
1230
|
+
* @default 'inline'
|
|
1231
|
+
*/
|
|
1232
|
+
enums?: 'inline' | 'root';
|
|
1233
|
+
} & Partial<ast.ParserOptions>;
|
|
1234
|
+
/**
|
|
1235
|
+
* Adapter options after defaults have been applied.
|
|
1236
|
+
*/
|
|
1237
|
+
type AdapterOasResolvedOptions = {
|
|
1238
|
+
validate: boolean;
|
|
1239
|
+
contentType: AdapterOasOptions['contentType'];
|
|
1240
|
+
server: AdapterOasOptions['server'];
|
|
1241
|
+
discriminator: NonNullable<AdapterOasOptions['discriminator']>;
|
|
1242
|
+
enums: NonNullable<AdapterOasOptions['enums']>;
|
|
1243
|
+
dateType: NonNullable<AdapterOasOptions['dateType']>;
|
|
1244
|
+
integerType: NonNullable<AdapterOasOptions['integerType']>;
|
|
1245
|
+
unknownType: NonNullable<AdapterOasOptions['unknownType']>;
|
|
1246
|
+
emptySchemaType: NonNullable<AdapterOasOptions['emptySchemaType']>;
|
|
1247
|
+
enumSuffix: NonNullable<AdapterOasOptions['enumSuffix']>;
|
|
1248
|
+
};
|
|
1249
|
+
/**
|
|
1250
|
+
* `@kubb/core` adapter factory type for the OpenAPI adapter.
|
|
1251
|
+
*/
|
|
1252
|
+
type AdapterOas = AdapterFactoryOptions<'oas', AdapterOasOptions, AdapterOasResolvedOptions, Document>;
|
|
1253
|
+
//#endregion
|
|
1254
|
+
//#region src/adapter.d.ts
|
|
1255
|
+
/**
|
|
1256
|
+
* The `name` of `@kubb/adapter-oas`, used to identify this adapter in a Kubb config.
|
|
1257
|
+
*/
|
|
1258
|
+
export declare const adapterOasName = "oas";
|
|
1259
|
+
/**
|
|
1260
|
+
* Default Kubb adapter for OpenAPI 2.0, 3.0, and 3.1 specifications. Reads the
|
|
1261
|
+
* spec from `input` (a file path, URL, inline content, or parsed object), validates
|
|
1262
|
+
* it, resolves the base URL, and converts every schema and operation into the
|
|
1263
|
+
* universal AST that every downstream plugin consumes.
|
|
1264
|
+
*
|
|
1265
|
+
* Configure once on `defineConfig`. The adapter's choices (date representation,
|
|
1266
|
+
* integer width, server URL) apply to every plugin in the build.
|
|
1267
|
+
*
|
|
1268
|
+
* @example
|
|
1269
|
+
* ```ts
|
|
1270
|
+
* import { defineConfig } from 'kubb'
|
|
1271
|
+
* import { adapterOas } from '@kubb/adapter-oas'
|
|
1272
|
+
* import { pluginTs } from '@kubb/plugin-ts'
|
|
1273
|
+
*
|
|
1274
|
+
* export default defineConfig({
|
|
1275
|
+
* input: './petStore.yaml',
|
|
1276
|
+
* output: { path: './src/gen' },
|
|
1277
|
+
* adapter: adapterOas({
|
|
1278
|
+
* server: { index: 0 },
|
|
1279
|
+
* discriminator: 'propagate',
|
|
1280
|
+
* dateType: 'date',
|
|
1281
|
+
* }),
|
|
1282
|
+
* plugins: [pluginTs()],
|
|
1283
|
+
* })
|
|
1284
|
+
* ```
|
|
1285
|
+
*/
|
|
1286
|
+
export declare const adapterOas: import("@kubb/core").AdapterFactory<AdapterOas>;
|
|
1287
|
+
//#endregion
|
|
1288
|
+
//#region src/operation.d.ts
|
|
1289
|
+
/**
|
|
1290
|
+
* A single OpenAPI operation: its path, method, raw operation object and resolved path item.
|
|
1291
|
+
*/
|
|
1292
|
+
type Operation = {
|
|
1293
|
+
path: string;
|
|
1294
|
+
method: string;
|
|
1295
|
+
schema: OperationObject$1;
|
|
1296
|
+
pathItem: PathItemObject$1;
|
|
1297
|
+
};
|
|
1298
|
+
//#endregion
|
|
1299
|
+
export type { AdapterOas, AdapterOasOptions, AdapterOasResolvedOptions, ContentType, DiscriminatorObject$1 as DiscriminatorObject, Document, MediaTypeObject$1 as MediaTypeObject, Operation, ReferenceObject$1 as ReferenceObject, ResponseObject$1 as ResponseObject, SchemaObject$1 as SchemaObject };
|
|
1300
|
+
//# sourceMappingURL=index.d.cts.map
|