@kubb/adapter-oas 5.0.0-beta.7 → 5.0.0-beta.70
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 +26 -24
- package/dist/index.cjs +1461 -716
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +840 -77
- package/dist/index.js +1464 -714
- package/dist/index.js.map +1 -1
- package/package.json +13 -10
- 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 -165
- package/src/guards.ts +0 -68
- package/src/index.ts +0 -18
- package/src/parser.ts +0 -1002
- package/src/refs.ts +0 -59
- 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 * as _$_kubb_core0 from "@kubb/core";
|
|
1
|
+
import { t as __name } from "./rolldown-runtime-C0LytTxp.js";
|
|
3
2
|
import { AdapterFactoryOptions, ast } from "@kubb/core";
|
|
4
|
-
import { DiscriminatorObject as DiscriminatorObject$2, MediaTypeObject as MediaTypeObject$2, OASDocument, ResponseObject as ResponseObject$2, SchemaObject as SchemaObject$2 } from "oas/types";
|
|
5
|
-
import { Operation as Operation$1 } from "oas/operation";
|
|
6
3
|
|
|
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;
|
|
@@ -324,10 +1056,22 @@ 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, so any in-place `$ref` resolution the resolvers
|
|
1064
|
+
* perform is visible here too.
|
|
1065
|
+
*/
|
|
1066
|
+
type Operation = {
|
|
1067
|
+
path: string;
|
|
1068
|
+
method: string;
|
|
1069
|
+
schema: OperationObject$1;
|
|
1070
|
+
};
|
|
1071
|
+
//#endregion
|
|
327
1072
|
//#region src/types.d.ts
|
|
328
1073
|
/**
|
|
329
|
-
*
|
|
330
|
-
* Supports `'application/json'` or any other media type.
|
|
1074
|
+
* Media type used to pick a schema from an operation's request or response.
|
|
331
1075
|
*
|
|
332
1076
|
* @example
|
|
333
1077
|
* ```ts
|
|
@@ -348,7 +1092,18 @@ type ContentType = 'application/json' | (string & {});
|
|
|
348
1092
|
* }
|
|
349
1093
|
* ```
|
|
350
1094
|
*/
|
|
351
|
-
type SchemaObject$1 =
|
|
1095
|
+
type SchemaObject$1 = {
|
|
1096
|
+
externalDocs?: unknown;
|
|
1097
|
+
xml?: unknown;
|
|
1098
|
+
$schema?: string;
|
|
1099
|
+
deprecated?: boolean;
|
|
1100
|
+
example?: unknown;
|
|
1101
|
+
examples?: Array<unknown>;
|
|
1102
|
+
nullable?: boolean;
|
|
1103
|
+
readOnly?: boolean;
|
|
1104
|
+
writeOnly?: boolean;
|
|
1105
|
+
discriminator?: DiscriminatorObject$1;
|
|
1106
|
+
'x-readme-ref-name'?: string;
|
|
352
1107
|
/**
|
|
353
1108
|
* OAS 3.0 vendor extension: marks a schema as nullable without using `type: ['null', ...]`.
|
|
354
1109
|
*/
|
|
@@ -375,97 +1130,114 @@ type SchemaObject$1 = SchemaObject$2 & {
|
|
|
375
1130
|
*/
|
|
376
1131
|
items?: SchemaObject$1 | ReferenceObject$1;
|
|
377
1132
|
/**
|
|
378
|
-
*
|
|
1133
|
+
* Allowed values for this schema.
|
|
379
1134
|
*/
|
|
380
1135
|
enum?: Array<string | number | boolean | null>;
|
|
381
|
-
};
|
|
1136
|
+
} & (OpenAPIV3_1.SchemaObject | JSONSchema4 | JSONSchema6 | JSONSchema7);
|
|
382
1137
|
/**
|
|
383
|
-
*
|
|
384
|
-
*
|
|
385
|
-
* @example
|
|
386
|
-
* ```ts
|
|
387
|
-
* HttpMethods['GET'] // 'get'
|
|
388
|
-
* HttpMethods['POST'] // 'post'
|
|
389
|
-
* ```
|
|
390
|
-
*/
|
|
391
|
-
declare const HttpMethods$1: Record<Uppercase<ast.HttpMethod>, Lowercase<ast.HttpMethod>>;
|
|
392
|
-
/**
|
|
393
|
-
* HTTP method as a lowercase string (`'get' | 'post' | ...`).
|
|
1138
|
+
* HTTP method in the lowercase form an OpenAPI path item uses for its keys.
|
|
394
1139
|
*/
|
|
395
1140
|
type HttpMethod = Lowercase<ast.HttpMethod>;
|
|
396
1141
|
/**
|
|
397
1142
|
* Normalized OpenAPI document after parsing.
|
|
398
1143
|
*/
|
|
399
|
-
type Document =
|
|
1144
|
+
type Document = OpenAPIV3_1.Document & Record<string, unknown>;
|
|
400
1145
|
/**
|
|
401
|
-
*
|
|
1146
|
+
* Single operation object (the `get`/`post`/… entry on a path item) plus any vendor extensions.
|
|
402
1147
|
*/
|
|
403
|
-
type
|
|
1148
|
+
type OperationObject$1 = OpenAPIV3_1.OperationObject & Record<string, unknown>;
|
|
404
1149
|
/**
|
|
405
1150
|
* Discriminator object for `oneOf`/`anyOf` schemas in OpenAPI.
|
|
406
1151
|
*/
|
|
407
|
-
type DiscriminatorObject$1 = DiscriminatorObject
|
|
1152
|
+
type DiscriminatorObject$1 = OpenAPIV3_1.DiscriminatorObject;
|
|
408
1153
|
/**
|
|
409
1154
|
* OpenAPI reference object pointing to a schema definition via `$ref`.
|
|
410
1155
|
*/
|
|
411
|
-
type ReferenceObject$1 =
|
|
1156
|
+
type ReferenceObject$1 = OpenAPIV3_1.ReferenceObject;
|
|
412
1157
|
/**
|
|
413
|
-
* OpenAPI response object
|
|
1158
|
+
* OpenAPI response object holding the content and headers for one status code.
|
|
414
1159
|
*/
|
|
415
|
-
type ResponseObject$1 = ResponseObject
|
|
1160
|
+
type ResponseObject$1 = OpenAPIV3_1.ResponseObject;
|
|
416
1161
|
/**
|
|
417
1162
|
* OpenAPI media type object that maps a content-type string to its schema.
|
|
418
1163
|
*/
|
|
419
|
-
type MediaTypeObject$1 = MediaTypeObject
|
|
1164
|
+
type MediaTypeObject$1 = OpenAPIV3_1.MediaTypeObject;
|
|
1165
|
+
/**
|
|
1166
|
+
* Selects which entry in the spec's `servers` array becomes the base URL and
|
|
1167
|
+
* supplies values for its `{variable}` placeholders.
|
|
1168
|
+
*/
|
|
1169
|
+
type ServerOptions = {
|
|
1170
|
+
/**
|
|
1171
|
+
* Index into the `servers` array from your OpenAPI spec. Most projects pick
|
|
1172
|
+
* `0` for the primary server. Omit to leave `baseURL` undefined.
|
|
1173
|
+
*/
|
|
1174
|
+
index?: number;
|
|
1175
|
+
/**
|
|
1176
|
+
* Override values for `{variable}` placeholders in the selected server URL.
|
|
1177
|
+
* Variables you do not provide use their `default` value from the spec.
|
|
1178
|
+
*/
|
|
1179
|
+
variables?: Record<string, string>;
|
|
1180
|
+
};
|
|
420
1181
|
/**
|
|
421
|
-
* Configuration
|
|
422
|
-
*
|
|
1182
|
+
* Configuration for the OpenAPI adapter: spec validation, content-type selection,
|
|
1183
|
+
* server URL resolution, and how schema types are derived.
|
|
423
1184
|
*
|
|
424
1185
|
* @example
|
|
425
1186
|
* ```ts
|
|
426
1187
|
* adapterOas({
|
|
427
1188
|
* validate: false,
|
|
428
1189
|
* dateType: 'date',
|
|
429
|
-
*
|
|
430
|
-
* serverVariables: { env: 'prod' },
|
|
1190
|
+
* server: { index: 0, variables: { env: 'prod' } },
|
|
431
1191
|
* })
|
|
432
1192
|
* ```
|
|
433
1193
|
*/
|
|
434
1194
|
type AdapterOasOptions = {
|
|
435
1195
|
/**
|
|
436
|
-
* Validate the OpenAPI spec before parsing.
|
|
1196
|
+
* Validate the OpenAPI spec with `@readme/openapi-parser` before parsing.
|
|
1197
|
+
* Set to `false` only when you have a known-invalid spec you still want to
|
|
1198
|
+
* generate from.
|
|
1199
|
+
*
|
|
437
1200
|
* @default true
|
|
438
1201
|
*/
|
|
439
1202
|
validate?: boolean;
|
|
440
1203
|
/**
|
|
441
|
-
* Preferred
|
|
442
|
-
*
|
|
1204
|
+
* Preferred media type when an operation defines several. Defaults to the
|
|
1205
|
+
* first JSON-compatible media type found in the spec.
|
|
443
1206
|
*/
|
|
444
1207
|
contentType?: ContentType;
|
|
445
1208
|
/**
|
|
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.
|
|
1209
|
+
* Selects the server entry used to compute the base URL for plugins that need
|
|
1210
|
+
* it, and overrides its `{variable}` placeholders. Omit to leave `baseURL`
|
|
1211
|
+
* undefined.
|
|
453
1212
|
*
|
|
454
1213
|
* @example
|
|
455
1214
|
* ```ts
|
|
456
1215
|
* // spec server: "https://api.{env}.example.com"
|
|
457
|
-
*
|
|
1216
|
+
* server: { index: 0, variables: { env: 'prod' } }
|
|
458
1217
|
* // → baseURL: "https://api.prod.example.com"
|
|
459
1218
|
* ```
|
|
460
1219
|
*/
|
|
461
|
-
|
|
1220
|
+
server?: ServerOptions;
|
|
1221
|
+
/**
|
|
1222
|
+
* How the `discriminator` field on `oneOf`/`anyOf` schemas is interpreted.
|
|
1223
|
+
* - `'preserve'` child schemas stay exactly as written. The discriminator
|
|
1224
|
+
* narrows types at the call site but child shapes are not modified.
|
|
1225
|
+
* - `'propagate'` Kubb pushes the discriminator property as a literal value
|
|
1226
|
+
* into each child schema, so each branch's discriminator field is precisely
|
|
1227
|
+
* typed.
|
|
1228
|
+
*
|
|
1229
|
+
* @default 'preserve'
|
|
1230
|
+
*/
|
|
1231
|
+
discriminator?: 'preserve' | 'propagate';
|
|
462
1232
|
/**
|
|
463
|
-
*
|
|
464
|
-
* - `'
|
|
465
|
-
* - `'
|
|
466
|
-
*
|
|
1233
|
+
* Where inline enums live.
|
|
1234
|
+
* - `'inline'` keeps each enum inline on the property that declares it.
|
|
1235
|
+
* - `'root'` lifts every inline enum to a reusable top-level schema named after its context
|
|
1236
|
+
* (e.g. `PetStatusEnum`) and references it everywhere it appears.
|
|
1237
|
+
*
|
|
1238
|
+
* @default 'inline'
|
|
467
1239
|
*/
|
|
468
|
-
|
|
1240
|
+
enums?: 'inline' | 'root';
|
|
469
1241
|
} & Partial<ast.ParserOptions>;
|
|
470
1242
|
/**
|
|
471
1243
|
* Adapter options after defaults have been applied and schema name collisions resolved.
|
|
@@ -473,9 +1245,9 @@ type AdapterOasOptions = {
|
|
|
473
1245
|
type AdapterOasResolvedOptions = {
|
|
474
1246
|
validate: boolean;
|
|
475
1247
|
contentType: AdapterOasOptions['contentType'];
|
|
476
|
-
|
|
477
|
-
serverVariables: AdapterOasOptions['serverVariables'];
|
|
1248
|
+
server: AdapterOasOptions['server'];
|
|
478
1249
|
discriminator: NonNullable<AdapterOasOptions['discriminator']>;
|
|
1250
|
+
enums: NonNullable<AdapterOasOptions['enums']>;
|
|
479
1251
|
dateType: NonNullable<AdapterOasOptions['dateType']>;
|
|
480
1252
|
integerType: NonNullable<AdapterOasOptions['integerType']>;
|
|
481
1253
|
unknownType: NonNullable<AdapterOasOptions['unknownType']>;
|
|
@@ -483,7 +1255,7 @@ type AdapterOasResolvedOptions = {
|
|
|
483
1255
|
enumSuffix: AdapterOasOptions['enumSuffix'];
|
|
484
1256
|
/**
|
|
485
1257
|
* Map from original `$ref` paths to their collision-resolved schema names.
|
|
486
|
-
* Populated
|
|
1258
|
+
* Populated once the adapter resolves a spec's schemas, on the first `stream()` or `parse()`.
|
|
487
1259
|
*
|
|
488
1260
|
* @example
|
|
489
1261
|
* ```ts
|
|
@@ -500,14 +1272,17 @@ type AdapterOas = AdapterFactoryOptions<'oas', AdapterOasOptions, AdapterOasReso
|
|
|
500
1272
|
//#endregion
|
|
501
1273
|
//#region src/adapter.d.ts
|
|
502
1274
|
/**
|
|
503
|
-
*
|
|
1275
|
+
* The `name` of `@kubb/adapter-oas`, used to identify this adapter in a Kubb config.
|
|
504
1276
|
*/
|
|
505
1277
|
declare const adapterOasName = "oas";
|
|
506
1278
|
/**
|
|
507
|
-
*
|
|
1279
|
+
* Default Kubb adapter for OpenAPI 2.0, 3.0, and 3.1 specifications. Reads the
|
|
1280
|
+
* file at `input.path`, validates it, resolves the base URL, and converts every
|
|
1281
|
+
* schema and operation into the universal AST that every downstream plugin
|
|
1282
|
+
* consumes.
|
|
508
1283
|
*
|
|
509
|
-
*
|
|
510
|
-
*
|
|
1284
|
+
* Configure once on `defineConfig`. The adapter's choices (date representation,
|
|
1285
|
+
* integer width, server URL) apply to every plugin in the build.
|
|
511
1286
|
*
|
|
512
1287
|
* @example
|
|
513
1288
|
* ```ts
|
|
@@ -516,30 +1291,18 @@ declare const adapterOasName = "oas";
|
|
|
516
1291
|
* import { pluginTs } from '@kubb/plugin-ts'
|
|
517
1292
|
*
|
|
518
1293
|
* export default defineConfig({
|
|
519
|
-
*
|
|
520
|
-
*
|
|
1294
|
+
* input: { path: './petStore.yaml' },
|
|
1295
|
+
* output: { path: './src/gen' },
|
|
1296
|
+
* adapter: adapterOas({
|
|
1297
|
+
* server: { index: 0 },
|
|
1298
|
+
* discriminator: 'propagate',
|
|
1299
|
+
* dateType: 'date',
|
|
1300
|
+
* }),
|
|
521
1301
|
* plugins: [pluginTs()],
|
|
522
1302
|
* })
|
|
523
1303
|
* ```
|
|
524
1304
|
*/
|
|
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>;
|
|
1305
|
+
declare const adapterOas: (options?: AdapterOasOptions | undefined) => import("@kubb/core").Adapter<AdapterOas>;
|
|
543
1306
|
//#endregion
|
|
544
|
-
export { type AdapterOas, type AdapterOasOptions, type AdapterOasResolvedOptions, type ContentType, type DiscriminatorObject$1 as DiscriminatorObject, type Document, type HttpMethod,
|
|
1307
|
+
export { type AdapterOas, type AdapterOasOptions, type AdapterOasResolvedOptions, type ContentType, type DiscriminatorObject$1 as DiscriminatorObject, type Document, type HttpMethod, 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
1308
|
//# sourceMappingURL=index.d.ts.map
|