@kubb/adapter-oas 5.0.0-beta.11 → 5.0.0-beta.110
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +17 -10
- package/README.md +35 -31
- package/dist/index.cjs +2033 -1424
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +852 -94
- package/dist/index.js +2029 -1415
- package/dist/index.js.map +1 -1
- package/package.json +13 -12
- package/extension.yaml +0 -344
- package/src/adapter.ts +0 -130
- package/src/constants.ts +0 -122
- package/src/discriminator.ts +0 -108
- package/src/factory.ts +0 -162
- package/src/guards.ts +0 -68
- package/src/index.ts +0 -18
- package/src/parser.ts +0 -1002
- package/src/refs.ts +0 -74
- package/src/resolvers.ts +0 -544
- package/src/types.ts +0 -206
- /package/dist/{chunk--u3MIqq1.js → rolldown-runtime-C0LytTxp.js} +0 -0
package/dist/index.d.ts
CHANGED
|
@@ -1,10 +1,742 @@
|
|
|
1
|
-
import { t as __name } from "./
|
|
2
|
-
import
|
|
3
|
-
import { AdapterFactoryOptions
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
import { t as __name } from "./rolldown-runtime-C0LytTxp.js";
|
|
2
|
+
import { ast } from "@kubb/ast";
|
|
3
|
+
import { AdapterFactoryOptions } from "@kubb/core";
|
|
4
|
+
//#region ../../node_modules/.pnpm/@types+json-schema@7.0.15/node_modules/@types/json-schema/index.d.ts
|
|
5
|
+
// ==================================================================================================
|
|
6
|
+
// JSON Schema Draft 04
|
|
7
|
+
// ==================================================================================================
|
|
8
|
+
/**
|
|
9
|
+
* @see https://tools.ietf.org/html/draft-zyp-json-schema-03#section-5.1
|
|
10
|
+
*/
|
|
11
|
+
type JSONSchema4TypeName = "string" //
|
|
12
|
+
| "number" | "integer" | "boolean" | "object" | "array" | "null" | "any";
|
|
13
|
+
/**
|
|
14
|
+
* @see https://tools.ietf.org/html/draft-zyp-json-schema-04#section-3.5
|
|
15
|
+
*/
|
|
16
|
+
type JSONSchema4Type = string //
|
|
17
|
+
| number | boolean | JSONSchema4Object | JSONSchema4Array | null;
|
|
18
|
+
// Workaround for infinite type recursion
|
|
19
|
+
interface JSONSchema4Object {
|
|
20
|
+
[key: string]: JSONSchema4Type;
|
|
21
|
+
}
|
|
22
|
+
// Workaround for infinite type recursion
|
|
23
|
+
// https://github.com/Microsoft/TypeScript/issues/3496#issuecomment-128553540
|
|
24
|
+
interface JSONSchema4Array extends Array<JSONSchema4Type> {}
|
|
25
|
+
/**
|
|
26
|
+
* Meta schema
|
|
27
|
+
*
|
|
28
|
+
* Recommended values:
|
|
29
|
+
* - 'http://json-schema.org/schema#'
|
|
30
|
+
* - 'http://json-schema.org/hyper-schema#'
|
|
31
|
+
* - 'http://json-schema.org/draft-04/schema#'
|
|
32
|
+
* - 'http://json-schema.org/draft-04/hyper-schema#'
|
|
33
|
+
* - 'http://json-schema.org/draft-03/schema#'
|
|
34
|
+
* - 'http://json-schema.org/draft-03/hyper-schema#'
|
|
35
|
+
*
|
|
36
|
+
* @see https://tools.ietf.org/html/draft-handrews-json-schema-validation-01#section-5
|
|
37
|
+
*/
|
|
38
|
+
type JSONSchema4Version = string;
|
|
39
|
+
/**
|
|
40
|
+
* JSON Schema V4
|
|
41
|
+
* @see https://tools.ietf.org/html/draft-zyp-json-schema-04
|
|
42
|
+
*/
|
|
43
|
+
interface JSONSchema4 {
|
|
44
|
+
id?: string | undefined;
|
|
45
|
+
$ref?: string | undefined;
|
|
46
|
+
$schema?: JSONSchema4Version | undefined;
|
|
47
|
+
/**
|
|
48
|
+
* This attribute is a string that provides a short description of the
|
|
49
|
+
* instance property.
|
|
50
|
+
*
|
|
51
|
+
* @see https://tools.ietf.org/html/draft-zyp-json-schema-03#section-5.21
|
|
52
|
+
*/
|
|
53
|
+
title?: string | undefined;
|
|
54
|
+
/**
|
|
55
|
+
* This attribute is a string that provides a full description of the of
|
|
56
|
+
* purpose the instance property.
|
|
57
|
+
*
|
|
58
|
+
* @see https://tools.ietf.org/html/draft-zyp-json-schema-03#section-5.22
|
|
59
|
+
*/
|
|
60
|
+
description?: string | undefined;
|
|
61
|
+
default?: JSONSchema4Type | undefined;
|
|
62
|
+
multipleOf?: number | undefined;
|
|
63
|
+
maximum?: number | undefined;
|
|
64
|
+
exclusiveMaximum?: boolean | undefined;
|
|
65
|
+
minimum?: number | undefined;
|
|
66
|
+
exclusiveMinimum?: boolean | undefined;
|
|
67
|
+
maxLength?: number | undefined;
|
|
68
|
+
minLength?: number | undefined;
|
|
69
|
+
pattern?: string | undefined;
|
|
70
|
+
/**
|
|
71
|
+
* May only be defined when "items" is defined, and is a tuple of JSONSchemas.
|
|
72
|
+
*
|
|
73
|
+
* This provides a definition for additional items in an array instance
|
|
74
|
+
* when tuple definitions of the items is provided. This can be false
|
|
75
|
+
* to indicate additional items in the array are not allowed, or it can
|
|
76
|
+
* be a schema that defines the schema of the additional items.
|
|
77
|
+
*
|
|
78
|
+
* @see https://tools.ietf.org/html/draft-zyp-json-schema-03#section-5.6
|
|
79
|
+
*/
|
|
80
|
+
additionalItems?: boolean | JSONSchema4 | undefined;
|
|
81
|
+
/**
|
|
82
|
+
* This attribute defines the allowed items in an instance array, and
|
|
83
|
+
* MUST be a schema or an array of schemas. The default value is an
|
|
84
|
+
* empty schema which allows any value for items in the instance array.
|
|
85
|
+
*
|
|
86
|
+
* When this attribute value is a schema and the instance value is an
|
|
87
|
+
* array, then all the items in the array MUST be valid according to the
|
|
88
|
+
* schema.
|
|
89
|
+
*
|
|
90
|
+
* When this attribute value is an array of schemas and the instance
|
|
91
|
+
* value is an array, each position in the instance array MUST conform
|
|
92
|
+
* to the schema in the corresponding position for this array. This
|
|
93
|
+
* called tuple typing. When tuple typing is used, additional items are
|
|
94
|
+
* allowed, disallowed, or constrained by the "additionalItems"
|
|
95
|
+
* (Section 5.6) attribute using the same rules as
|
|
96
|
+
* "additionalProperties" (Section 5.4) for objects.
|
|
97
|
+
*
|
|
98
|
+
* @see https://tools.ietf.org/html/draft-zyp-json-schema-03#section-5.5
|
|
99
|
+
*/
|
|
100
|
+
items?: JSONSchema4 | JSONSchema4[] | undefined;
|
|
101
|
+
maxItems?: number | undefined;
|
|
102
|
+
minItems?: number | undefined;
|
|
103
|
+
uniqueItems?: boolean | undefined;
|
|
104
|
+
maxProperties?: number | undefined;
|
|
105
|
+
minProperties?: number | undefined;
|
|
106
|
+
/**
|
|
107
|
+
* This attribute indicates if the instance must have a value, and not
|
|
108
|
+
* be undefined. This is false by default, making the instance
|
|
109
|
+
* optional.
|
|
110
|
+
*
|
|
111
|
+
* @see https://tools.ietf.org/html/draft-zyp-json-schema-03#section-5.7
|
|
112
|
+
*/
|
|
113
|
+
required?: boolean | string[] | undefined;
|
|
114
|
+
/**
|
|
115
|
+
* This attribute defines a schema for all properties that are not
|
|
116
|
+
* explicitly defined in an object type definition. If specified, the
|
|
117
|
+
* value MUST be a schema or a boolean. If false is provided, no
|
|
118
|
+
* additional properties are allowed beyond the properties defined in
|
|
119
|
+
* the schema. The default value is an empty schema which allows any
|
|
120
|
+
* value for additional properties.
|
|
121
|
+
*
|
|
122
|
+
* @see https://tools.ietf.org/html/draft-zyp-json-schema-03#section-5.4
|
|
123
|
+
*/
|
|
124
|
+
additionalProperties?: boolean | JSONSchema4 | undefined;
|
|
125
|
+
definitions?: {
|
|
126
|
+
[k: string]: JSONSchema4;
|
|
127
|
+
} | undefined;
|
|
128
|
+
/**
|
|
129
|
+
* This attribute is an object with property definitions that define the
|
|
130
|
+
* valid values of instance object property values. When the instance
|
|
131
|
+
* value is an object, the property values of the instance object MUST
|
|
132
|
+
* conform to the property definitions in this object. In this object,
|
|
133
|
+
* each property definition's value MUST be a schema, and the property's
|
|
134
|
+
* name MUST be the name of the instance property that it defines. The
|
|
135
|
+
* instance property value MUST be valid according to the schema from
|
|
136
|
+
* the property definition. Properties are considered unordered, the
|
|
137
|
+
* order of the instance properties MAY be in any order.
|
|
138
|
+
*
|
|
139
|
+
* @see https://tools.ietf.org/html/draft-zyp-json-schema-03#section-5.2
|
|
140
|
+
*/
|
|
141
|
+
properties?: {
|
|
142
|
+
[k: string]: JSONSchema4;
|
|
143
|
+
} | undefined;
|
|
144
|
+
/**
|
|
145
|
+
* This attribute is an object that defines the schema for a set of
|
|
146
|
+
* property names of an object instance. The name of each property of
|
|
147
|
+
* this attribute's object is a regular expression pattern in the ECMA
|
|
148
|
+
* 262/Perl 5 format, while the value is a schema. If the pattern
|
|
149
|
+
* matches the name of a property on the instance object, the value of
|
|
150
|
+
* the instance's property MUST be valid against the pattern name's
|
|
151
|
+
* schema value.
|
|
152
|
+
*
|
|
153
|
+
* @see https://tools.ietf.org/html/draft-zyp-json-schema-03#section-5.3
|
|
154
|
+
*/
|
|
155
|
+
patternProperties?: {
|
|
156
|
+
[k: string]: JSONSchema4;
|
|
157
|
+
} | undefined;
|
|
158
|
+
dependencies?: {
|
|
159
|
+
[k: string]: JSONSchema4 | string[];
|
|
160
|
+
} | undefined;
|
|
161
|
+
/**
|
|
162
|
+
* This provides an enumeration of all possible values that are valid
|
|
163
|
+
* for the instance property. This MUST be an array, and each item in
|
|
164
|
+
* the array represents a possible value for the instance value. If
|
|
165
|
+
* this attribute is defined, the instance value MUST be one of the
|
|
166
|
+
* values in the array in order for the schema to be valid.
|
|
167
|
+
*
|
|
168
|
+
* @see https://tools.ietf.org/html/draft-zyp-json-schema-03#section-5.19
|
|
169
|
+
*/
|
|
170
|
+
enum?: JSONSchema4Type[] | undefined;
|
|
171
|
+
/**
|
|
172
|
+
* A single type, or a union of simple types
|
|
173
|
+
*/
|
|
174
|
+
type?: JSONSchema4TypeName | JSONSchema4TypeName[] | undefined;
|
|
175
|
+
allOf?: JSONSchema4[] | undefined;
|
|
176
|
+
anyOf?: JSONSchema4[] | undefined;
|
|
177
|
+
oneOf?: JSONSchema4[] | undefined;
|
|
178
|
+
not?: JSONSchema4 | undefined;
|
|
179
|
+
/**
|
|
180
|
+
* The value of this property MUST be another schema which will provide
|
|
181
|
+
* a base schema which the current schema will inherit from. The
|
|
182
|
+
* inheritance rules are such that any instance that is valid according
|
|
183
|
+
* to the current schema MUST be valid according to the referenced
|
|
184
|
+
* schema. This MAY also be an array, in which case, the instance MUST
|
|
185
|
+
* be valid for all the schemas in the array. A schema that extends
|
|
186
|
+
* another schema MAY define additional attributes, constrain existing
|
|
187
|
+
* attributes, or add other constraints.
|
|
188
|
+
*
|
|
189
|
+
* Conceptually, the behavior of extends can be seen as validating an
|
|
190
|
+
* instance against all constraints in the extending schema as well as
|
|
191
|
+
* the extended schema(s).
|
|
192
|
+
*
|
|
193
|
+
* @see https://tools.ietf.org/html/draft-zyp-json-schema-03#section-5.26
|
|
194
|
+
*/
|
|
195
|
+
extends?: string | string[] | undefined;
|
|
196
|
+
/**
|
|
197
|
+
* @see https://tools.ietf.org/html/draft-zyp-json-schema-04#section-5.6
|
|
198
|
+
*/
|
|
199
|
+
[k: string]: any;
|
|
200
|
+
format?: string | undefined;
|
|
201
|
+
}
|
|
202
|
+
// ==================================================================================================
|
|
203
|
+
// JSON Schema Draft 06
|
|
204
|
+
// ==================================================================================================
|
|
205
|
+
type JSONSchema6TypeName = "string" //
|
|
206
|
+
| "number" | "integer" | "boolean" | "object" | "array" | "null" | "any";
|
|
207
|
+
type JSONSchema6Type = string //
|
|
208
|
+
| number | boolean | JSONSchema6Object | JSONSchema6Array | null;
|
|
209
|
+
// Workaround for infinite type recursion
|
|
210
|
+
interface JSONSchema6Object {
|
|
211
|
+
[key: string]: JSONSchema6Type;
|
|
212
|
+
}
|
|
213
|
+
// Workaround for infinite type recursion
|
|
214
|
+
// https://github.com/Microsoft/TypeScript/issues/3496#issuecomment-128553540
|
|
215
|
+
interface JSONSchema6Array extends Array<JSONSchema6Type> {}
|
|
216
|
+
/**
|
|
217
|
+
* Meta schema
|
|
218
|
+
*
|
|
219
|
+
* Recommended values:
|
|
220
|
+
* - 'http://json-schema.org/schema#'
|
|
221
|
+
* - 'http://json-schema.org/hyper-schema#'
|
|
222
|
+
* - 'http://json-schema.org/draft-06/schema#'
|
|
223
|
+
* - 'http://json-schema.org/draft-06/hyper-schema#'
|
|
224
|
+
*
|
|
225
|
+
* @see https://tools.ietf.org/html/draft-handrews-json-schema-validation-01#section-5
|
|
226
|
+
*/
|
|
227
|
+
type JSONSchema6Version = string;
|
|
228
|
+
/**
|
|
229
|
+
* JSON Schema V6
|
|
230
|
+
* @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01
|
|
231
|
+
*/
|
|
232
|
+
type JSONSchema6Definition = JSONSchema6 | boolean;
|
|
233
|
+
interface JSONSchema6 {
|
|
234
|
+
$id?: string | undefined;
|
|
235
|
+
$ref?: string | undefined;
|
|
236
|
+
$schema?: JSONSchema6Version | undefined;
|
|
237
|
+
/**
|
|
238
|
+
* Must be strictly greater than 0.
|
|
239
|
+
* A numeric instance is valid only if division by this keyword's value results in an integer.
|
|
240
|
+
* @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-6.1
|
|
241
|
+
*/
|
|
242
|
+
multipleOf?: number | undefined;
|
|
243
|
+
/**
|
|
244
|
+
* Representing an inclusive upper limit for a numeric instance.
|
|
245
|
+
* This keyword validates only if the instance is less than or exactly equal to "maximum".
|
|
246
|
+
* @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-6.2
|
|
247
|
+
*/
|
|
248
|
+
maximum?: number | undefined;
|
|
249
|
+
/**
|
|
250
|
+
* Representing an exclusive upper limit for a numeric instance.
|
|
251
|
+
* This keyword validates only if the instance is strictly less than (not equal to) to "exclusiveMaximum".
|
|
252
|
+
* @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-6.3
|
|
253
|
+
*/
|
|
254
|
+
exclusiveMaximum?: number | undefined;
|
|
255
|
+
/**
|
|
256
|
+
* Representing an inclusive lower limit for a numeric instance.
|
|
257
|
+
* This keyword validates only if the instance is greater than or exactly equal to "minimum".
|
|
258
|
+
* @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-6.4
|
|
259
|
+
*/
|
|
260
|
+
minimum?: number | undefined;
|
|
261
|
+
/**
|
|
262
|
+
* Representing an exclusive lower limit for a numeric instance.
|
|
263
|
+
* This keyword validates only if the instance is strictly greater than (not equal to) to "exclusiveMinimum".
|
|
264
|
+
* @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-6.5
|
|
265
|
+
*/
|
|
266
|
+
exclusiveMinimum?: number | undefined;
|
|
267
|
+
/**
|
|
268
|
+
* Must be a non-negative integer.
|
|
269
|
+
* A string instance is valid against this keyword if its length is less than, or equal to, the value of this keyword.
|
|
270
|
+
* @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-6.6
|
|
271
|
+
*/
|
|
272
|
+
maxLength?: number | undefined;
|
|
273
|
+
/**
|
|
274
|
+
* Must be a non-negative integer.
|
|
275
|
+
* A string instance is valid against this keyword if its length is greater than, or equal to, the value of this keyword.
|
|
276
|
+
* Omitting this keyword has the same behavior as a value of 0.
|
|
277
|
+
* @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-6.7
|
|
278
|
+
*/
|
|
279
|
+
minLength?: number | undefined;
|
|
280
|
+
/**
|
|
281
|
+
* Should be a valid regular expression, according to the ECMA 262 regular expression dialect.
|
|
282
|
+
* @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-6.8
|
|
283
|
+
*/
|
|
284
|
+
pattern?: string | undefined;
|
|
285
|
+
/**
|
|
286
|
+
* This keyword determines how child instances validate for arrays, and does not directly validate the immediate instance itself.
|
|
287
|
+
* Omitting this keyword has the same behavior as an empty schema.
|
|
288
|
+
* @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-6.9
|
|
289
|
+
*/
|
|
290
|
+
items?: JSONSchema6Definition | JSONSchema6Definition[] | undefined;
|
|
291
|
+
/**
|
|
292
|
+
* This keyword determines how child instances validate for arrays, and does not directly validate the immediate instance itself.
|
|
293
|
+
* If "items" is an array of schemas, validation succeeds if every instance element
|
|
294
|
+
* at a position greater than the size of "items" validates against "additionalItems".
|
|
295
|
+
* Otherwise, "additionalItems" MUST be ignored, as the "items" schema
|
|
296
|
+
* (possibly the default value of an empty schema) is applied to all elements.
|
|
297
|
+
* Omitting this keyword has the same behavior as an empty schema.
|
|
298
|
+
* @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-6.10
|
|
299
|
+
*/
|
|
300
|
+
additionalItems?: JSONSchema6Definition | undefined;
|
|
301
|
+
/**
|
|
302
|
+
* Must be a non-negative integer.
|
|
303
|
+
* An array instance is valid against "maxItems" if its size is less than, or equal to, the value of this keyword.
|
|
304
|
+
* @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-6.11
|
|
305
|
+
*/
|
|
306
|
+
maxItems?: number | undefined;
|
|
307
|
+
/**
|
|
308
|
+
* Must be a non-negative integer.
|
|
309
|
+
* An array instance is valid against "maxItems" if its size is greater than, or equal to, the value of this keyword.
|
|
310
|
+
* Omitting this keyword has the same behavior as a value of 0.
|
|
311
|
+
* @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-6.12
|
|
312
|
+
*/
|
|
313
|
+
minItems?: number | undefined;
|
|
314
|
+
/**
|
|
315
|
+
* If this keyword has boolean value false, the instance validates successfully.
|
|
316
|
+
* If it has boolean value true, the instance validates successfully if all of its elements are unique.
|
|
317
|
+
* Omitting this keyword has the same behavior as a value of false.
|
|
318
|
+
* @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-6.13
|
|
319
|
+
*/
|
|
320
|
+
uniqueItems?: boolean | undefined;
|
|
321
|
+
/**
|
|
322
|
+
* An array instance is valid against "contains" if at least one of its elements is valid against the given schema.
|
|
323
|
+
* @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-6.14
|
|
324
|
+
*/
|
|
325
|
+
contains?: JSONSchema6Definition | undefined;
|
|
326
|
+
/**
|
|
327
|
+
* Must be a non-negative integer.
|
|
328
|
+
* An object instance is valid against "maxProperties" if its number of properties is less than, or equal to, the value of this keyword.
|
|
329
|
+
* @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-6.15
|
|
330
|
+
*/
|
|
331
|
+
maxProperties?: number | undefined;
|
|
332
|
+
/**
|
|
333
|
+
* Must be a non-negative integer.
|
|
334
|
+
* An object instance is valid against "maxProperties" if its number of properties is greater than,
|
|
335
|
+
* or equal to, the value of this keyword.
|
|
336
|
+
* Omitting this keyword has the same behavior as a value of 0.
|
|
337
|
+
* @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-6.16
|
|
338
|
+
*/
|
|
339
|
+
minProperties?: number | undefined;
|
|
340
|
+
/**
|
|
341
|
+
* Elements of this array must be unique.
|
|
342
|
+
* An object instance is valid against this keyword if every item in the array is the name of a property in the instance.
|
|
343
|
+
* Omitting this keyword has the same behavior as an empty array.
|
|
344
|
+
*
|
|
345
|
+
* @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-6.17
|
|
346
|
+
*/
|
|
347
|
+
required?: string[] | undefined;
|
|
348
|
+
/**
|
|
349
|
+
* This keyword determines how child instances validate for objects, and does not directly validate the immediate instance itself.
|
|
350
|
+
* Validation succeeds if, for each name that appears in both the instance and as a name within this keyword's value,
|
|
351
|
+
* the child instance for that name successfully validates against the corresponding schema.
|
|
352
|
+
* Omitting this keyword has the same behavior as an empty object.
|
|
353
|
+
* @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-6.18
|
|
354
|
+
*/
|
|
355
|
+
properties?: {
|
|
356
|
+
[k: string]: JSONSchema6Definition;
|
|
357
|
+
} | undefined;
|
|
358
|
+
/**
|
|
359
|
+
* This attribute is an object that defines the schema for a set of property names of an object instance.
|
|
360
|
+
* 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.
|
|
361
|
+
* If the pattern matches the name of a property on the instance object, the value of the instance's property
|
|
362
|
+
* MUST be valid against the pattern name's schema value.
|
|
363
|
+
* Omitting this keyword has the same behavior as an empty object.
|
|
364
|
+
* @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-6.19
|
|
365
|
+
*/
|
|
366
|
+
patternProperties?: {
|
|
367
|
+
[k: string]: JSONSchema6Definition;
|
|
368
|
+
} | undefined;
|
|
369
|
+
/**
|
|
370
|
+
* This attribute defines a schema for all properties that are not explicitly defined in an object type definition.
|
|
371
|
+
* If specified, the value MUST be a schema or a boolean.
|
|
372
|
+
* If false is provided, no additional properties are allowed beyond the properties defined in the schema.
|
|
373
|
+
* The default value is an empty schema which allows any value for additional properties.
|
|
374
|
+
* @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-6.20
|
|
375
|
+
*/
|
|
376
|
+
additionalProperties?: JSONSchema6Definition | undefined;
|
|
377
|
+
/**
|
|
378
|
+
* This keyword specifies rules that are evaluated if the instance is an object and contains a certain property.
|
|
379
|
+
* Each property specifies a dependency.
|
|
380
|
+
* If the dependency value is an array, each element in the array must be unique.
|
|
381
|
+
* Omitting this keyword has the same behavior as an empty object.
|
|
382
|
+
* @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-6.21
|
|
383
|
+
*/
|
|
384
|
+
dependencies?: {
|
|
385
|
+
[k: string]: JSONSchema6Definition | string[];
|
|
386
|
+
} | undefined;
|
|
387
|
+
/**
|
|
388
|
+
* Takes a schema which validates the names of all properties rather than their values.
|
|
389
|
+
* Note the property name that the schema is testing will always be a string.
|
|
390
|
+
* Omitting this keyword has the same behavior as an empty schema.
|
|
391
|
+
* @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-6.22
|
|
392
|
+
*/
|
|
393
|
+
propertyNames?: JSONSchema6Definition | undefined;
|
|
394
|
+
/**
|
|
395
|
+
* This provides an enumeration of all possible values that are valid
|
|
396
|
+
* for the instance property. This MUST be an array, and each item in
|
|
397
|
+
* the array represents a possible value for the instance value. If
|
|
398
|
+
* this attribute is defined, the instance value MUST be one of the
|
|
399
|
+
* values in the array in order for the schema to be valid.
|
|
400
|
+
*
|
|
401
|
+
* @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-6.23
|
|
402
|
+
*/
|
|
403
|
+
enum?: JSONSchema6Type[] | undefined;
|
|
404
|
+
/**
|
|
405
|
+
* More readable form of a one-element "enum"
|
|
406
|
+
* @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-6.24
|
|
407
|
+
*/
|
|
408
|
+
const?: JSONSchema6Type | undefined;
|
|
409
|
+
/**
|
|
410
|
+
* A single type, or a union of simple types
|
|
411
|
+
* @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-6.25
|
|
412
|
+
*/
|
|
413
|
+
type?: JSONSchema6TypeName | JSONSchema6TypeName[] | undefined;
|
|
414
|
+
/**
|
|
415
|
+
* @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-6.26
|
|
416
|
+
*/
|
|
417
|
+
allOf?: JSONSchema6Definition[] | undefined;
|
|
418
|
+
/**
|
|
419
|
+
* @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-6.27
|
|
420
|
+
*/
|
|
421
|
+
anyOf?: JSONSchema6Definition[] | undefined;
|
|
422
|
+
/**
|
|
423
|
+
* @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-6.28
|
|
424
|
+
*/
|
|
425
|
+
oneOf?: JSONSchema6Definition[] | undefined;
|
|
426
|
+
/**
|
|
427
|
+
* @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-6.29
|
|
428
|
+
*/
|
|
429
|
+
not?: JSONSchema6Definition | undefined;
|
|
430
|
+
/**
|
|
431
|
+
* @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-7.1
|
|
432
|
+
*/
|
|
433
|
+
definitions?: {
|
|
434
|
+
[k: string]: JSONSchema6Definition;
|
|
435
|
+
} | undefined;
|
|
436
|
+
/**
|
|
437
|
+
* This attribute is a string that provides a short description of the instance property.
|
|
438
|
+
*
|
|
439
|
+
* @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-7.2
|
|
440
|
+
*/
|
|
441
|
+
title?: string | undefined;
|
|
442
|
+
/**
|
|
443
|
+
* This attribute is a string that provides a full description of the of purpose the instance property.
|
|
444
|
+
*
|
|
445
|
+
* @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-7.2
|
|
446
|
+
*/
|
|
447
|
+
description?: string | undefined;
|
|
448
|
+
/**
|
|
449
|
+
* This keyword can be used to supply a default JSON value associated with a particular schema.
|
|
450
|
+
* It is RECOMMENDED that a default value be valid against the associated schema.
|
|
451
|
+
* @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-7.3
|
|
452
|
+
*/
|
|
453
|
+
default?: JSONSchema6Type | undefined;
|
|
454
|
+
/**
|
|
455
|
+
* Array of examples with no validation effect the value of "default" is usable as an example without repeating it under this keyword
|
|
456
|
+
* @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-7.4
|
|
457
|
+
*/
|
|
458
|
+
examples?: JSONSchema6Type[] | undefined;
|
|
459
|
+
/**
|
|
460
|
+
* @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-8
|
|
461
|
+
*/
|
|
462
|
+
format?: string | undefined;
|
|
463
|
+
}
|
|
464
|
+
// ==================================================================================================
|
|
465
|
+
// JSON Schema Draft 07
|
|
466
|
+
// ==================================================================================================
|
|
467
|
+
// https://tools.ietf.org/html/draft-handrews-json-schema-validation-01
|
|
468
|
+
// --------------------------------------------------------------------------------------------------
|
|
469
|
+
/**
|
|
470
|
+
* Primitive type
|
|
471
|
+
* @see https://tools.ietf.org/html/draft-handrews-json-schema-validation-01#section-6.1.1
|
|
472
|
+
*/
|
|
473
|
+
type JSONSchema7TypeName = "string" //
|
|
474
|
+
| "number" | "integer" | "boolean" | "object" | "array" | "null";
|
|
475
|
+
/**
|
|
476
|
+
* Primitive type
|
|
477
|
+
* @see https://tools.ietf.org/html/draft-handrews-json-schema-validation-01#section-6.1.1
|
|
478
|
+
*/
|
|
479
|
+
type JSONSchema7Type = string //
|
|
480
|
+
| number | boolean | JSONSchema7Object | JSONSchema7Array | null;
|
|
481
|
+
// Workaround for infinite type recursion
|
|
482
|
+
interface JSONSchema7Object {
|
|
483
|
+
[key: string]: JSONSchema7Type;
|
|
484
|
+
}
|
|
485
|
+
// Workaround for infinite type recursion
|
|
486
|
+
// https://github.com/Microsoft/TypeScript/issues/3496#issuecomment-128553540
|
|
487
|
+
interface JSONSchema7Array extends Array<JSONSchema7Type> {}
|
|
488
|
+
/**
|
|
489
|
+
* Meta schema
|
|
490
|
+
*
|
|
491
|
+
* Recommended values:
|
|
492
|
+
* - 'http://json-schema.org/schema#'
|
|
493
|
+
* - 'http://json-schema.org/hyper-schema#'
|
|
494
|
+
* - 'http://json-schema.org/draft-07/schema#'
|
|
495
|
+
* - 'http://json-schema.org/draft-07/hyper-schema#'
|
|
496
|
+
*
|
|
497
|
+
* @see https://tools.ietf.org/html/draft-handrews-json-schema-validation-01#section-5
|
|
498
|
+
*/
|
|
499
|
+
type JSONSchema7Version = string;
|
|
500
|
+
/**
|
|
501
|
+
* JSON Schema v7
|
|
502
|
+
* @see https://tools.ietf.org/html/draft-handrews-json-schema-validation-01
|
|
503
|
+
*/
|
|
504
|
+
type JSONSchema7Definition = JSONSchema7 | boolean;
|
|
505
|
+
interface JSONSchema7 {
|
|
506
|
+
$id?: string | undefined;
|
|
507
|
+
$ref?: string | undefined;
|
|
508
|
+
$schema?: JSONSchema7Version | undefined;
|
|
509
|
+
$comment?: string | undefined;
|
|
510
|
+
/**
|
|
511
|
+
* @see https://datatracker.ietf.org/doc/html/draft-bhutton-json-schema-00#section-8.2.4
|
|
512
|
+
* @see https://datatracker.ietf.org/doc/html/draft-bhutton-json-schema-validation-00#appendix-A
|
|
513
|
+
*/
|
|
514
|
+
$defs?: {
|
|
515
|
+
[key: string]: JSONSchema7Definition;
|
|
516
|
+
} | undefined;
|
|
517
|
+
/**
|
|
518
|
+
* @see https://tools.ietf.org/html/draft-handrews-json-schema-validation-01#section-6.1
|
|
519
|
+
*/
|
|
520
|
+
type?: JSONSchema7TypeName | JSONSchema7TypeName[] | undefined;
|
|
521
|
+
enum?: JSONSchema7Type[] | undefined;
|
|
522
|
+
const?: JSONSchema7Type | undefined;
|
|
523
|
+
/**
|
|
524
|
+
* @see https://tools.ietf.org/html/draft-handrews-json-schema-validation-01#section-6.2
|
|
525
|
+
*/
|
|
526
|
+
multipleOf?: number | undefined;
|
|
527
|
+
maximum?: number | undefined;
|
|
528
|
+
exclusiveMaximum?: number | undefined;
|
|
529
|
+
minimum?: number | undefined;
|
|
530
|
+
exclusiveMinimum?: number | undefined;
|
|
531
|
+
/**
|
|
532
|
+
* @see https://tools.ietf.org/html/draft-handrews-json-schema-validation-01#section-6.3
|
|
533
|
+
*/
|
|
534
|
+
maxLength?: number | undefined;
|
|
535
|
+
minLength?: number | undefined;
|
|
536
|
+
pattern?: string | undefined;
|
|
537
|
+
/**
|
|
538
|
+
* @see https://tools.ietf.org/html/draft-handrews-json-schema-validation-01#section-6.4
|
|
539
|
+
*/
|
|
540
|
+
items?: JSONSchema7Definition | JSONSchema7Definition[] | undefined;
|
|
541
|
+
additionalItems?: JSONSchema7Definition | undefined;
|
|
542
|
+
maxItems?: number | undefined;
|
|
543
|
+
minItems?: number | undefined;
|
|
544
|
+
uniqueItems?: boolean | undefined;
|
|
545
|
+
contains?: JSONSchema7Definition | undefined;
|
|
546
|
+
/**
|
|
547
|
+
* @see https://tools.ietf.org/html/draft-handrews-json-schema-validation-01#section-6.5
|
|
548
|
+
*/
|
|
549
|
+
maxProperties?: number | undefined;
|
|
550
|
+
minProperties?: number | undefined;
|
|
551
|
+
required?: string[] | undefined;
|
|
552
|
+
properties?: {
|
|
553
|
+
[key: string]: JSONSchema7Definition;
|
|
554
|
+
} | undefined;
|
|
555
|
+
patternProperties?: {
|
|
556
|
+
[key: string]: JSONSchema7Definition;
|
|
557
|
+
} | undefined;
|
|
558
|
+
additionalProperties?: JSONSchema7Definition | undefined;
|
|
559
|
+
dependencies?: {
|
|
560
|
+
[key: string]: JSONSchema7Definition | string[];
|
|
561
|
+
} | undefined;
|
|
562
|
+
propertyNames?: JSONSchema7Definition | undefined;
|
|
563
|
+
/**
|
|
564
|
+
* @see https://tools.ietf.org/html/draft-handrews-json-schema-validation-01#section-6.6
|
|
565
|
+
*/
|
|
566
|
+
if?: JSONSchema7Definition | undefined;
|
|
567
|
+
then?: JSONSchema7Definition | undefined;
|
|
568
|
+
else?: JSONSchema7Definition | undefined;
|
|
569
|
+
/**
|
|
570
|
+
* @see https://tools.ietf.org/html/draft-handrews-json-schema-validation-01#section-6.7
|
|
571
|
+
*/
|
|
572
|
+
allOf?: JSONSchema7Definition[] | undefined;
|
|
573
|
+
anyOf?: JSONSchema7Definition[] | undefined;
|
|
574
|
+
oneOf?: JSONSchema7Definition[] | undefined;
|
|
575
|
+
not?: JSONSchema7Definition | undefined;
|
|
576
|
+
/**
|
|
577
|
+
* @see https://tools.ietf.org/html/draft-handrews-json-schema-validation-01#section-7
|
|
578
|
+
*/
|
|
579
|
+
format?: string | undefined;
|
|
580
|
+
/**
|
|
581
|
+
* @see https://tools.ietf.org/html/draft-handrews-json-schema-validation-01#section-8
|
|
582
|
+
*/
|
|
583
|
+
contentMediaType?: string | undefined;
|
|
584
|
+
contentEncoding?: string | undefined;
|
|
585
|
+
/**
|
|
586
|
+
* @see https://tools.ietf.org/html/draft-handrews-json-schema-validation-01#section-9
|
|
587
|
+
*/
|
|
588
|
+
definitions?: {
|
|
589
|
+
[key: string]: JSONSchema7Definition;
|
|
590
|
+
} | undefined;
|
|
591
|
+
/**
|
|
592
|
+
* @see https://tools.ietf.org/html/draft-handrews-json-schema-validation-01#section-10
|
|
593
|
+
*/
|
|
594
|
+
title?: string | undefined;
|
|
595
|
+
description?: string | undefined;
|
|
596
|
+
default?: JSONSchema7Type | undefined;
|
|
597
|
+
readOnly?: boolean | undefined;
|
|
598
|
+
writeOnly?: boolean | undefined;
|
|
599
|
+
examples?: JSONSchema7Type | undefined;
|
|
600
|
+
}
|
|
601
|
+
//#endregion
|
|
7
602
|
//#region ../../node_modules/.pnpm/openapi-types@12.1.3/node_modules/openapi-types/dist/index.d.ts
|
|
603
|
+
declare namespace OpenAPIV3_1 {
|
|
604
|
+
type Modify<T, R> = Omit<T, keyof R> & R;
|
|
605
|
+
type PathsWebhooksComponents<T extends {} = {}> = {
|
|
606
|
+
paths: PathsObject<T>;
|
|
607
|
+
webhooks: Record<string, PathItemObject | ReferenceObject>;
|
|
608
|
+
components: ComponentsObject;
|
|
609
|
+
};
|
|
610
|
+
export type Document<T extends {} = {}> = Modify<Omit<OpenAPIV3.Document<T>, 'paths' | 'components'>, {
|
|
611
|
+
info: InfoObject;
|
|
612
|
+
jsonSchemaDialect?: string;
|
|
613
|
+
servers?: ServerObject[];
|
|
614
|
+
} & ((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'>))>;
|
|
615
|
+
export type InfoObject = Modify<OpenAPIV3.InfoObject, {
|
|
616
|
+
summary?: string;
|
|
617
|
+
license?: LicenseObject;
|
|
618
|
+
}>;
|
|
619
|
+
export type ContactObject = OpenAPIV3.ContactObject;
|
|
620
|
+
export type LicenseObject = Modify<OpenAPIV3.LicenseObject, {
|
|
621
|
+
identifier?: string;
|
|
622
|
+
}>;
|
|
623
|
+
export type ServerObject = Modify<OpenAPIV3.ServerObject, {
|
|
624
|
+
url: string;
|
|
625
|
+
description?: string;
|
|
626
|
+
variables?: Record<string, ServerVariableObject>;
|
|
627
|
+
}>;
|
|
628
|
+
export type ServerVariableObject = Modify<OpenAPIV3.ServerVariableObject, {
|
|
629
|
+
enum?: [string, ...string[]];
|
|
630
|
+
}>;
|
|
631
|
+
export type PathsObject<T extends {} = {}, P extends {} = {}> = Record<string, (PathItemObject<T> & P) | undefined>;
|
|
632
|
+
export type HttpMethods = OpenAPIV3.HttpMethods;
|
|
633
|
+
export type PathItemObject<T extends {} = {}> = Modify<OpenAPIV3.PathItemObject<T>, {
|
|
634
|
+
servers?: ServerObject[];
|
|
635
|
+
parameters?: (ReferenceObject | ParameterObject)[];
|
|
636
|
+
}> & { [method in HttpMethods]?: OperationObject<T>; };
|
|
637
|
+
export type OperationObject<T extends {} = {}> = Modify<OpenAPIV3.OperationObject<T>, {
|
|
638
|
+
parameters?: (ReferenceObject | ParameterObject)[];
|
|
639
|
+
requestBody?: ReferenceObject | RequestBodyObject;
|
|
640
|
+
responses?: ResponsesObject;
|
|
641
|
+
callbacks?: Record<string, ReferenceObject | CallbackObject>;
|
|
642
|
+
servers?: ServerObject[];
|
|
643
|
+
}> & T;
|
|
644
|
+
export type ExternalDocumentationObject = OpenAPIV3.ExternalDocumentationObject;
|
|
645
|
+
export type ParameterObject = OpenAPIV3.ParameterObject;
|
|
646
|
+
export type HeaderObject = OpenAPIV3.HeaderObject;
|
|
647
|
+
export type ParameterBaseObject = OpenAPIV3.ParameterBaseObject;
|
|
648
|
+
export type NonArraySchemaObjectType = OpenAPIV3.NonArraySchemaObjectType | 'null';
|
|
649
|
+
export type ArraySchemaObjectType = OpenAPIV3.ArraySchemaObjectType;
|
|
650
|
+
/**
|
|
651
|
+
* There is no way to tell typescript to require items when type is either 'array' or array containing 'array' type
|
|
652
|
+
* 'items' will be always visible as optional
|
|
653
|
+
* Casting schema object to ArraySchemaObject or NonArraySchemaObject will work fine
|
|
654
|
+
*/
|
|
655
|
+
export type SchemaObject = ArraySchemaObject | NonArraySchemaObject | MixedSchemaObject;
|
|
656
|
+
export interface ArraySchemaObject extends BaseSchemaObject {
|
|
657
|
+
type: ArraySchemaObjectType;
|
|
658
|
+
items: ReferenceObject | SchemaObject;
|
|
659
|
+
}
|
|
660
|
+
export interface NonArraySchemaObject extends BaseSchemaObject {
|
|
661
|
+
type?: NonArraySchemaObjectType;
|
|
662
|
+
}
|
|
663
|
+
interface MixedSchemaObject extends BaseSchemaObject {
|
|
664
|
+
type?: (ArraySchemaObjectType | NonArraySchemaObjectType)[];
|
|
665
|
+
items?: ReferenceObject | SchemaObject;
|
|
666
|
+
}
|
|
667
|
+
export type BaseSchemaObject = Modify<Omit<OpenAPIV3.BaseSchemaObject, 'nullable'>, {
|
|
668
|
+
examples?: OpenAPIV3.BaseSchemaObject['example'][];
|
|
669
|
+
exclusiveMinimum?: boolean | number;
|
|
670
|
+
exclusiveMaximum?: boolean | number;
|
|
671
|
+
contentMediaType?: string;
|
|
672
|
+
$schema?: string;
|
|
673
|
+
additionalProperties?: boolean | ReferenceObject | SchemaObject;
|
|
674
|
+
properties?: {
|
|
675
|
+
[name: string]: ReferenceObject | SchemaObject;
|
|
676
|
+
};
|
|
677
|
+
allOf?: (ReferenceObject | SchemaObject)[];
|
|
678
|
+
oneOf?: (ReferenceObject | SchemaObject)[];
|
|
679
|
+
anyOf?: (ReferenceObject | SchemaObject)[];
|
|
680
|
+
not?: ReferenceObject | SchemaObject;
|
|
681
|
+
discriminator?: DiscriminatorObject;
|
|
682
|
+
externalDocs?: ExternalDocumentationObject;
|
|
683
|
+
xml?: XMLObject;
|
|
684
|
+
const?: any;
|
|
685
|
+
}>;
|
|
686
|
+
export type DiscriminatorObject = OpenAPIV3.DiscriminatorObject;
|
|
687
|
+
export type XMLObject = OpenAPIV3.XMLObject;
|
|
688
|
+
export type ReferenceObject = Modify<OpenAPIV3.ReferenceObject, {
|
|
689
|
+
summary?: string;
|
|
690
|
+
description?: string;
|
|
691
|
+
}>;
|
|
692
|
+
export type ExampleObject = OpenAPIV3.ExampleObject;
|
|
693
|
+
export type MediaTypeObject = Modify<OpenAPIV3.MediaTypeObject, {
|
|
694
|
+
schema?: SchemaObject | ReferenceObject;
|
|
695
|
+
examples?: Record<string, ReferenceObject | ExampleObject>;
|
|
696
|
+
}>;
|
|
697
|
+
export type EncodingObject = OpenAPIV3.EncodingObject;
|
|
698
|
+
export type RequestBodyObject = Modify<OpenAPIV3.RequestBodyObject, {
|
|
699
|
+
content: {
|
|
700
|
+
[media: string]: MediaTypeObject;
|
|
701
|
+
};
|
|
702
|
+
}>;
|
|
703
|
+
export type ResponsesObject = Record<string, ReferenceObject | ResponseObject>;
|
|
704
|
+
export type ResponseObject = Modify<OpenAPIV3.ResponseObject, {
|
|
705
|
+
headers?: {
|
|
706
|
+
[header: string]: ReferenceObject | HeaderObject;
|
|
707
|
+
};
|
|
708
|
+
content?: {
|
|
709
|
+
[media: string]: MediaTypeObject;
|
|
710
|
+
};
|
|
711
|
+
links?: {
|
|
712
|
+
[link: string]: ReferenceObject | LinkObject;
|
|
713
|
+
};
|
|
714
|
+
}>;
|
|
715
|
+
export type LinkObject = Modify<OpenAPIV3.LinkObject, {
|
|
716
|
+
server?: ServerObject;
|
|
717
|
+
}>;
|
|
718
|
+
export type CallbackObject = Record<string, PathItemObject | ReferenceObject>;
|
|
719
|
+
export type SecurityRequirementObject = OpenAPIV3.SecurityRequirementObject;
|
|
720
|
+
export type ComponentsObject = Modify<OpenAPIV3.ComponentsObject, {
|
|
721
|
+
schemas?: Record<string, SchemaObject>;
|
|
722
|
+
responses?: Record<string, ReferenceObject | ResponseObject>;
|
|
723
|
+
parameters?: Record<string, ReferenceObject | ParameterObject>;
|
|
724
|
+
examples?: Record<string, ReferenceObject | ExampleObject>;
|
|
725
|
+
requestBodies?: Record<string, ReferenceObject | RequestBodyObject>;
|
|
726
|
+
headers?: Record<string, ReferenceObject | HeaderObject>;
|
|
727
|
+
securitySchemes?: Record<string, ReferenceObject | SecuritySchemeObject>;
|
|
728
|
+
links?: Record<string, ReferenceObject | LinkObject>;
|
|
729
|
+
callbacks?: Record<string, ReferenceObject | CallbackObject>;
|
|
730
|
+
pathItems?: Record<string, ReferenceObject | PathItemObject>;
|
|
731
|
+
}>;
|
|
732
|
+
export type SecuritySchemeObject = OpenAPIV3.SecuritySchemeObject;
|
|
733
|
+
export type HttpSecurityScheme = OpenAPIV3.HttpSecurityScheme;
|
|
734
|
+
export type ApiKeySecurityScheme = OpenAPIV3.ApiKeySecurityScheme;
|
|
735
|
+
export type OAuth2SecurityScheme = OpenAPIV3.OAuth2SecurityScheme;
|
|
736
|
+
export type OpenIdSecurityScheme = OpenAPIV3.OpenIdSecurityScheme;
|
|
737
|
+
export type TagObject = OpenAPIV3.TagObject;
|
|
738
|
+
export {};
|
|
739
|
+
}
|
|
8
740
|
declare namespace OpenAPIV3 {
|
|
9
741
|
interface Document<T extends {} = {}> {
|
|
10
742
|
openapi: string;
|
|
@@ -66,7 +798,7 @@ declare namespace OpenAPIV3 {
|
|
|
66
798
|
description?: string;
|
|
67
799
|
servers?: ServerObject[];
|
|
68
800
|
parameters?: (ReferenceObject | ParameterObject)[];
|
|
69
|
-
} & { [method in HttpMethods]?: OperationObject<T
|
|
801
|
+
} & { [method in HttpMethods]?: OperationObject<T>; };
|
|
70
802
|
type OperationObject<T extends {} = {}> = {
|
|
71
803
|
tags?: string[];
|
|
72
804
|
summary?: string;
|
|
@@ -324,10 +1056,25 @@ declare namespace OpenAPIV3 {
|
|
|
324
1056
|
}
|
|
325
1057
|
}
|
|
326
1058
|
//#endregion
|
|
1059
|
+
//#region src/operation.d.ts
|
|
1060
|
+
/**
|
|
1061
|
+
* A single OpenAPI operation: its URL path, HTTP method, and the raw operation object.
|
|
1062
|
+
*
|
|
1063
|
+
* `schema` is a live reference into the document. Unlike earlier versions of this adapter, nothing
|
|
1064
|
+
* resolves a `$ref` in place here anymore — every accessor below resolves through `refs` instead.
|
|
1065
|
+
* `pathItem` is the already-resolved path item this operation was read from, so a caller that
|
|
1066
|
+
* also needs path-level data (parameters, summary, description) doesn't re-resolve it.
|
|
1067
|
+
*/
|
|
1068
|
+
type Operation = {
|
|
1069
|
+
path: string;
|
|
1070
|
+
method: string;
|
|
1071
|
+
schema: OperationObject$1;
|
|
1072
|
+
pathItem: PathItemObject$1;
|
|
1073
|
+
};
|
|
1074
|
+
//#endregion
|
|
327
1075
|
//#region src/types.d.ts
|
|
328
1076
|
/**
|
|
329
|
-
*
|
|
330
|
-
* Supports `'application/json'` or any other media type.
|
|
1077
|
+
* Media type used to pick a schema from an operation's request or response.
|
|
331
1078
|
*
|
|
332
1079
|
* @example
|
|
333
1080
|
* ```ts
|
|
@@ -348,7 +1095,18 @@ type ContentType = 'application/json' | (string & {});
|
|
|
348
1095
|
* }
|
|
349
1096
|
* ```
|
|
350
1097
|
*/
|
|
351
|
-
type SchemaObject$1 =
|
|
1098
|
+
type SchemaObject$1 = {
|
|
1099
|
+
externalDocs?: unknown;
|
|
1100
|
+
xml?: unknown;
|
|
1101
|
+
$schema?: string;
|
|
1102
|
+
deprecated?: boolean;
|
|
1103
|
+
example?: unknown;
|
|
1104
|
+
examples?: Array<unknown>;
|
|
1105
|
+
nullable?: boolean;
|
|
1106
|
+
readOnly?: boolean;
|
|
1107
|
+
writeOnly?: boolean;
|
|
1108
|
+
discriminator?: DiscriminatorObject$1;
|
|
1109
|
+
'x-readme-ref-name'?: string;
|
|
352
1110
|
/**
|
|
353
1111
|
* OAS 3.0 vendor extension: marks a schema as nullable without using `type: ['null', ...]`.
|
|
354
1112
|
*/
|
|
@@ -372,126 +1130,135 @@ type SchemaObject$1 = SchemaObject$2 & {
|
|
|
372
1130
|
patternProperties?: Record<string, SchemaObject$1 | boolean>;
|
|
373
1131
|
/**
|
|
374
1132
|
* Single-schema form of `items`. Narrowed from the base type to take precedence over the tuple overload.
|
|
1133
|
+
*
|
|
1134
|
+
* Alongside `prefixItems`, the JSON Schema boolean form applies: `items: false` closes the tuple
|
|
1135
|
+
* (no extra elements allowed), while `items: true` is equivalent to an unconstrained rest.
|
|
375
1136
|
*/
|
|
376
|
-
items?: SchemaObject$1 | ReferenceObject$1;
|
|
1137
|
+
items?: SchemaObject$1 | ReferenceObject$1 | boolean;
|
|
377
1138
|
/**
|
|
378
|
-
*
|
|
1139
|
+
* Allowed values for this schema.
|
|
379
1140
|
*/
|
|
380
1141
|
enum?: Array<string | number | boolean | null>;
|
|
381
|
-
};
|
|
1142
|
+
} & (OpenAPIV3_1.SchemaObject | JSONSchema4 | JSONSchema6 | JSONSchema7);
|
|
382
1143
|
/**
|
|
383
|
-
*
|
|
384
|
-
*
|
|
385
|
-
* @example
|
|
386
|
-
* ```ts
|
|
387
|
-
* HttpMethods['GET'] // 'get'
|
|
388
|
-
* HttpMethods['POST'] // 'post'
|
|
389
|
-
* ```
|
|
1144
|
+
* Normalized OpenAPI document after parsing.
|
|
390
1145
|
*/
|
|
391
|
-
|
|
1146
|
+
type Document = OpenAPIV3_1.Document & Record<string, unknown>;
|
|
392
1147
|
/**
|
|
393
|
-
*
|
|
1148
|
+
* Single operation object (the `get`/`post`/… entry on a path item) plus any vendor extensions.
|
|
394
1149
|
*/
|
|
395
|
-
type
|
|
1150
|
+
type OperationObject$1 = OpenAPIV3_1.OperationObject & Record<string, unknown>;
|
|
396
1151
|
/**
|
|
397
|
-
*
|
|
1152
|
+
* Path item object holding the operations and shared parameters for a single URL path.
|
|
398
1153
|
*/
|
|
399
|
-
type
|
|
400
|
-
/**
|
|
401
|
-
* API operation extracted from an OpenAPI document.
|
|
402
|
-
*/
|
|
403
|
-
type Operation = Operation$1;
|
|
1154
|
+
type PathItemObject$1 = OpenAPIV3_1.PathItemObject;
|
|
404
1155
|
/**
|
|
405
1156
|
* Discriminator object for `oneOf`/`anyOf` schemas in OpenAPI.
|
|
406
1157
|
*/
|
|
407
|
-
type DiscriminatorObject$1 = DiscriminatorObject
|
|
1158
|
+
type DiscriminatorObject$1 = OpenAPIV3_1.DiscriminatorObject;
|
|
408
1159
|
/**
|
|
409
1160
|
* OpenAPI reference object pointing to a schema definition via `$ref`.
|
|
410
1161
|
*/
|
|
411
|
-
type ReferenceObject$1 =
|
|
1162
|
+
type ReferenceObject$1 = OpenAPIV3_1.ReferenceObject;
|
|
412
1163
|
/**
|
|
413
|
-
* OpenAPI response object
|
|
1164
|
+
* OpenAPI response object holding the content and headers for one status code.
|
|
414
1165
|
*/
|
|
415
|
-
type ResponseObject$1 = ResponseObject
|
|
1166
|
+
type ResponseObject$1 = OpenAPIV3_1.ResponseObject;
|
|
416
1167
|
/**
|
|
417
1168
|
* OpenAPI media type object that maps a content-type string to its schema.
|
|
418
1169
|
*/
|
|
419
|
-
type MediaTypeObject$1 = MediaTypeObject
|
|
1170
|
+
type MediaTypeObject$1 = OpenAPIV3_1.MediaTypeObject;
|
|
1171
|
+
/**
|
|
1172
|
+
* Selects which entry in the spec's `servers` array becomes the base URL and
|
|
1173
|
+
* supplies values for its `{variable}` placeholders.
|
|
1174
|
+
*/
|
|
1175
|
+
type ServerOptions = {
|
|
1176
|
+
/**
|
|
1177
|
+
* Index into the `servers` array from your OpenAPI spec. Most projects pick
|
|
1178
|
+
* `0` for the primary server. Omit to leave `baseURL` undefined.
|
|
1179
|
+
*/
|
|
1180
|
+
index?: number;
|
|
1181
|
+
/**
|
|
1182
|
+
* Override values for `{variable}` placeholders in the selected server URL.
|
|
1183
|
+
* Variables you do not provide use their `default` value from the spec.
|
|
1184
|
+
*/
|
|
1185
|
+
variables?: Record<string, string>;
|
|
1186
|
+
};
|
|
420
1187
|
/**
|
|
421
|
-
* Configuration
|
|
422
|
-
*
|
|
1188
|
+
* Configuration for the OpenAPI adapter: spec validation, content-type selection,
|
|
1189
|
+
* server URL resolution, and how schema types are derived.
|
|
423
1190
|
*
|
|
424
1191
|
* @example
|
|
425
1192
|
* ```ts
|
|
426
1193
|
* adapterOas({
|
|
427
1194
|
* validate: false,
|
|
428
1195
|
* dateType: 'date',
|
|
429
|
-
*
|
|
430
|
-
* serverVariables: { env: 'prod' },
|
|
1196
|
+
* server: { index: 0, variables: { env: 'prod' } },
|
|
431
1197
|
* })
|
|
432
1198
|
* ```
|
|
433
1199
|
*/
|
|
434
1200
|
type AdapterOasOptions = {
|
|
435
1201
|
/**
|
|
436
|
-
* Validate the OpenAPI spec before parsing.
|
|
1202
|
+
* Validate the OpenAPI spec with `@readme/openapi-parser` before parsing.
|
|
1203
|
+
* Set to `false` only when you have a known-invalid spec you still want to
|
|
1204
|
+
* generate from.
|
|
1205
|
+
*
|
|
437
1206
|
* @default true
|
|
438
1207
|
*/
|
|
439
1208
|
validate?: boolean;
|
|
440
1209
|
/**
|
|
441
|
-
* Preferred
|
|
442
|
-
*
|
|
1210
|
+
* Preferred media type when an operation defines several. Defaults to the
|
|
1211
|
+
* first JSON-compatible media type found in the spec.
|
|
443
1212
|
*/
|
|
444
1213
|
contentType?: ContentType;
|
|
445
1214
|
/**
|
|
446
|
-
*
|
|
447
|
-
*
|
|
448
|
-
|
|
449
|
-
serverIndex?: number;
|
|
450
|
-
/**
|
|
451
|
-
* Override values for `{variable}` placeholders in the selected server URL.
|
|
452
|
-
* Only used when `serverIndex` is set.
|
|
1215
|
+
* Selects the server entry used to compute the base URL for plugins that need
|
|
1216
|
+
* it, and overrides its `{variable}` placeholders. Omit to leave `baseURL`
|
|
1217
|
+
* undefined.
|
|
453
1218
|
*
|
|
454
1219
|
* @example
|
|
455
1220
|
* ```ts
|
|
456
1221
|
* // spec server: "https://api.{env}.example.com"
|
|
457
|
-
*
|
|
1222
|
+
* server: { index: 0, variables: { env: 'prod' } }
|
|
458
1223
|
* // → baseURL: "https://api.prod.example.com"
|
|
459
1224
|
* ```
|
|
460
1225
|
*/
|
|
461
|
-
|
|
1226
|
+
server?: ServerOptions;
|
|
1227
|
+
/**
|
|
1228
|
+
* How the `discriminator` field on `oneOf`/`anyOf` schemas is interpreted.
|
|
1229
|
+
* - `'preserve'` child schemas stay exactly as written. The discriminator
|
|
1230
|
+
* narrows types at the call site but child shapes are not modified.
|
|
1231
|
+
* - `'propagate'` Kubb pushes the discriminator property as a literal value
|
|
1232
|
+
* into each child schema, so each branch's discriminator field is precisely
|
|
1233
|
+
* typed.
|
|
1234
|
+
*
|
|
1235
|
+
* @default 'preserve'
|
|
1236
|
+
*/
|
|
1237
|
+
discriminator?: 'preserve' | 'propagate';
|
|
462
1238
|
/**
|
|
463
|
-
*
|
|
464
|
-
* - `'
|
|
465
|
-
* - `'
|
|
466
|
-
*
|
|
1239
|
+
* Where inline enums live.
|
|
1240
|
+
* - `'inline'` keeps each enum inline on the property that declares it.
|
|
1241
|
+
* - `'root'` lifts every inline enum to a reusable top-level schema named after its context
|
|
1242
|
+
* (e.g. `PetStatusEnum`) and references it everywhere it appears.
|
|
1243
|
+
*
|
|
1244
|
+
* @default 'inline'
|
|
467
1245
|
*/
|
|
468
|
-
|
|
1246
|
+
enums?: 'inline' | 'root';
|
|
469
1247
|
} & Partial<ast.ParserOptions>;
|
|
470
1248
|
/**
|
|
471
|
-
* Adapter options after defaults have been applied
|
|
1249
|
+
* Adapter options after defaults have been applied.
|
|
472
1250
|
*/
|
|
473
1251
|
type AdapterOasResolvedOptions = {
|
|
474
1252
|
validate: boolean;
|
|
475
1253
|
contentType: AdapterOasOptions['contentType'];
|
|
476
|
-
|
|
477
|
-
serverVariables: AdapterOasOptions['serverVariables'];
|
|
1254
|
+
server: AdapterOasOptions['server'];
|
|
478
1255
|
discriminator: NonNullable<AdapterOasOptions['discriminator']>;
|
|
1256
|
+
enums: NonNullable<AdapterOasOptions['enums']>;
|
|
479
1257
|
dateType: NonNullable<AdapterOasOptions['dateType']>;
|
|
480
1258
|
integerType: NonNullable<AdapterOasOptions['integerType']>;
|
|
481
1259
|
unknownType: NonNullable<AdapterOasOptions['unknownType']>;
|
|
482
1260
|
emptySchemaType: NonNullable<AdapterOasOptions['emptySchemaType']>;
|
|
483
1261
|
enumSuffix: AdapterOasOptions['enumSuffix'];
|
|
484
|
-
/**
|
|
485
|
-
* Map from original `$ref` paths to their collision-resolved schema names.
|
|
486
|
-
* Populated after each `parse()` call.
|
|
487
|
-
*
|
|
488
|
-
* @example
|
|
489
|
-
* ```ts
|
|
490
|
-
* nameMapping.get('#/components/schemas/Order') // 'Order'
|
|
491
|
-
* nameMapping.get('#/components/responses/Order') // 'OrderResponse'
|
|
492
|
-
* ```
|
|
493
|
-
*/
|
|
494
|
-
nameMapping: Map<string, string>;
|
|
495
1262
|
};
|
|
496
1263
|
/**
|
|
497
1264
|
* `@kubb/core` adapter factory type for the OpenAPI adapter.
|
|
@@ -500,14 +1267,17 @@ type AdapterOas = AdapterFactoryOptions<'oas', AdapterOasOptions, AdapterOasReso
|
|
|
500
1267
|
//#endregion
|
|
501
1268
|
//#region src/adapter.d.ts
|
|
502
1269
|
/**
|
|
503
|
-
*
|
|
1270
|
+
* The `name` of `@kubb/adapter-oas`, used to identify this adapter in a Kubb config.
|
|
504
1271
|
*/
|
|
505
1272
|
declare const adapterOasName = "oas";
|
|
506
1273
|
/**
|
|
507
|
-
*
|
|
1274
|
+
* Default Kubb adapter for OpenAPI 2.0, 3.0, and 3.1 specifications. Reads the
|
|
1275
|
+
* spec from `input` (a file path, URL, inline content, or parsed object), validates
|
|
1276
|
+
* it, resolves the base URL, and converts every schema and operation into the
|
|
1277
|
+
* universal AST that every downstream plugin consumes.
|
|
508
1278
|
*
|
|
509
|
-
*
|
|
510
|
-
*
|
|
1279
|
+
* Configure once on `defineConfig`. The adapter's choices (date representation,
|
|
1280
|
+
* integer width, server URL) apply to every plugin in the build.
|
|
511
1281
|
*
|
|
512
1282
|
* @example
|
|
513
1283
|
* ```ts
|
|
@@ -516,30 +1286,18 @@ declare const adapterOasName = "oas";
|
|
|
516
1286
|
* import { pluginTs } from '@kubb/plugin-ts'
|
|
517
1287
|
*
|
|
518
1288
|
* export default defineConfig({
|
|
519
|
-
*
|
|
520
|
-
*
|
|
1289
|
+
* input: './petStore.yaml',
|
|
1290
|
+
* output: { path: './src/gen' },
|
|
1291
|
+
* adapter: adapterOas({
|
|
1292
|
+
* server: { index: 0 },
|
|
1293
|
+
* discriminator: 'propagate',
|
|
1294
|
+
* dateType: 'date',
|
|
1295
|
+
* }),
|
|
521
1296
|
* plugins: [pluginTs()],
|
|
522
1297
|
* })
|
|
523
1298
|
* ```
|
|
524
1299
|
*/
|
|
525
|
-
declare const adapterOas: (options?: AdapterOasOptions | undefined) =>
|
|
526
|
-
//#endregion
|
|
527
|
-
//#region src/factory.d.ts
|
|
528
|
-
type ValidateDocumentOptions = {
|
|
529
|
-
throwOnError?: boolean;
|
|
530
|
-
};
|
|
531
|
-
/**
|
|
532
|
-
* Deep-merges multiple OpenAPI documents into a single `Document`.
|
|
533
|
-
*
|
|
534
|
-
* Each document is parsed independently then recursively merged via `mergeDeep` from `@internals/utils`.
|
|
535
|
-
* Throws when the input array is empty.
|
|
536
|
-
*
|
|
537
|
-
* @example
|
|
538
|
-
* ```ts
|
|
539
|
-
* const document = await mergeDocuments(['./pets.yaml', './orders.yaml'])
|
|
540
|
-
* ```
|
|
541
|
-
*/
|
|
542
|
-
declare function mergeDocuments(pathOrApi: Array<string | Document>): Promise<Document>;
|
|
1300
|
+
declare const adapterOas: (options?: AdapterOasOptions | undefined) => import("@kubb/core").Adapter<AdapterOas>;
|
|
543
1301
|
//#endregion
|
|
544
|
-
export { type AdapterOas, type AdapterOasOptions, type AdapterOasResolvedOptions, type ContentType, type DiscriminatorObject$1 as DiscriminatorObject, type Document, type
|
|
1302
|
+
export { type AdapterOas, type AdapterOasOptions, type AdapterOasResolvedOptions, type ContentType, type DiscriminatorObject$1 as DiscriminatorObject, type Document, type MediaTypeObject$1 as MediaTypeObject, type Operation, type ReferenceObject$1 as ReferenceObject, type ResponseObject$1 as ResponseObject, type SchemaObject$1 as SchemaObject, adapterOas, adapterOasName };
|
|
545
1303
|
//# sourceMappingURL=index.d.ts.map
|