@kubb/plugin-oas 4.20.3 → 4.20.5

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.
@@ -0,0 +1,350 @@
1
+ import { Config } from "@kubb/core";
2
+ import { KubbFile } from "@kubb/fabric-core/types";
3
+ import * as oas_normalize_lib_types0 from "oas-normalize/lib/types";
4
+ import BaseOas from "oas";
5
+ import { Operation } from "oas/operation";
6
+ import { OpenAPIV3, OpenAPIV3_1 } from "openapi-types";
7
+ import * as OasTypes from "oas/types";
8
+ import { DiscriminatorObject, HttpMethods, OASDocument, SchemaObject } from "oas/types";
9
+
10
+ //#region rolldown:runtime
11
+ //#endregion
12
+ //#region ../oas/src/types.d.ts
13
+ type contentType = 'application/json' | (string & {});
14
+ type SchemaObject$1 = SchemaObject & {
15
+ 'x-nullable'?: boolean;
16
+ $ref?: string;
17
+ };
18
+ type HttpMethod = HttpMethods;
19
+ type Document = OASDocument;
20
+ type Operation$1 = Operation;
21
+ type DiscriminatorObject$1 = DiscriminatorObject;
22
+ //#endregion
23
+ //#region ../oas/src/Oas.d.ts
24
+ type OasOptions = {
25
+ contentType?: contentType;
26
+ discriminator?: 'strict' | 'inherit';
27
+ /**
28
+ * Resolve name collisions when schemas from different components share the same name (case-insensitive).
29
+ * @default false
30
+ */
31
+ collisionDetection?: boolean;
32
+ };
33
+ declare class Oas extends BaseOas {
34
+ #private;
35
+ document: Document;
36
+ constructor(document: Document);
37
+ setOptions(options: OasOptions): void;
38
+ get options(): OasOptions;
39
+ get<T = unknown>($ref: string): T | null;
40
+ getKey($ref: string): string | undefined;
41
+ set($ref: string, value: unknown): false | undefined;
42
+ getDiscriminator(schema: SchemaObject$1 | null): DiscriminatorObject$1 | null;
43
+ dereferenceWithRef<T = unknown>(schema?: T): T;
44
+ getResponseSchema(operation: Operation$1, statusCode: string | number): SchemaObject$1;
45
+ getRequestSchema(operation: Operation$1): SchemaObject$1 | undefined;
46
+ getParametersSchema(operation: Operation$1, inKey: 'path' | 'query' | 'header'): SchemaObject$1 | null;
47
+ validate(): Promise<oas_normalize_lib_types0.ValidationResult>;
48
+ flattenSchema(schema: SchemaObject$1 | null): SchemaObject$1 | null;
49
+ /**
50
+ * Get schemas from OpenAPI components (schemas, responses, requestBodies).
51
+ * Returns schemas in dependency order along with name mapping for collision resolution.
52
+ */
53
+ getSchemas(options?: {
54
+ contentType?: contentType;
55
+ includes?: Array<'schemas' | 'responses' | 'requestBodies'>;
56
+ collisionDetection?: boolean;
57
+ }): {
58
+ schemas: Record<string, SchemaObject$1>;
59
+ nameMapping: Map<string, string>;
60
+ };
61
+ }
62
+ //#endregion
63
+ //#region ../oas/src/utils.d.ts
64
+ declare function isOptional(schema?: SchemaObject): boolean;
65
+ //#endregion
66
+ //#region src/SchemaMapper.d.ts
67
+ type SchemaKeywordMapper = {
68
+ object: {
69
+ keyword: 'object';
70
+ args: {
71
+ properties: {
72
+ [x: string]: Schema[];
73
+ };
74
+ additionalProperties: Schema[];
75
+ patternProperties?: Record<string, Schema[]>;
76
+ strict?: boolean;
77
+ };
78
+ };
79
+ url: {
80
+ keyword: 'url';
81
+ };
82
+ readOnly: {
83
+ keyword: 'readOnly';
84
+ };
85
+ writeOnly: {
86
+ keyword: 'writeOnly';
87
+ };
88
+ uuid: {
89
+ keyword: 'uuid';
90
+ };
91
+ email: {
92
+ keyword: 'email';
93
+ };
94
+ firstName: {
95
+ keyword: 'firstName';
96
+ };
97
+ lastName: {
98
+ keyword: 'lastName';
99
+ };
100
+ phone: {
101
+ keyword: 'phone';
102
+ };
103
+ password: {
104
+ keyword: 'password';
105
+ };
106
+ date: {
107
+ keyword: 'date';
108
+ args: {
109
+ type?: 'date' | 'string';
110
+ };
111
+ };
112
+ time: {
113
+ keyword: 'time';
114
+ args: {
115
+ type?: 'date' | 'string';
116
+ };
117
+ };
118
+ datetime: {
119
+ keyword: 'datetime';
120
+ args: {
121
+ offset?: boolean;
122
+ local?: boolean;
123
+ };
124
+ };
125
+ tuple: {
126
+ keyword: 'tuple';
127
+ args: {
128
+ items: Schema[];
129
+ min?: number;
130
+ max?: number;
131
+ rest?: Schema;
132
+ };
133
+ };
134
+ array: {
135
+ keyword: 'array';
136
+ args: {
137
+ items: Schema[];
138
+ min?: number;
139
+ max?: number;
140
+ unique?: boolean;
141
+ };
142
+ };
143
+ enum: {
144
+ keyword: 'enum';
145
+ args: {
146
+ name: string;
147
+ typeName: string;
148
+ asConst: boolean;
149
+ items: Array<{
150
+ name: string | number;
151
+ format: 'string' | 'number' | 'boolean';
152
+ value?: string | number | boolean;
153
+ }>;
154
+ };
155
+ };
156
+ and: {
157
+ keyword: 'and';
158
+ args: Schema[];
159
+ };
160
+ const: {
161
+ keyword: 'const';
162
+ args: {
163
+ name: string | number;
164
+ format: 'string' | 'number' | 'boolean';
165
+ value?: string | number | boolean;
166
+ };
167
+ };
168
+ union: {
169
+ keyword: 'union';
170
+ args: Schema[];
171
+ };
172
+ ref: {
173
+ keyword: 'ref';
174
+ args: {
175
+ name: string;
176
+ $ref: string;
177
+ /**
178
+ * Full qualified path.
179
+ */
180
+ path: KubbFile.Path;
181
+ /**
182
+ * When true `File.Import` is used.
183
+ * When false a reference is used inside the current file.
184
+ */
185
+ isImportable: boolean;
186
+ };
187
+ };
188
+ matches: {
189
+ keyword: 'matches';
190
+ args?: string;
191
+ };
192
+ boolean: {
193
+ keyword: 'boolean';
194
+ };
195
+ default: {
196
+ keyword: 'default';
197
+ args: string | number | boolean;
198
+ };
199
+ string: {
200
+ keyword: 'string';
201
+ };
202
+ integer: {
203
+ keyword: 'integer';
204
+ };
205
+ number: {
206
+ keyword: 'number';
207
+ };
208
+ max: {
209
+ keyword: 'max';
210
+ args: number;
211
+ };
212
+ min: {
213
+ keyword: 'min';
214
+ args: number;
215
+ };
216
+ exclusiveMaximum: {
217
+ keyword: 'exclusiveMaximum';
218
+ args: number;
219
+ };
220
+ exclusiveMinimum: {
221
+ keyword: 'exclusiveMinimum';
222
+ args: number;
223
+ };
224
+ describe: {
225
+ keyword: 'describe';
226
+ args: string;
227
+ };
228
+ example: {
229
+ keyword: 'example';
230
+ args: string;
231
+ };
232
+ deprecated: {
233
+ keyword: 'deprecated';
234
+ };
235
+ optional: {
236
+ keyword: 'optional';
237
+ };
238
+ undefined: {
239
+ keyword: 'undefined';
240
+ };
241
+ nullish: {
242
+ keyword: 'nullish';
243
+ };
244
+ nullable: {
245
+ keyword: 'nullable';
246
+ };
247
+ null: {
248
+ keyword: 'null';
249
+ };
250
+ any: {
251
+ keyword: 'any';
252
+ };
253
+ unknown: {
254
+ keyword: 'unknown';
255
+ };
256
+ void: {
257
+ keyword: 'void';
258
+ };
259
+ blob: {
260
+ keyword: 'blob';
261
+ };
262
+ schema: {
263
+ keyword: 'schema';
264
+ args: {
265
+ type: 'string' | 'number' | 'integer' | 'boolean' | 'array' | 'object';
266
+ format?: string;
267
+ };
268
+ };
269
+ name: {
270
+ keyword: 'name';
271
+ args: string;
272
+ };
273
+ catchall: {
274
+ keyword: 'catchall';
275
+ };
276
+ interface: {
277
+ keyword: 'interface';
278
+ };
279
+ };
280
+ declare const schemaKeywords: {
281
+ any: "any";
282
+ unknown: "unknown";
283
+ number: "number";
284
+ integer: "integer";
285
+ string: "string";
286
+ boolean: "boolean";
287
+ undefined: "undefined";
288
+ nullable: "nullable";
289
+ null: "null";
290
+ nullish: "nullish";
291
+ array: "array";
292
+ tuple: "tuple";
293
+ enum: "enum";
294
+ union: "union";
295
+ datetime: "datetime";
296
+ date: "date";
297
+ email: "email";
298
+ uuid: "uuid";
299
+ url: "url";
300
+ void: "void";
301
+ default: "default";
302
+ const: "const";
303
+ and: "and";
304
+ describe: "describe";
305
+ min: "min";
306
+ max: "max";
307
+ exclusiveMinimum: "exclusiveMinimum";
308
+ exclusiveMaximum: "exclusiveMaximum";
309
+ optional: "optional";
310
+ readOnly: "readOnly";
311
+ writeOnly: "writeOnly";
312
+ object: "object";
313
+ ref: "ref";
314
+ matches: "matches";
315
+ firstName: "firstName";
316
+ lastName: "lastName";
317
+ password: "password";
318
+ phone: "phone";
319
+ blob: "blob";
320
+ deprecated: "deprecated";
321
+ example: "example";
322
+ schema: "schema";
323
+ catchall: "catchall";
324
+ time: "time";
325
+ name: "name";
326
+ interface: "interface";
327
+ };
328
+ type SchemaKeyword = keyof SchemaKeywordMapper;
329
+ type SchemaMapper<T = string | null | undefined> = { [K in keyof SchemaKeywordMapper]: (() => T | undefined) | undefined };
330
+ type SchemaKeywordBase<T> = {
331
+ keyword: SchemaKeyword;
332
+ args: T;
333
+ };
334
+ type Schema = {
335
+ keyword: string;
336
+ } | SchemaKeywordMapper[keyof SchemaKeywordMapper];
337
+ type SchemaTree = {
338
+ schema: SchemaObject$1;
339
+ parent: Schema | undefined;
340
+ current: Schema;
341
+ siblings: Schema[];
342
+ /**
343
+ * this is equal to the key of a property(object)
344
+ */
345
+ name?: string;
346
+ };
347
+ declare function isKeyword<T extends Schema, K extends keyof SchemaKeywordMapper>(meta: T, keyword: K): meta is Extract<T, SchemaKeywordMapper[K]>;
348
+ //#endregion
349
+ export { contentType as _, SchemaMapper as a, schemaKeywords as c, HttpMethod as d, OasTypes as f, SchemaObject$1 as g, Operation$1 as h, SchemaKeywordMapper as i, isOptional as l, OpenAPIV3_1 as m, SchemaKeyword as n, SchemaTree as o, OpenAPIV3 as p, SchemaKeywordBase as r, isKeyword as s, Schema as t, Oas as u, __name as v };
350
+ //# sourceMappingURL=SchemaMapper-CE2wt2cR.d.cts.map
@@ -0,0 +1,349 @@
1
+ import { t as __name } from "./chunk-iVr_oF3V.js";
2
+ import { Config } from "@kubb/core";
3
+ import { KubbFile } from "@kubb/fabric-core/types";
4
+ import * as oas_normalize_lib_types0 from "oas-normalize/lib/types";
5
+ import BaseOas from "oas";
6
+ import { Operation } from "oas/operation";
7
+ import { OpenAPIV3, OpenAPIV3_1 } from "openapi-types";
8
+ import * as OasTypes from "oas/types";
9
+ import { DiscriminatorObject, HttpMethods, OASDocument, SchemaObject } from "oas/types";
10
+
11
+ //#region ../oas/src/types.d.ts
12
+ type contentType = 'application/json' | (string & {});
13
+ type SchemaObject$1 = SchemaObject & {
14
+ 'x-nullable'?: boolean;
15
+ $ref?: string;
16
+ };
17
+ type HttpMethod = HttpMethods;
18
+ type Document = OASDocument;
19
+ type Operation$1 = Operation;
20
+ type DiscriminatorObject$1 = DiscriminatorObject;
21
+ //#endregion
22
+ //#region ../oas/src/Oas.d.ts
23
+ type OasOptions = {
24
+ contentType?: contentType;
25
+ discriminator?: 'strict' | 'inherit';
26
+ /**
27
+ * Resolve name collisions when schemas from different components share the same name (case-insensitive).
28
+ * @default false
29
+ */
30
+ collisionDetection?: boolean;
31
+ };
32
+ declare class Oas extends BaseOas {
33
+ #private;
34
+ document: Document;
35
+ constructor(document: Document);
36
+ setOptions(options: OasOptions): void;
37
+ get options(): OasOptions;
38
+ get<T = unknown>($ref: string): T | null;
39
+ getKey($ref: string): string | undefined;
40
+ set($ref: string, value: unknown): false | undefined;
41
+ getDiscriminator(schema: SchemaObject$1 | null): DiscriminatorObject$1 | null;
42
+ dereferenceWithRef<T = unknown>(schema?: T): T;
43
+ getResponseSchema(operation: Operation$1, statusCode: string | number): SchemaObject$1;
44
+ getRequestSchema(operation: Operation$1): SchemaObject$1 | undefined;
45
+ getParametersSchema(operation: Operation$1, inKey: 'path' | 'query' | 'header'): SchemaObject$1 | null;
46
+ validate(): Promise<oas_normalize_lib_types0.ValidationResult>;
47
+ flattenSchema(schema: SchemaObject$1 | null): SchemaObject$1 | null;
48
+ /**
49
+ * Get schemas from OpenAPI components (schemas, responses, requestBodies).
50
+ * Returns schemas in dependency order along with name mapping for collision resolution.
51
+ */
52
+ getSchemas(options?: {
53
+ contentType?: contentType;
54
+ includes?: Array<'schemas' | 'responses' | 'requestBodies'>;
55
+ collisionDetection?: boolean;
56
+ }): {
57
+ schemas: Record<string, SchemaObject$1>;
58
+ nameMapping: Map<string, string>;
59
+ };
60
+ }
61
+ //#endregion
62
+ //#region ../oas/src/utils.d.ts
63
+ declare function isOptional(schema?: SchemaObject): boolean;
64
+ //#endregion
65
+ //#region src/SchemaMapper.d.ts
66
+ type SchemaKeywordMapper = {
67
+ object: {
68
+ keyword: 'object';
69
+ args: {
70
+ properties: {
71
+ [x: string]: Schema[];
72
+ };
73
+ additionalProperties: Schema[];
74
+ patternProperties?: Record<string, Schema[]>;
75
+ strict?: boolean;
76
+ };
77
+ };
78
+ url: {
79
+ keyword: 'url';
80
+ };
81
+ readOnly: {
82
+ keyword: 'readOnly';
83
+ };
84
+ writeOnly: {
85
+ keyword: 'writeOnly';
86
+ };
87
+ uuid: {
88
+ keyword: 'uuid';
89
+ };
90
+ email: {
91
+ keyword: 'email';
92
+ };
93
+ firstName: {
94
+ keyword: 'firstName';
95
+ };
96
+ lastName: {
97
+ keyword: 'lastName';
98
+ };
99
+ phone: {
100
+ keyword: 'phone';
101
+ };
102
+ password: {
103
+ keyword: 'password';
104
+ };
105
+ date: {
106
+ keyword: 'date';
107
+ args: {
108
+ type?: 'date' | 'string';
109
+ };
110
+ };
111
+ time: {
112
+ keyword: 'time';
113
+ args: {
114
+ type?: 'date' | 'string';
115
+ };
116
+ };
117
+ datetime: {
118
+ keyword: 'datetime';
119
+ args: {
120
+ offset?: boolean;
121
+ local?: boolean;
122
+ };
123
+ };
124
+ tuple: {
125
+ keyword: 'tuple';
126
+ args: {
127
+ items: Schema[];
128
+ min?: number;
129
+ max?: number;
130
+ rest?: Schema;
131
+ };
132
+ };
133
+ array: {
134
+ keyword: 'array';
135
+ args: {
136
+ items: Schema[];
137
+ min?: number;
138
+ max?: number;
139
+ unique?: boolean;
140
+ };
141
+ };
142
+ enum: {
143
+ keyword: 'enum';
144
+ args: {
145
+ name: string;
146
+ typeName: string;
147
+ asConst: boolean;
148
+ items: Array<{
149
+ name: string | number;
150
+ format: 'string' | 'number' | 'boolean';
151
+ value?: string | number | boolean;
152
+ }>;
153
+ };
154
+ };
155
+ and: {
156
+ keyword: 'and';
157
+ args: Schema[];
158
+ };
159
+ const: {
160
+ keyword: 'const';
161
+ args: {
162
+ name: string | number;
163
+ format: 'string' | 'number' | 'boolean';
164
+ value?: string | number | boolean;
165
+ };
166
+ };
167
+ union: {
168
+ keyword: 'union';
169
+ args: Schema[];
170
+ };
171
+ ref: {
172
+ keyword: 'ref';
173
+ args: {
174
+ name: string;
175
+ $ref: string;
176
+ /**
177
+ * Full qualified path.
178
+ */
179
+ path: KubbFile.Path;
180
+ /**
181
+ * When true `File.Import` is used.
182
+ * When false a reference is used inside the current file.
183
+ */
184
+ isImportable: boolean;
185
+ };
186
+ };
187
+ matches: {
188
+ keyword: 'matches';
189
+ args?: string;
190
+ };
191
+ boolean: {
192
+ keyword: 'boolean';
193
+ };
194
+ default: {
195
+ keyword: 'default';
196
+ args: string | number | boolean;
197
+ };
198
+ string: {
199
+ keyword: 'string';
200
+ };
201
+ integer: {
202
+ keyword: 'integer';
203
+ };
204
+ number: {
205
+ keyword: 'number';
206
+ };
207
+ max: {
208
+ keyword: 'max';
209
+ args: number;
210
+ };
211
+ min: {
212
+ keyword: 'min';
213
+ args: number;
214
+ };
215
+ exclusiveMaximum: {
216
+ keyword: 'exclusiveMaximum';
217
+ args: number;
218
+ };
219
+ exclusiveMinimum: {
220
+ keyword: 'exclusiveMinimum';
221
+ args: number;
222
+ };
223
+ describe: {
224
+ keyword: 'describe';
225
+ args: string;
226
+ };
227
+ example: {
228
+ keyword: 'example';
229
+ args: string;
230
+ };
231
+ deprecated: {
232
+ keyword: 'deprecated';
233
+ };
234
+ optional: {
235
+ keyword: 'optional';
236
+ };
237
+ undefined: {
238
+ keyword: 'undefined';
239
+ };
240
+ nullish: {
241
+ keyword: 'nullish';
242
+ };
243
+ nullable: {
244
+ keyword: 'nullable';
245
+ };
246
+ null: {
247
+ keyword: 'null';
248
+ };
249
+ any: {
250
+ keyword: 'any';
251
+ };
252
+ unknown: {
253
+ keyword: 'unknown';
254
+ };
255
+ void: {
256
+ keyword: 'void';
257
+ };
258
+ blob: {
259
+ keyword: 'blob';
260
+ };
261
+ schema: {
262
+ keyword: 'schema';
263
+ args: {
264
+ type: 'string' | 'number' | 'integer' | 'boolean' | 'array' | 'object';
265
+ format?: string;
266
+ };
267
+ };
268
+ name: {
269
+ keyword: 'name';
270
+ args: string;
271
+ };
272
+ catchall: {
273
+ keyword: 'catchall';
274
+ };
275
+ interface: {
276
+ keyword: 'interface';
277
+ };
278
+ };
279
+ declare const schemaKeywords: {
280
+ any: "any";
281
+ unknown: "unknown";
282
+ number: "number";
283
+ integer: "integer";
284
+ string: "string";
285
+ boolean: "boolean";
286
+ undefined: "undefined";
287
+ nullable: "nullable";
288
+ null: "null";
289
+ nullish: "nullish";
290
+ array: "array";
291
+ tuple: "tuple";
292
+ enum: "enum";
293
+ union: "union";
294
+ datetime: "datetime";
295
+ date: "date";
296
+ email: "email";
297
+ uuid: "uuid";
298
+ url: "url";
299
+ void: "void";
300
+ default: "default";
301
+ const: "const";
302
+ and: "and";
303
+ describe: "describe";
304
+ min: "min";
305
+ max: "max";
306
+ exclusiveMinimum: "exclusiveMinimum";
307
+ exclusiveMaximum: "exclusiveMaximum";
308
+ optional: "optional";
309
+ readOnly: "readOnly";
310
+ writeOnly: "writeOnly";
311
+ object: "object";
312
+ ref: "ref";
313
+ matches: "matches";
314
+ firstName: "firstName";
315
+ lastName: "lastName";
316
+ password: "password";
317
+ phone: "phone";
318
+ blob: "blob";
319
+ deprecated: "deprecated";
320
+ example: "example";
321
+ schema: "schema";
322
+ catchall: "catchall";
323
+ time: "time";
324
+ name: "name";
325
+ interface: "interface";
326
+ };
327
+ type SchemaKeyword = keyof SchemaKeywordMapper;
328
+ type SchemaMapper<T = string | null | undefined> = { [K in keyof SchemaKeywordMapper]: (() => T | undefined) | undefined };
329
+ type SchemaKeywordBase<T> = {
330
+ keyword: SchemaKeyword;
331
+ args: T;
332
+ };
333
+ type Schema = {
334
+ keyword: string;
335
+ } | SchemaKeywordMapper[keyof SchemaKeywordMapper];
336
+ type SchemaTree = {
337
+ schema: SchemaObject$1;
338
+ parent: Schema | undefined;
339
+ current: Schema;
340
+ siblings: Schema[];
341
+ /**
342
+ * this is equal to the key of a property(object)
343
+ */
344
+ name?: string;
345
+ };
346
+ declare function isKeyword<T extends Schema, K extends keyof SchemaKeywordMapper>(meta: T, keyword: K): meta is Extract<T, SchemaKeywordMapper[K]>;
347
+ //#endregion
348
+ export { contentType as _, SchemaMapper as a, schemaKeywords as c, HttpMethod as d, OasTypes as f, SchemaObject$1 as g, Operation$1 as h, SchemaKeywordMapper as i, isOptional as l, OpenAPIV3_1 as m, SchemaKeyword as n, SchemaTree as o, OpenAPIV3 as p, SchemaKeywordBase as r, isKeyword as s, Schema as t, Oas as u };
349
+ //# sourceMappingURL=SchemaMapper-CmwW1HVs.d.ts.map