@kubb/plugin-oas 3.0.0-alpha.16 → 3.0.0-alpha.18
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/README.md +0 -4
- package/dist/{chunk-D2N6LDLT.js → chunk-4CQVMYRG.js} +7 -16
- package/dist/chunk-4CQVMYRG.js.map +1 -0
- package/dist/{chunk-2QECZEUD.js → chunk-DFQJ57GH.js} +4 -35
- package/dist/chunk-DFQJ57GH.js.map +1 -0
- package/dist/chunk-GF26SDHQ.js +28 -0
- package/dist/chunk-GF26SDHQ.js.map +1 -0
- package/dist/{chunk-PUFCST25.cjs → chunk-HP5WAFBU.cjs} +2 -38
- package/dist/chunk-HP5WAFBU.cjs.map +1 -0
- package/dist/{chunk-7Q5B67MW.cjs → chunk-OO5R4UIK.cjs} +6 -408
- package/dist/chunk-OO5R4UIK.cjs.map +1 -0
- package/dist/chunk-PADR76WZ.cjs +4 -0
- package/dist/chunk-PADR76WZ.cjs.map +1 -0
- package/dist/chunk-R47XMJ32.js +3 -0
- package/dist/chunk-R47XMJ32.js.map +1 -0
- package/dist/{chunk-LCPCIS3S.cjs → chunk-RQG4KIFG.cjs} +7 -16
- package/dist/chunk-RQG4KIFG.cjs.map +1 -0
- package/dist/chunk-THGCWF2O.js +30 -0
- package/dist/chunk-THGCWF2O.js.map +1 -0
- package/dist/chunk-UO57DZPV.cjs +36 -0
- package/dist/chunk-UO57DZPV.cjs.map +1 -0
- package/dist/{chunk-7XBQZ7AX.js → chunk-V4LP5BFJ.js} +6 -404
- package/dist/chunk-V4LP5BFJ.js.map +1 -0
- package/dist/chunk-ZWHQ54JM.cjs +32 -0
- package/dist/chunk-ZWHQ54JM.cjs.map +1 -0
- package/dist/components.cjs +5 -5
- package/dist/components.js +2 -2
- package/dist/generators.cjs +4 -4
- package/dist/generators.js +3 -3
- package/dist/hooks.cjs +9 -31
- package/dist/hooks.cjs.map +1 -1
- package/dist/hooks.js +3 -25
- package/dist/hooks.js.map +1 -1
- package/dist/index.cjs +402 -25
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +392 -5
- package/dist/index.js.map +1 -1
- package/dist/utils.cjs +8 -29
- package/dist/utils.cjs.map +1 -1
- package/dist/utils.d.cts +2 -10
- package/dist/utils.d.ts +2 -10
- package/dist/utils.js +3 -23
- package/dist/utils.js.map +1 -1
- package/package.json +8 -11
- package/src/SchemaGenerator.ts +1 -1
- package/src/hooks/useSchemaManager.ts +3 -2
- package/src/utils/index.ts +0 -1
- package/dist/chunk-2QECZEUD.js.map +0 -1
- package/dist/chunk-4OQEPWOG.js +0 -38
- package/dist/chunk-4OQEPWOG.js.map +0 -1
- package/dist/chunk-7Q5B67MW.cjs.map +0 -1
- package/dist/chunk-7XBQZ7AX.js.map +0 -1
- package/dist/chunk-CQDZGAA6.cjs +0 -3176
- package/dist/chunk-CQDZGAA6.cjs.map +0 -1
- package/dist/chunk-CYF724QJ.js +0 -3171
- package/dist/chunk-CYF724QJ.js.map +0 -1
- package/dist/chunk-D2N6LDLT.js.map +0 -1
- package/dist/chunk-LCPCIS3S.cjs.map +0 -1
- package/dist/chunk-PUFCST25.cjs.map +0 -1
- package/dist/chunk-TYQZ2BD7.cjs +0 -42
- package/dist/chunk-TYQZ2BD7.cjs.map +0 -1
- package/src/utils/refSorter.ts +0 -13
|
@@ -1,11 +1,8 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
var chunkLCPCIS3S_cjs = require('./chunk-LCPCIS3S.cjs');
|
|
5
|
-
var chunkTYQZ2BD7_cjs = require('./chunk-TYQZ2BD7.cjs');
|
|
3
|
+
var chunkHP5WAFBU_cjs = require('./chunk-HP5WAFBU.cjs');
|
|
6
4
|
var core = require('@kubb/core');
|
|
7
5
|
var transformers = require('@kubb/core/transformers');
|
|
8
|
-
var path = require('path');
|
|
9
6
|
var utils = require('@kubb/core/utils');
|
|
10
7
|
var oas = require('@kubb/oas');
|
|
11
8
|
var remeda = require('remeda');
|
|
@@ -13,294 +10,8 @@ var remeda = require('remeda');
|
|
|
13
10
|
function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
14
11
|
|
|
15
12
|
var transformers__default = /*#__PURE__*/_interopDefault(transformers);
|
|
16
|
-
var path__default = /*#__PURE__*/_interopDefault(path);
|
|
17
|
-
|
|
18
|
-
// src/index.ts
|
|
19
|
-
chunkTYQZ2BD7_cjs.init_cjs_shims();
|
|
20
|
-
|
|
21
|
-
// src/OperationGenerator.ts
|
|
22
|
-
chunkTYQZ2BD7_cjs.init_cjs_shims();
|
|
23
|
-
var OperationGenerator = class extends core.BaseGenerator {
|
|
24
|
-
#operationsByMethod = {};
|
|
25
|
-
get operationsByMethod() {
|
|
26
|
-
return this.#operationsByMethod;
|
|
27
|
-
}
|
|
28
|
-
set operationsByMethod(paths) {
|
|
29
|
-
this.#operationsByMethod = paths;
|
|
30
|
-
}
|
|
31
|
-
#getOptions(operation, method) {
|
|
32
|
-
const { override = [] } = this.context;
|
|
33
|
-
return override.find(({ pattern, type }) => {
|
|
34
|
-
if (type === "tag") {
|
|
35
|
-
return !!operation.getTags()[0]?.name.match(pattern);
|
|
36
|
-
}
|
|
37
|
-
if (type === "operationId") {
|
|
38
|
-
return !!operation.getOperationId().match(pattern);
|
|
39
|
-
}
|
|
40
|
-
if (type === "path") {
|
|
41
|
-
return !!operation.path.match(pattern);
|
|
42
|
-
}
|
|
43
|
-
if (type === "method") {
|
|
44
|
-
return !!method.match(pattern);
|
|
45
|
-
}
|
|
46
|
-
return false;
|
|
47
|
-
})?.options || {};
|
|
48
|
-
}
|
|
49
|
-
/**
|
|
50
|
-
*
|
|
51
|
-
* @deprecated
|
|
52
|
-
*/
|
|
53
|
-
#isExcluded(operation, method) {
|
|
54
|
-
const { exclude = [] } = this.context;
|
|
55
|
-
let matched = false;
|
|
56
|
-
exclude.forEach(({ pattern, type }) => {
|
|
57
|
-
if (type === "tag" && !matched) {
|
|
58
|
-
matched = !!operation.getTags()[0]?.name.match(pattern);
|
|
59
|
-
}
|
|
60
|
-
if (type === "operationId" && !matched) {
|
|
61
|
-
matched = !!operation.getOperationId().match(pattern);
|
|
62
|
-
}
|
|
63
|
-
if (type === "path" && !matched) {
|
|
64
|
-
matched = !!operation.path.match(pattern);
|
|
65
|
-
}
|
|
66
|
-
if (type === "method" && !matched) {
|
|
67
|
-
matched = !!method.match(pattern);
|
|
68
|
-
}
|
|
69
|
-
});
|
|
70
|
-
return matched;
|
|
71
|
-
}
|
|
72
|
-
/**
|
|
73
|
-
*
|
|
74
|
-
* @deprecated
|
|
75
|
-
*/
|
|
76
|
-
#isIncluded(operation, method) {
|
|
77
|
-
const { include = [] } = this.context;
|
|
78
|
-
let matched = false;
|
|
79
|
-
include.forEach(({ pattern, type }) => {
|
|
80
|
-
if (type === "tag" && !matched) {
|
|
81
|
-
matched = !!operation.getTags()[0]?.name.match(pattern);
|
|
82
|
-
}
|
|
83
|
-
if (type === "operationId" && !matched) {
|
|
84
|
-
matched = !!operation.getOperationId().match(pattern);
|
|
85
|
-
}
|
|
86
|
-
if (type === "path" && !matched) {
|
|
87
|
-
matched = !!operation.path.match(pattern);
|
|
88
|
-
}
|
|
89
|
-
if (type === "method" && !matched) {
|
|
90
|
-
matched = !!method.match(pattern);
|
|
91
|
-
}
|
|
92
|
-
});
|
|
93
|
-
return matched;
|
|
94
|
-
}
|
|
95
|
-
getSchemas(operation, {
|
|
96
|
-
resolveName = (name) => name
|
|
97
|
-
} = {}) {
|
|
98
|
-
const pathParamsSchema = this.context.oas.getParametersSchema(operation, "path");
|
|
99
|
-
const queryParamsSchema = this.context.oas.getParametersSchema(operation, "query");
|
|
100
|
-
const headerParamsSchema = this.context.oas.getParametersSchema(operation, "header");
|
|
101
|
-
const requestSchema = this.context.oas.getRequestSchema(operation);
|
|
102
|
-
const responseStatusCode = operation.schema.responses && Object.keys(operation.schema.responses).find((key) => key.startsWith("2")) || 200;
|
|
103
|
-
const responseSchema = this.context.oas.getResponseSchema(operation, responseStatusCode);
|
|
104
|
-
const statusCodes = operation.getResponseStatusCodes().map((statusCode) => {
|
|
105
|
-
let name = statusCode;
|
|
106
|
-
if (name === "default") {
|
|
107
|
-
name = "error";
|
|
108
|
-
}
|
|
109
|
-
const schema = this.context.oas.getResponseSchema(operation, statusCode);
|
|
110
|
-
return {
|
|
111
|
-
name: resolveName(transformers__default.default.pascalCase(`${operation.getOperationId()} ${name}`)),
|
|
112
|
-
description: operation.getResponseByStatusCode(statusCode)?.description,
|
|
113
|
-
schema,
|
|
114
|
-
operation,
|
|
115
|
-
operationName: transformers__default.default.pascalCase(`${operation.getOperationId()}`),
|
|
116
|
-
statusCode: name === "error" ? void 0 : Number(statusCode),
|
|
117
|
-
keys: schema?.properties ? Object.keys(schema.properties) : void 0
|
|
118
|
-
};
|
|
119
|
-
});
|
|
120
|
-
return {
|
|
121
|
-
pathParams: pathParamsSchema ? {
|
|
122
|
-
name: resolveName(transformers__default.default.pascalCase(`${operation.getOperationId()} PathParams`)),
|
|
123
|
-
operation,
|
|
124
|
-
operationName: transformers__default.default.pascalCase(`${operation.getOperationId()}`),
|
|
125
|
-
schema: pathParamsSchema,
|
|
126
|
-
keys: pathParamsSchema.properties ? Object.keys(pathParamsSchema.properties) : void 0
|
|
127
|
-
} : void 0,
|
|
128
|
-
queryParams: queryParamsSchema ? {
|
|
129
|
-
name: resolveName(transformers__default.default.pascalCase(`${operation.getOperationId()} QueryParams`)),
|
|
130
|
-
operation,
|
|
131
|
-
operationName: transformers__default.default.pascalCase(`${operation.getOperationId()}`),
|
|
132
|
-
schema: queryParamsSchema,
|
|
133
|
-
keys: queryParamsSchema.properties ? Object.keys(queryParamsSchema.properties) : []
|
|
134
|
-
} : void 0,
|
|
135
|
-
headerParams: headerParamsSchema ? {
|
|
136
|
-
name: resolveName(transformers__default.default.pascalCase(`${operation.getOperationId()} HeaderParams`)),
|
|
137
|
-
operation,
|
|
138
|
-
operationName: transformers__default.default.pascalCase(`${operation.getOperationId()}`),
|
|
139
|
-
schema: headerParamsSchema,
|
|
140
|
-
keys: headerParamsSchema.properties ? Object.keys(headerParamsSchema.properties) : void 0
|
|
141
|
-
} : void 0,
|
|
142
|
-
request: requestSchema ? {
|
|
143
|
-
name: resolveName(transformers__default.default.pascalCase(`${operation.getOperationId()} ${operation.method === "get" ? "queryRequest" : "mutationRequest"}`)),
|
|
144
|
-
description: operation.schema.requestBody?.description,
|
|
145
|
-
operation,
|
|
146
|
-
operationName: transformers__default.default.pascalCase(`${operation.getOperationId()}`),
|
|
147
|
-
schema: requestSchema,
|
|
148
|
-
keys: requestSchema.properties ? Object.keys(requestSchema.properties) : void 0,
|
|
149
|
-
keysToOmit: requestSchema.properties ? Object.keys(requestSchema.properties).filter((key) => {
|
|
150
|
-
const item = requestSchema.properties?.[key];
|
|
151
|
-
return item?.readOnly;
|
|
152
|
-
}) : void 0
|
|
153
|
-
} : void 0,
|
|
154
|
-
response: {
|
|
155
|
-
name: resolveName(transformers__default.default.pascalCase(`${operation.getOperationId()} ${operation.method === "get" ? "queryResponse" : "mutationResponse"}`)),
|
|
156
|
-
description: operation.getResponseAsJSONSchema(responseStatusCode)?.at(0)?.description,
|
|
157
|
-
operation,
|
|
158
|
-
operationName: transformers__default.default.pascalCase(`${operation.getOperationId()}`),
|
|
159
|
-
schema: responseSchema,
|
|
160
|
-
statusCode: Number(responseStatusCode),
|
|
161
|
-
keys: responseSchema?.properties ? Object.keys(responseSchema.properties) : void 0,
|
|
162
|
-
keysToOmit: responseSchema?.properties ? Object.keys(responseSchema.properties).filter((key) => {
|
|
163
|
-
const item = responseSchema.properties?.[key];
|
|
164
|
-
return item?.writeOnly;
|
|
165
|
-
}) : void 0
|
|
166
|
-
},
|
|
167
|
-
errors: statusCodes.filter((item) => item.statusCode?.toString().startsWith("4") || item.statusCode?.toString().startsWith("5")),
|
|
168
|
-
statusCodes
|
|
169
|
-
};
|
|
170
|
-
}
|
|
171
|
-
#methods = ["get", "post", "patch", "put", "delete"];
|
|
172
|
-
async build(...generators) {
|
|
173
|
-
const { oas } = this.context;
|
|
174
|
-
const paths = oas.getPaths();
|
|
175
|
-
this.operationsByMethod = Object.entries(paths).reduce((acc, [path2, method]) => {
|
|
176
|
-
const methods = Object.keys(method);
|
|
177
|
-
methods.forEach((method2) => {
|
|
178
|
-
const operation = oas.operation(path2, method2);
|
|
179
|
-
if (operation && [this.#methods].some((methods2) => method2 === operation.method)) {
|
|
180
|
-
const isExcluded = this.#isExcluded(operation, method2);
|
|
181
|
-
const isIncluded = this.context.include ? this.#isIncluded(operation, method2) : true;
|
|
182
|
-
if (isIncluded && !isExcluded) {
|
|
183
|
-
if (!acc[path2]) {
|
|
184
|
-
acc[path2] = {};
|
|
185
|
-
}
|
|
186
|
-
acc[path2] = {
|
|
187
|
-
...acc[path2],
|
|
188
|
-
[method2]: {
|
|
189
|
-
operation,
|
|
190
|
-
schemas: this.getSchemas(operation)
|
|
191
|
-
}
|
|
192
|
-
};
|
|
193
|
-
}
|
|
194
|
-
}
|
|
195
|
-
});
|
|
196
|
-
return acc;
|
|
197
|
-
}, {});
|
|
198
|
-
const promises = Object.keys(this.operationsByMethod).reduce((acc, path2) => {
|
|
199
|
-
const methods = this.operationsByMethod[path2] ? Object.keys(this.operationsByMethod[path2]) : [];
|
|
200
|
-
methods.forEach((method) => {
|
|
201
|
-
const { operation } = this.operationsByMethod[path2]?.[method];
|
|
202
|
-
const options = this.#getOptions(operation, method);
|
|
203
|
-
const methodToCall = this[method];
|
|
204
|
-
if (typeof methodToCall === "function") {
|
|
205
|
-
const promiseMethod = methodToCall?.call(this, operation, {
|
|
206
|
-
...this.options,
|
|
207
|
-
...options
|
|
208
|
-
});
|
|
209
|
-
if (promiseMethod) {
|
|
210
|
-
acc.push(promiseMethod);
|
|
211
|
-
}
|
|
212
|
-
}
|
|
213
|
-
const promiseOperation = this.operation.call(this, operation, {
|
|
214
|
-
...this.options,
|
|
215
|
-
...options
|
|
216
|
-
});
|
|
217
|
-
if (promiseOperation) {
|
|
218
|
-
acc.push(promiseOperation);
|
|
219
|
-
}
|
|
220
|
-
generators?.forEach((generator) => {
|
|
221
|
-
const promise = generator.operation?.({
|
|
222
|
-
instance: this,
|
|
223
|
-
operation,
|
|
224
|
-
options: {
|
|
225
|
-
...this.options,
|
|
226
|
-
...options
|
|
227
|
-
}
|
|
228
|
-
});
|
|
229
|
-
if (promise) {
|
|
230
|
-
acc.push(promise);
|
|
231
|
-
}
|
|
232
|
-
});
|
|
233
|
-
});
|
|
234
|
-
return acc;
|
|
235
|
-
}, []);
|
|
236
|
-
const operations = Object.values(this.operationsByMethod).map((item) => Object.values(item).map((item2) => item2.operation));
|
|
237
|
-
promises.push(this.all(operations.flat().filter(Boolean), this.operationsByMethod));
|
|
238
|
-
generators?.forEach((generator) => {
|
|
239
|
-
const promise = generator.operations?.({
|
|
240
|
-
instance: this,
|
|
241
|
-
operations: operations.flat().filter(Boolean),
|
|
242
|
-
operationsByMethod: this.operationsByMethod,
|
|
243
|
-
options: this.options
|
|
244
|
-
});
|
|
245
|
-
if (promise) {
|
|
246
|
-
promises.push(promise);
|
|
247
|
-
}
|
|
248
|
-
});
|
|
249
|
-
const files = await Promise.all(promises);
|
|
250
|
-
return files.flat().filter(Boolean);
|
|
251
|
-
}
|
|
252
|
-
/**
|
|
253
|
-
* Operation
|
|
254
|
-
*/
|
|
255
|
-
async operation(operation, options) {
|
|
256
|
-
return [];
|
|
257
|
-
}
|
|
258
|
-
/**
|
|
259
|
-
* GET
|
|
260
|
-
*/
|
|
261
|
-
async get(operation, options) {
|
|
262
|
-
return [];
|
|
263
|
-
}
|
|
264
|
-
/**
|
|
265
|
-
* POST
|
|
266
|
-
*/
|
|
267
|
-
async post(operation, options) {
|
|
268
|
-
return [];
|
|
269
|
-
}
|
|
270
|
-
/**
|
|
271
|
-
* PATCH
|
|
272
|
-
*/
|
|
273
|
-
async patch(operation, options) {
|
|
274
|
-
return [];
|
|
275
|
-
}
|
|
276
|
-
/**
|
|
277
|
-
* PUT
|
|
278
|
-
*/
|
|
279
|
-
async put(operation, options) {
|
|
280
|
-
return [];
|
|
281
|
-
}
|
|
282
|
-
/**
|
|
283
|
-
* DELETE
|
|
284
|
-
*/
|
|
285
|
-
async delete(operation, options) {
|
|
286
|
-
return [];
|
|
287
|
-
}
|
|
288
|
-
/**
|
|
289
|
-
* Combination of GET, POST, PATCH, PUT, DELETE
|
|
290
|
-
*/
|
|
291
|
-
async all(operations, paths) {
|
|
292
|
-
return [];
|
|
293
|
-
}
|
|
294
|
-
};
|
|
295
|
-
|
|
296
|
-
// src/plugin.ts
|
|
297
|
-
chunkTYQZ2BD7_cjs.init_cjs_shims();
|
|
298
|
-
|
|
299
|
-
// src/SchemaGenerator.ts
|
|
300
|
-
chunkTYQZ2BD7_cjs.init_cjs_shims();
|
|
301
13
|
|
|
302
14
|
// src/SchemaMapper.ts
|
|
303
|
-
chunkTYQZ2BD7_cjs.init_cjs_shims();
|
|
304
15
|
var schemaKeywords = {
|
|
305
16
|
any: "any",
|
|
306
17
|
strict: "strict",
|
|
@@ -350,8 +61,6 @@ var schemaKeywords = {
|
|
|
350
61
|
function isKeyword(meta, keyword) {
|
|
351
62
|
return meta.keyword === keyword;
|
|
352
63
|
}
|
|
353
|
-
|
|
354
|
-
// src/SchemaGenerator.ts
|
|
355
64
|
var SchemaGenerator = class _SchemaGenerator extends core.BaseGenerator {
|
|
356
65
|
// Collect the types of all referenced schemas, so we can export them later
|
|
357
66
|
refs = {};
|
|
@@ -585,7 +294,7 @@ var SchemaGenerator = class _SchemaGenerator extends core.BaseGenerator {
|
|
|
585
294
|
];
|
|
586
295
|
}
|
|
587
296
|
#getParsedSchemaObject(schema) {
|
|
588
|
-
const parsedSchema =
|
|
297
|
+
const parsedSchema = chunkHP5WAFBU_cjs.getSchemaFactory(this.context.oas)(schema);
|
|
589
298
|
return parsedSchema;
|
|
590
299
|
}
|
|
591
300
|
/**
|
|
@@ -939,7 +648,7 @@ var SchemaGenerator = class _SchemaGenerator extends core.BaseGenerator {
|
|
|
939
648
|
...baseItems
|
|
940
649
|
].filter(Boolean);
|
|
941
650
|
}
|
|
942
|
-
if (!["boolean", "object", "number", "string", "integer"].includes(schema.type)) {
|
|
651
|
+
if (!["boolean", "object", "number", "string", "integer", "null"].includes(schema.type)) {
|
|
943
652
|
this.context.pluginManager.logger.emit("warning", `Schema type '${schema.type}' is not valid for schema ${parentName}.${name}`);
|
|
944
653
|
}
|
|
945
654
|
return [{ keyword: schema.type }, ...baseItems];
|
|
@@ -948,7 +657,7 @@ var SchemaGenerator = class _SchemaGenerator extends core.BaseGenerator {
|
|
|
948
657
|
}
|
|
949
658
|
async build(...generators) {
|
|
950
659
|
const { oas, contentType, include } = this.context;
|
|
951
|
-
const schemas =
|
|
660
|
+
const schemas = chunkHP5WAFBU_cjs.getSchemas({ oas, contentType, includes: include });
|
|
952
661
|
const promises = Object.entries(schemas).reduce((acc, [name, value]) => {
|
|
953
662
|
if (!value) {
|
|
954
663
|
return acc;
|
|
@@ -992,119 +701,8 @@ var SchemaGenerator = class _SchemaGenerator extends core.BaseGenerator {
|
|
|
992
701
|
}
|
|
993
702
|
};
|
|
994
703
|
|
|
995
|
-
// src/plugin.ts
|
|
996
|
-
var pluginOasName = "plugin-oas";
|
|
997
|
-
var pluginOas = core.createPlugin((options) => {
|
|
998
|
-
const {
|
|
999
|
-
output = {
|
|
1000
|
-
path: "schemas",
|
|
1001
|
-
export: false,
|
|
1002
|
-
exportType: "barrelNamed"
|
|
1003
|
-
},
|
|
1004
|
-
experimentalFilter: filter,
|
|
1005
|
-
experimentalSort: sort,
|
|
1006
|
-
validate = true,
|
|
1007
|
-
generators = [chunkLCPCIS3S_cjs.jsonGenerator],
|
|
1008
|
-
serverIndex = 0,
|
|
1009
|
-
contentType,
|
|
1010
|
-
oasClass
|
|
1011
|
-
} = options;
|
|
1012
|
-
const getOas = async ({ config, logger, formatOptions }) => {
|
|
1013
|
-
try {
|
|
1014
|
-
const oas = await chunkPUFCST25_cjs.parseFromConfig(config, formatOptions, oasClass);
|
|
1015
|
-
if (validate) {
|
|
1016
|
-
await oas.valdiate();
|
|
1017
|
-
}
|
|
1018
|
-
return oas;
|
|
1019
|
-
} catch (e) {
|
|
1020
|
-
const error = e;
|
|
1021
|
-
logger.emit("warning", error?.message);
|
|
1022
|
-
return chunkPUFCST25_cjs.parseFromConfig(config, {}, oasClass);
|
|
1023
|
-
}
|
|
1024
|
-
};
|
|
1025
|
-
return {
|
|
1026
|
-
name: pluginOasName,
|
|
1027
|
-
output,
|
|
1028
|
-
options,
|
|
1029
|
-
context() {
|
|
1030
|
-
const { config, logger } = this;
|
|
1031
|
-
return {
|
|
1032
|
-
getOas(formatOptions) {
|
|
1033
|
-
return getOas({ config, logger, formatOptions });
|
|
1034
|
-
},
|
|
1035
|
-
async getSchemas({ includes } = {}) {
|
|
1036
|
-
const oas = await this.getOas();
|
|
1037
|
-
return chunkPUFCST25_cjs.getSchemas({ oas, contentType, includes });
|
|
1038
|
-
},
|
|
1039
|
-
async getBaseURL() {
|
|
1040
|
-
const oasInstance = await this.getOas();
|
|
1041
|
-
return oasInstance.api.servers?.at(serverIndex)?.url;
|
|
1042
|
-
},
|
|
1043
|
-
contentType
|
|
1044
|
-
};
|
|
1045
|
-
},
|
|
1046
|
-
resolvePath(baseName, pathMode, options2) {
|
|
1047
|
-
const root = path__default.default.resolve(this.config.root, this.config.output.path);
|
|
1048
|
-
const mode = pathMode ?? core.FileManager.getMode(path__default.default.resolve(root, output.path));
|
|
1049
|
-
if (mode === "single") {
|
|
1050
|
-
return path__default.default.resolve(root, output.path);
|
|
1051
|
-
}
|
|
1052
|
-
return path__default.default.resolve(root, output.path, baseName);
|
|
1053
|
-
},
|
|
1054
|
-
async buildStart() {
|
|
1055
|
-
if (!output) {
|
|
1056
|
-
return;
|
|
1057
|
-
}
|
|
1058
|
-
const oas = await getOas({
|
|
1059
|
-
config: this.config,
|
|
1060
|
-
logger: this.logger,
|
|
1061
|
-
formatOptions: {
|
|
1062
|
-
filterSet: filter,
|
|
1063
|
-
sortSet: sort
|
|
1064
|
-
}
|
|
1065
|
-
});
|
|
1066
|
-
await oas.dereference();
|
|
1067
|
-
const schemaGenerator = new SchemaGenerator(
|
|
1068
|
-
{
|
|
1069
|
-
unknownType: "unknown",
|
|
1070
|
-
dateType: "date",
|
|
1071
|
-
transformers: {},
|
|
1072
|
-
...this.plugin.options
|
|
1073
|
-
},
|
|
1074
|
-
{
|
|
1075
|
-
oas,
|
|
1076
|
-
pluginManager: this.pluginManager,
|
|
1077
|
-
plugin: this.plugin,
|
|
1078
|
-
contentType,
|
|
1079
|
-
include: void 0,
|
|
1080
|
-
override: void 0,
|
|
1081
|
-
mode: "split",
|
|
1082
|
-
output: output.path
|
|
1083
|
-
}
|
|
1084
|
-
);
|
|
1085
|
-
const schemaFiles = await schemaGenerator.build(...generators);
|
|
1086
|
-
await this.addFile(...schemaFiles);
|
|
1087
|
-
const operationGenerator = new OperationGenerator(this.plugin.options, {
|
|
1088
|
-
oas,
|
|
1089
|
-
pluginManager: this.pluginManager,
|
|
1090
|
-
plugin: this.plugin,
|
|
1091
|
-
contentType,
|
|
1092
|
-
exclude: void 0,
|
|
1093
|
-
include: void 0,
|
|
1094
|
-
override: void 0,
|
|
1095
|
-
mode: "split"
|
|
1096
|
-
});
|
|
1097
|
-
const operationFiles = await operationGenerator.build(...generators);
|
|
1098
|
-
await this.addFile(...operationFiles);
|
|
1099
|
-
}
|
|
1100
|
-
};
|
|
1101
|
-
});
|
|
1102
|
-
|
|
1103
|
-
exports.OperationGenerator = OperationGenerator;
|
|
1104
704
|
exports.SchemaGenerator = SchemaGenerator;
|
|
1105
705
|
exports.isKeyword = isKeyword;
|
|
1106
|
-
exports.pluginOas = pluginOas;
|
|
1107
|
-
exports.pluginOasName = pluginOasName;
|
|
1108
706
|
exports.schemaKeywords = schemaKeywords;
|
|
1109
|
-
//# sourceMappingURL=chunk-
|
|
1110
|
-
//# sourceMappingURL=chunk-
|
|
707
|
+
//# sourceMappingURL=chunk-OO5R4UIK.cjs.map
|
|
708
|
+
//# sourceMappingURL=chunk-OO5R4UIK.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/SchemaMapper.ts","../src/SchemaGenerator.ts"],"names":["BaseGenerator","uniqueWith","isDeepEqual","getUniqueName","getSchemaFactory","transformers","_schema","nullable","isReference","pascalCase","name","isNumber","min","max","getSchemas"],"mappings":";;;;;;;;;;;;;;AA+EO,IAAM,cAAiB,GAAA;AAAA,EAC5B,GAAK,EAAA,KAAA;AAAA,EACL,MAAQ,EAAA,QAAA;AAAA,EACR,OAAS,EAAA,SAAA;AAAA,EACT,MAAQ,EAAA,QAAA;AAAA,EACR,OAAS,EAAA,SAAA;AAAA,EACT,MAAQ,EAAA,QAAA;AAAA,EACR,OAAS,EAAA,SAAA;AAAA,EACT,SAAW,EAAA,WAAA;AAAA,EACX,QAAU,EAAA,UAAA;AAAA,EACV,IAAM,EAAA,MAAA;AAAA,EACN,OAAS,EAAA,SAAA;AAAA,EACT,KAAO,EAAA,OAAA;AAAA,EACP,KAAO,EAAA,OAAA;AAAA,EACP,IAAM,EAAA,MAAA;AAAA,EACN,KAAO,EAAA,OAAA;AAAA,EACP,QAAU,EAAA,UAAA;AAAA,EACV,IAAM,EAAA,MAAA;AAAA,EACN,KAAO,EAAA,OAAA;AAAA,EACP,IAAM,EAAA,MAAA;AAAA,EACN,GAAK,EAAA,KAAA;AAAA;AAAA,EAEL,OAAS,EAAA,SAAA;AAAA,EACT,KAAO,EAAA,OAAA;AAAA,EACP,GAAK,EAAA,KAAA;AAAA,EACL,QAAU,EAAA,UAAA;AAAA,EACV,GAAK,EAAA,KAAA;AAAA,EACL,GAAK,EAAA,KAAA;AAAA,EACL,QAAU,EAAA,UAAA;AAAA,EACV,QAAU,EAAA,UAAA;AAAA;AAAA,EAGV,MAAQ,EAAA,QAAA;AAAA,EACR,GAAK,EAAA,KAAA;AAAA,EACL,OAAS,EAAA,SAAA;AA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,IAAK,CAAA,OAAA;AAAA,YACR,GAAG,OAAA;AAAA,WACL;AAAA,SACM,CAAA,CAAA;AAER,QAAA,IAAI,OAAS,EAAA;AACX,UAAA,GAAA,CAAI,KAAK,OAAO,CAAA,CAAA;AAAA,SAClB;AAAA,OACD,CAAA,CAAA;AAED,MAAO,OAAA,GAAA,CAAA;AAAA,KACT,EAAG,EAAqC,CAAA,CAAA;AAExC,IAAA,MAAM,KAAQ,GAAA,MAAM,OAAQ,CAAA,GAAA,CAAI,QAAQ,CAAA,CAAA;AAGxC,IAAA,OAAO,KAAM,CAAA,IAAA,EAAO,CAAA,MAAA,CAAO,OAAO,CAAA,CAAA;AAAA,GACpC;AAAA;AAAA;AAAA;AAAA,EAKA,MAAM,MAAA,CAAO,IAAc,EAAA,MAAA,EAAsB,OAAkD,EAAA;AACjG,IAAA,OAAO,EAAC,CAAA;AAAA,GACV;AACF","file":"chunk-OO5R4UIK.cjs","sourcesContent":["import type * as KubbFile from '@kubb/fs/types'\n\nexport type SchemaKeywordMapper = {\n object: {\n keyword: 'object'\n args: {\n properties: { [x: string]: Schema[] }\n additionalProperties: Schema[]\n strict?: boolean\n }\n }\n strict: { keyword: 'strict' }\n url: { keyword: 'url' }\n readOnly: { keyword: 'readOnly' }\n uuid: { keyword: 'uuid' }\n email: { keyword: 'email' }\n firstName: { keyword: 'firstName' }\n lastName: { keyword: 'lastName' }\n phone: { keyword: 'phone' }\n password: { keyword: 'password' }\n date: { keyword: 'date'; args: { type?: 'date' | 'string' } }\n time: { keyword: 'time'; args: { type?: 'date' | 'string' } }\n datetime: { keyword: 'datetime'; args: { offset?: boolean; local?: boolean } }\n tuple: { keyword: 'tuple'; args: { items: Schema[]; min?: number; max?: number } }\n array: {\n keyword: 'array'\n args: { items: Schema[]; min?: number; max?: number }\n }\n enum: {\n keyword: 'enum'\n args: {\n name: string\n typeName: string\n asConst: boolean\n items: Array<{\n name: string | number\n format: 'string' | 'number'\n value?: string | number\n }>\n }\n }\n and: { keyword: 'and'; args: Schema[] }\n const: {\n keyword: 'const'\n args: {\n name: string | number\n format: 'string' | 'number'\n value?: string | number\n }\n }\n union: { keyword: 'union'; args: Schema[] }\n ref: {\n keyword: 'ref'\n args: { name: string; path: KubbFile.OptionalPath }\n }\n matches: { keyword: 'matches'; args?: string }\n boolean: { keyword: 'boolean' }\n default: { keyword: 'default'; args: string | number | boolean }\n string: { keyword: 'string' }\n integer: { keyword: 'integer' }\n number: { keyword: 'number' }\n max: { keyword: 'max'; args: number }\n min: { keyword: 'min'; args: number }\n describe: { keyword: 'describe'; args: string }\n example: { keyword: 'example'; args: string }\n deprecated: { keyword: 'deprecated' }\n optional: { keyword: 'optional' }\n undefined: { keyword: 'undefined' }\n nullish: { keyword: 'nullish' }\n nullable: { keyword: 'nullable' }\n null: { keyword: 'null' }\n any: { keyword: 'any' }\n unknown: { keyword: 'unknown' }\n blob: { keyword: 'blob' }\n schema: { keyword: 'schema'; args: { type: 'string' | 'number' | 'integer' | 'boolean' | 'array' | 'object'; format?: string } }\n name: { keyword: 'name'; args: string }\n catchall: { keyword: 'catchall' }\n}\n\nexport const schemaKeywords = {\n any: 'any',\n strict: 'strict',\n unknown: 'unknown',\n number: 'number',\n integer: 'integer',\n string: 'string',\n boolean: 'boolean',\n undefined: 'undefined',\n nullable: 'nullable',\n null: 'null',\n nullish: 'nullish',\n array: 'array',\n tuple: 'tuple',\n enum: 'enum',\n union: 'union',\n datetime: 'datetime',\n date: 'date',\n email: 'email',\n uuid: 'uuid',\n url: 'url',\n /* intersection */\n default: 'default',\n const: 'const',\n and: 'and',\n describe: 'describe',\n min: 'min',\n max: 'max',\n optional: 'optional',\n readOnly: 'readOnly',\n\n // custom ones\n object: 'object',\n ref: 'ref',\n matches: 'matches',\n firstName: 'firstName',\n lastName: 'lastName',\n password: 'password',\n phone: 'phone',\n blob: 'blob',\n deprecated: 'deprecated',\n example: 'example',\n schema: 'schema',\n catchall: 'catchall',\n time: 'time',\n name: 'name',\n} satisfies {\n [K in keyof SchemaKeywordMapper]: SchemaKeywordMapper[K]['keyword']\n}\n\nexport type SchemaKeyword = keyof SchemaKeywordMapper\n\nexport type SchemaMapper<T = string | null | undefined> = {\n [K in keyof SchemaKeywordMapper]: (() => T | undefined) | undefined\n}\n\nexport type SchemaKeywordBase<T> = {\n keyword: SchemaKeyword\n args: T\n}\n\nexport type Schema = { keyword: string } | SchemaKeywordMapper[keyof SchemaKeywordMapper]\n\nexport function isKeyword<T extends Schema, K extends keyof SchemaKeywordMapper>(meta: T, keyword: K): meta is Extract<T, SchemaKeywordMapper[K]> {\n return meta.keyword === keyword\n}\n","import { BaseGenerator, type FileMetaBase } from '@kubb/core'\nimport transformers, { pascalCase } from '@kubb/core/transformers'\nimport { getUniqueName } from '@kubb/core/utils'\n\nimport { isReference } from '@kubb/oas'\nimport { isDeepEqual, isNumber, uniqueWith } from 'remeda'\nimport { isKeyword, schemaKeywords } from './SchemaMapper.ts'\nimport { getSchemaFactory } from './utils/getSchemaFactory.ts'\nimport { getSchemas } from './utils/getSchemas.ts'\n\nimport type { Plugin, PluginFactoryOptions, PluginManager, ResolveNameParams } from '@kubb/core'\nimport type * as KubbFile from '@kubb/fs/types'\n\nimport type { Oas, OpenAPIV3, SchemaObject, contentType } from '@kubb/oas'\nimport type { Schema, SchemaKeywordMapper } from './SchemaMapper.ts'\nimport type { Generator } from './generator.tsx'\nimport type { OperationSchema, Override, Refs } from './types.ts'\n\nexport type GetSchemaGeneratorOptions<T extends SchemaGenerator<any, any, any>> = T extends SchemaGenerator<infer Options, any, any> ? Options : never\n\nexport type SchemaMethodResult<TFileMeta extends FileMetaBase> = Promise<KubbFile.File<TFileMeta> | Array<KubbFile.File<TFileMeta>> | null>\n\ntype Context<TOptions, TPluginOptions extends PluginFactoryOptions> = {\n oas: Oas\n pluginManager: PluginManager\n /**\n * Current plugin\n */\n plugin: Plugin<TPluginOptions>\n mode: KubbFile.Mode\n include?: Array<'schemas' | 'responses' | 'requestBodies'>\n override: Array<Override<TOptions>> | undefined\n contentType?: contentType\n output?: string\n}\n\nexport type SchemaGeneratorOptions = {\n dateType: false | 'string' | 'stringOffset' | 'stringLocal' | 'date'\n unknownType: 'any' | 'unknown'\n enumType?: 'enum' | 'asConst' | 'asPascalConst' | 'constEnum' | 'literal'\n enumSuffix?: string\n usedEnumNames?: Record<string, number>\n mapper?: Record<string, string>\n typed?: boolean\n transformers: {\n /**\n * Customize the names based on the type that is provided by the plugin.\n */\n name?: (name: ResolveNameParams['name'], type?: ResolveNameParams['type']) => string\n /**\n * Receive schema and name(propertName) and return FakerMeta array\n * TODO TODO add docs\n * @beta\n */\n schema?: (schemaProps: SchemaProps, defaultSchemas: Schema[]) => Schema[] | undefined\n }\n}\n\nexport type SchemaGeneratorBuildOptions = Omit<OperationSchema, 'name' | 'schema'>\n\ntype SchemaProps = {\n schema?: SchemaObject\n name?: string\n parentName?: string\n}\n\nexport class SchemaGenerator<\n TOptions extends SchemaGeneratorOptions = SchemaGeneratorOptions,\n TPluginOptions extends PluginFactoryOptions = PluginFactoryOptions,\n TFileMeta extends FileMetaBase = FileMetaBase,\n> extends BaseGenerator<TOptions, Context<TOptions, TPluginOptions>> {\n // Collect the types of all referenced schemas, so we can export them later\n refs: Refs = {}\n\n // Keep track of already used type aliases\n #usedAliasNames: Record<string, number> = {}\n\n /**\n * Creates a type node from a given schema.\n * Delegates to getBaseTypeFromSchema internally and\n * optionally adds a union with null.\n */\n parse(props: SchemaProps): Schema[] {\n const options = this.#getOptions(props)\n\n const defaultSchemas = this.#parseSchemaObject(props)\n const schemas = options.transformers?.schema?.(props, defaultSchemas) || defaultSchemas || []\n\n return uniqueWith(schemas, isDeepEqual)\n }\n\n deepSearch<T extends keyof SchemaKeywordMapper>(tree: Schema[] | undefined, keyword: T): SchemaKeywordMapper[T][] {\n return SchemaGenerator.deepSearch<T>(tree, keyword)\n }\n\n find<T extends keyof SchemaKeywordMapper>(tree: Schema[] | undefined, keyword: T): SchemaKeywordMapper[T] | undefined {\n return SchemaGenerator.find<T>(tree, keyword)\n }\n\n static deepSearch<T extends keyof SchemaKeywordMapper>(tree: Schema[] | undefined, keyword: T): SchemaKeywordMapper[T][] {\n const foundItems: SchemaKeywordMapper[T][] = []\n\n tree?.forEach((schema) => {\n if (schema.keyword === keyword) {\n foundItems.push(schema as SchemaKeywordMapper[T])\n }\n\n if (schema.keyword === schemaKeywords.object) {\n const subItem = schema as SchemaKeywordMapper['object']\n\n Object.values(subItem.args?.properties || {}).forEach((entrySchema) => {\n foundItems.push(...SchemaGenerator.deepSearch<T>(entrySchema, keyword))\n })\n\n Object.values(subItem.args?.additionalProperties || {}).forEach((entrySchema) => {\n foundItems.push(...SchemaGenerator.deepSearch<T>([entrySchema], keyword))\n })\n }\n\n if (schema.keyword === schemaKeywords.array) {\n const subItem = schema as SchemaKeywordMapper['array']\n\n subItem.args.items.forEach((entrySchema) => {\n foundItems.push(...SchemaGenerator.deepSearch<T>([entrySchema], keyword))\n })\n }\n\n if (schema.keyword === schemaKeywords.and) {\n const subItem = schema as SchemaKeywordMapper['and']\n\n subItem.args.forEach((entrySchema) => {\n foundItems.push(...SchemaGenerator.deepSearch<T>([entrySchema], keyword))\n })\n }\n\n if (schema.keyword === schemaKeywords.tuple) {\n const subItem = schema as SchemaKeywordMapper['tuple']\n\n subItem.args.items.forEach((entrySchema) => {\n foundItems.push(...SchemaGenerator.deepSearch<T>([entrySchema], keyword))\n })\n }\n\n if (schema.keyword === schemaKeywords.union) {\n const subItem = schema as SchemaKeywordMapper['union']\n\n subItem.args.forEach((entrySchema) => {\n foundItems.push(...SchemaGenerator.deepSearch<T>([entrySchema], keyword))\n })\n }\n })\n\n return foundItems\n }\n\n static findInObject<T extends keyof SchemaKeywordMapper>(tree: Schema[] | undefined, keyword: T): SchemaKeywordMapper[T] | undefined {\n let foundItem: SchemaKeywordMapper[T] | undefined = undefined\n\n tree?.forEach((schema) => {\n if (!foundItem && schema.keyword === keyword) {\n foundItem = schema as SchemaKeywordMapper[T]\n }\n\n if (schema.keyword === schemaKeywords.object) {\n const subItem = schema as SchemaKeywordMapper['object']\n\n Object.values(subItem.args?.properties || {}).forEach((entrySchema) => {\n if (!foundItem) {\n foundItem = SchemaGenerator.find<T>(entrySchema, keyword)\n }\n })\n\n Object.values(subItem.args?.additionalProperties || {}).forEach((entrySchema) => {\n if (!foundItem) {\n foundItem = SchemaGenerator.find<T>([entrySchema], keyword)\n }\n })\n }\n })\n\n return foundItem\n }\n\n static find<T extends keyof SchemaKeywordMapper>(tree: Schema[] | undefined, keyword: T): SchemaKeywordMapper[T] | undefined {\n let foundItem: SchemaKeywordMapper[T] | undefined = undefined\n\n tree?.forEach((schema) => {\n if (!foundItem && schema.keyword === keyword) {\n foundItem = schema as SchemaKeywordMapper[T]\n }\n\n if (schema.keyword === schemaKeywords.array) {\n const subItem = schema as SchemaKeywordMapper['array']\n\n subItem.args.items.forEach((entrySchema) => {\n if (!foundItem) {\n foundItem = SchemaGenerator.find<T>([entrySchema], keyword)\n }\n })\n }\n\n if (schema.keyword === schemaKeywords.and) {\n const subItem = schema as SchemaKeywordMapper['and']\n\n subItem.args.forEach((entrySchema) => {\n if (!foundItem) {\n foundItem = SchemaGenerator.find<T>([entrySchema], keyword)\n }\n })\n }\n\n if (schema.keyword === schemaKeywords.tuple) {\n const subItem = schema as SchemaKeywordMapper['tuple']\n\n subItem.args.items.forEach((entrySchema) => {\n if (!foundItem) {\n foundItem = SchemaGenerator.find<T>([entrySchema], keyword)\n }\n })\n }\n\n if (schema.keyword === schemaKeywords.union) {\n const subItem = schema as SchemaKeywordMapper['union']\n\n subItem.args.forEach((entrySchema) => {\n if (!foundItem) {\n foundItem = SchemaGenerator.find<T>([entrySchema], keyword)\n }\n })\n }\n })\n\n return foundItem\n }\n\n #getUsedEnumNames(props: SchemaProps) {\n const options = this.#getOptions(props)\n\n return options.usedEnumNames || {}\n }\n\n #getOptions({ name }: SchemaProps): Partial<TOptions> {\n const { override = [] } = this.context\n\n return {\n ...this.options,\n ...(override.find(({ pattern, type }) => {\n if (name && type === 'schemaName') {\n return !!name.match(pattern)\n }\n\n return false\n })?.options || {}),\n }\n }\n\n #getUnknownReturn(props: SchemaProps) {\n const options = this.#getOptions(props)\n\n if (options.unknownType === 'any') {\n return schemaKeywords.any\n }\n\n return schemaKeywords.unknown\n }\n\n /**\n * Recursively creates a type literal with the given props.\n */\n #parseProperties({ schema, name }: SchemaProps): Schema[] {\n const properties = schema?.properties || {}\n const additionalProperties = schema?.additionalProperties\n const required = schema?.required\n\n const propertiesSchemas = Object.keys(properties)\n .map((propertyName) => {\n const validationFunctions: Schema[] = []\n const propertySchema = properties[propertyName] as SchemaObject\n\n const isRequired = Array.isArray(required) ? required?.includes(propertyName) : !!required\n const nullable = propertySchema.nullable ?? propertySchema['x-nullable'] ?? false\n\n validationFunctions.push(...this.parse({ schema: propertySchema, name: propertyName, parentName: name }))\n\n validationFunctions.push({\n keyword: schemaKeywords.name,\n args: propertyName,\n })\n\n if (!isRequired && nullable) {\n validationFunctions.push({ keyword: schemaKeywords.nullish })\n } else if (!isRequired) {\n validationFunctions.push({ keyword: schemaKeywords.optional })\n }\n\n return {\n [propertyName]: validationFunctions,\n }\n })\n .reduce((acc, curr) => ({ ...acc, ...curr }), {})\n let additionalPropertiesSchemas: Schema[] = []\n\n if (additionalProperties) {\n additionalPropertiesSchemas =\n additionalProperties === true\n ? [{ keyword: this.#getUnknownReturn({ schema, name }) }]\n : this.parse({ schema: additionalProperties as SchemaObject, parentName: name })\n }\n\n return [\n {\n keyword: schemaKeywords.object,\n args: {\n properties: propertiesSchemas,\n additionalProperties: additionalPropertiesSchemas,\n },\n },\n ]\n }\n\n /**\n * Create a type alias for the schema referenced by the given ReferenceObject\n */\n #getRefAlias(obj: OpenAPIV3.ReferenceObject): Schema[] {\n const { $ref } = obj\n let ref = this.refs[$ref]\n\n const originalName = getUniqueName($ref.replace(/.+\\//, ''), this.#usedAliasNames)\n const propertyName = this.context.pluginManager.resolveName({\n name: originalName,\n pluginKey: this.context.plugin.key,\n type: 'function',\n })\n\n if (ref) {\n return [\n {\n keyword: schemaKeywords.ref,\n args: { name: ref.propertyName, path: ref.path },\n },\n ]\n }\n\n const fileName = this.context.pluginManager.resolveName({\n name: originalName,\n pluginKey: this.context.plugin.key,\n type: 'file',\n })\n const file = this.context.pluginManager.getFile({\n name: fileName,\n pluginKey: this.context.plugin.key,\n extName: '.ts',\n })\n\n ref = this.refs[$ref] = {\n propertyName,\n originalName,\n path: file.path,\n }\n\n return [\n {\n keyword: schemaKeywords.ref,\n args: { name: ref.propertyName, path: ref?.path },\n },\n ]\n }\n\n #getParsedSchemaObject(schema?: SchemaObject) {\n const parsedSchema = getSchemaFactory(this.context.oas)(schema)\n return parsedSchema\n }\n\n /**\n * This is the very core of the OpenAPI to TS conversion - it takes a\n * schema and returns the appropriate type.\n */\n #parseSchemaObject({ schema: _schema, name, parentName }: SchemaProps): Schema[] {\n const options = this.#getOptions({ schema: _schema, name })\n const unknownReturn = this.#getUnknownReturn({ schema: _schema, name })\n const { schema, version } = this.#getParsedSchemaObject(_schema)\n if (!schema) {\n return [{ keyword: unknownReturn }]\n }\n\n const baseItems: Schema[] = [\n {\n keyword: schemaKeywords.schema,\n args: {\n type: schema.type as any,\n format: schema.format,\n },\n },\n ]\n const min = schema.minimum ?? schema.minLength ?? schema.minItems ?? undefined\n const max = schema.maximum ?? schema.maxLength ?? schema.maxItems ?? undefined\n const nullable = schema.nullable ?? schema['x-nullable'] ?? false\n\n if (schema.default !== undefined && !Array.isArray(schema.default)) {\n if (typeof schema.default === 'string') {\n baseItems.push({\n keyword: schemaKeywords.default,\n args: transformers.stringify(schema.default),\n })\n } else if (typeof schema.default === 'boolean') {\n baseItems.push({\n keyword: schemaKeywords.default,\n args: schema.default ?? false,\n })\n } else {\n baseItems.push({\n keyword: schemaKeywords.default,\n args: schema.default,\n })\n }\n }\n\n if (schema.description) {\n baseItems.push({\n keyword: schemaKeywords.describe,\n args: schema.description,\n })\n }\n\n if (schema.pattern) {\n baseItems.unshift({\n keyword: schemaKeywords.matches,\n args: schema.pattern,\n })\n }\n\n if (max !== undefined) {\n baseItems.unshift({ keyword: schemaKeywords.max, args: max })\n }\n\n if (min !== undefined) {\n baseItems.unshift({ keyword: schemaKeywords.min, args: min })\n }\n\n if (nullable) {\n baseItems.push({ keyword: schemaKeywords.nullable })\n }\n\n if (schema.type && Array.isArray(schema.type)) {\n const [_schema, nullable] = schema.type\n\n if (nullable === 'null') {\n baseItems.push({ keyword: schemaKeywords.nullable })\n }\n }\n\n if (schema.readOnly) {\n baseItems.push({ keyword: schemaKeywords.readOnly })\n }\n\n if (isReference(schema)) {\n return [\n ...this.#getRefAlias(schema),\n nullable && { keyword: schemaKeywords.nullable },\n {\n keyword: schemaKeywords.schema,\n args: {\n type: schema.type as any,\n format: schema.format,\n },\n },\n ].filter(Boolean)\n }\n\n if (schema.oneOf) {\n // union\n const schemaWithoutOneOf = { ...schema, oneOf: undefined }\n\n const union: Schema = {\n keyword: schemaKeywords.union,\n args: schema.oneOf\n .map((item) => {\n return item && this.parse({ schema: item as SchemaObject, name, parentName })[0]\n })\n .filter(Boolean)\n .filter((item) => {\n return item && item.keyword !== unknownReturn\n }),\n }\n if (schemaWithoutOneOf.properties) {\n return [...this.parse({ schema: schemaWithoutOneOf, name, parentName }), union, ...baseItems]\n }\n\n return [union, ...baseItems]\n }\n\n if (schema.anyOf) {\n // union\n const schemaWithoutAnyOf = { ...schema, anyOf: undefined }\n\n const union: Schema = {\n keyword: schemaKeywords.union,\n args: schema.anyOf\n .map((item) => {\n return item && this.parse({ schema: item as SchemaObject, name, parentName })[0]\n })\n .filter(Boolean)\n .filter((item) => {\n return item && item.keyword !== unknownReturn\n })\n .map((item) => {\n if (isKeyword(item, schemaKeywords.object)) {\n return {\n ...item,\n args: {\n ...item.args,\n strict: true,\n },\n }\n }\n return item\n }),\n }\n if (schemaWithoutAnyOf.properties) {\n return [...this.parse({ schema: schemaWithoutAnyOf, name, parentName }), union, ...baseItems]\n }\n\n return [union, ...baseItems]\n }\n if (schema.allOf) {\n // intersection/add\n const schemaWithoutAllOf = { ...schema, allOf: undefined }\n\n const and: Schema = {\n keyword: schemaKeywords.and,\n args: schema.allOf\n .map((item) => {\n return item && this.parse({ schema: item as SchemaObject, name, parentName })[0]\n })\n .filter(Boolean)\n .filter((item) => {\n return item && item.keyword !== unknownReturn\n }),\n }\n\n if (schemaWithoutAllOf.properties) {\n return [\n {\n ...and,\n args: [...(and.args || []), ...this.parse({ schema: schemaWithoutAllOf, name, parentName })],\n },\n ...baseItems,\n ]\n }\n\n return [and, ...baseItems]\n }\n\n if (schema.enum) {\n const enumName = getUniqueName(pascalCase([parentName, name, options.enumSuffix].join(' ')), this.#getUsedEnumNames({ schema, name }))\n const typeName = this.context.pluginManager.resolveName({\n name: enumName,\n pluginKey: this.context.plugin.key,\n type: 'type',\n })\n\n const nullableEnum = schema.enum.includes(null)\n if (nullableEnum) {\n baseItems.push({ keyword: schemaKeywords.nullable })\n }\n const filteredValues = schema.enum.filter((value) => value !== null)\n\n // x-enumNames has priority\n const extensionEnums = ['x-enumNames', 'x-enum-varnames']\n .filter((extensionKey) => extensionKey in schema)\n .map((extensionKey) => {\n return [\n {\n keyword: schemaKeywords.enum,\n args: {\n name,\n typeName,\n asConst: false,\n items: [...new Set(schema[extensionKey as keyof typeof schema] as string[])].map((name: string | number, index) => ({\n name: transformers.stringify(name),\n value: schema.enum?.[index] as string | number,\n format: isNumber(schema.enum?.[index]) ? 'number' : 'string',\n })),\n },\n },\n ...baseItems.filter(\n (item) => item.keyword !== schemaKeywords.min && item.keyword !== schemaKeywords.max && item.keyword !== schemaKeywords.matches,\n ),\n ]\n })\n\n if (schema.type === 'number' || schema.type === 'integer') {\n // we cannot use z.enum when enum type is number/integer\n const enumNames = extensionEnums[0]?.find((item) => isKeyword(item, schemaKeywords.enum)) as unknown as SchemaKeywordMapper['enum']\n return [\n {\n keyword: schemaKeywords.enum,\n args: {\n name: enumName,\n typeName,\n asConst: true,\n items: enumNames?.args?.items\n ? [...new Set(enumNames.args.items)].map(({ name, value }) => ({\n name,\n value,\n format: 'number',\n }))\n : [...new Set(filteredValues)].map((value: string) => {\n return {\n name: value,\n value,\n format: 'number',\n }\n }),\n },\n },\n ...baseItems.filter((item) => item.keyword !== schemaKeywords.min && item.keyword !== schemaKeywords.max && item.keyword !== schemaKeywords.matches),\n ]\n }\n\n if (extensionEnums.length > 0 && extensionEnums[0]) {\n return extensionEnums[0]\n }\n\n return [\n {\n keyword: schemaKeywords.enum,\n args: {\n name: enumName,\n typeName,\n asConst: false,\n items: [...new Set(filteredValues)].map((value: string) => ({\n name: transformers.stringify(value),\n value,\n format: isNumber(value) ? 'number' : 'string',\n })),\n },\n },\n ...baseItems.filter((item) => item.keyword !== schemaKeywords.min && item.keyword !== schemaKeywords.max && item.keyword !== schemaKeywords.matches),\n ]\n }\n\n if ('prefixItems' in schema) {\n const prefixItems = schema.prefixItems as SchemaObject[]\n const min = schema.minimum ?? schema.minLength ?? schema.minItems ?? undefined\n const max = schema.maximum ?? schema.maxLength ?? schema.maxItems ?? undefined\n\n return [\n {\n keyword: schemaKeywords.tuple,\n args: {\n min,\n max,\n items: prefixItems\n .map((item) => {\n return this.parse({ schema: item, name, parentName })[0]\n })\n .filter(Boolean),\n },\n },\n ...baseItems.filter((item) => item.keyword !== schemaKeywords.min && item.keyword !== schemaKeywords.max),\n ]\n }\n\n if (version === '3.1' && 'const' in schema) {\n // const keyword takes precendence over the actual type.\n if (schema['const']) {\n return [\n {\n keyword: schemaKeywords.const,\n args: {\n name: schema['const'],\n format: typeof schema['const'] === 'number' ? 'number' : 'string',\n value: schema['const'],\n },\n },\n ...baseItems,\n ]\n }\n return [{ keyword: schemaKeywords.null }]\n }\n\n /**\n * > Structural validation alone may be insufficient to allow an application to correctly utilize certain values. The \"format\"\n * > annotation keyword is defined to allow schema authors to convey semantic information for a fixed subset of values which are\n * > accurately described by authoritative resources, be they RFCs or other external specifications.\n *\n * In other words: format is more specific than type alone, hence it should override the type value, if possible.\n *\n * see also https://json-schema.org/draft/2020-12/draft-bhutton-json-schema-validation-00#rfc.section.7\n */\n if (schema.format) {\n switch (schema.format) {\n case 'binary':\n baseItems.push({ keyword: schemaKeywords.blob })\n return baseItems\n case 'date-time':\n if (options.dateType) {\n if (options.dateType === 'date') {\n baseItems.unshift({ keyword: schemaKeywords.date, args: { type: 'date' } })\n\n return baseItems\n }\n\n if (options.dateType === 'stringOffset') {\n baseItems.unshift({ keyword: schemaKeywords.datetime, args: { offset: true } })\n return baseItems\n }\n\n if (options.dateType === 'stringLocal') {\n baseItems.unshift({ keyword: schemaKeywords.datetime, args: { local: true } })\n return baseItems\n }\n\n baseItems.unshift({ keyword: schemaKeywords.datetime, args: { offset: false } })\n\n return baseItems\n }\n break\n case 'date':\n if (options.dateType) {\n if (options.dateType === 'date') {\n baseItems.unshift({ keyword: schemaKeywords.date, args: { type: 'date' } })\n\n return baseItems\n }\n\n baseItems.unshift({ keyword: schemaKeywords.date, args: { type: 'string' } })\n\n return baseItems\n }\n break\n case 'time':\n if (options.dateType) {\n if (options.dateType === 'date') {\n baseItems.unshift({ keyword: schemaKeywords.time, args: { type: 'date' } })\n\n return baseItems\n }\n\n baseItems.unshift({ keyword: schemaKeywords.time, args: { type: 'string' } })\n\n return baseItems\n }\n break\n case 'uuid':\n baseItems.unshift({ keyword: schemaKeywords.uuid })\n break\n case 'email':\n case 'idn-email':\n baseItems.unshift({ keyword: schemaKeywords.email })\n break\n case 'uri':\n case 'ipv4':\n case 'ipv6':\n case 'uri-reference':\n case 'hostname':\n case 'idn-hostname':\n baseItems.unshift({ keyword: schemaKeywords.url })\n break\n // case 'duration':\n // case 'json-pointer':\n // case 'relative-json-pointer':\n default:\n // formats not yet implemented: ignore.\n break\n }\n }\n\n // type based logic\n if ('items' in schema || schema.type === ('array' as 'string')) {\n const min = schema.minimum ?? schema.minLength ?? schema.minItems ?? undefined\n const max = schema.maximum ?? schema.maxLength ?? schema.maxItems ?? undefined\n const items = this.parse({ schema: 'items' in schema ? (schema.items as SchemaObject) : [], name, parentName })\n\n return [\n {\n keyword: schemaKeywords.array,\n args: {\n items,\n min,\n max,\n },\n },\n ...baseItems.filter((item) => item.keyword !== schemaKeywords.min && item.keyword !== schemaKeywords.max),\n ]\n }\n\n if (schema.properties || schema.additionalProperties) {\n return [...this.#parseProperties({ schema, name }), ...baseItems]\n }\n\n if (schema.type) {\n if (Array.isArray(schema.type)) {\n // OPENAPI v3.1.0: https://www.openapis.org/blog/2021/02/16/migrating-from-openapi-3-0-to-3-1-0\n const [type] = schema.type as Array<OpenAPIV3.NonArraySchemaObjectType>\n\n return [\n ...this.parse({\n schema: {\n ...schema,\n type,\n },\n name,\n parentName,\n }),\n ...baseItems,\n ].filter(Boolean)\n }\n\n if (!['boolean', 'object', 'number', 'string', 'integer', 'null'].includes(schema.type)) {\n this.context.pluginManager.logger.emit('warning', `Schema type '${schema.type}' is not valid for schema ${parentName}.${name}`)\n }\n\n // 'string' | 'number' | 'integer' | 'boolean'\n return [{ keyword: schema.type }, ...baseItems]\n }\n\n return [{ keyword: unknownReturn }]\n }\n\n async build(...generators: Array<Generator<TPluginOptions>>): Promise<Array<KubbFile.File<TFileMeta>>> {\n const { oas, contentType, include } = this.context\n\n const schemas = getSchemas({ oas, contentType, includes: include })\n\n const promises = Object.entries(schemas).reduce((acc, [name, value]) => {\n if (!value) {\n return acc\n }\n\n const options = this.#getOptions({ name })\n const promiseOperation = this.schema.call(this, name, value, {\n ...this.options,\n ...options,\n })\n\n if (promiseOperation) {\n acc.push(promiseOperation)\n }\n\n generators?.forEach((generator) => {\n const tree = this.parse({ schema: value, name: name })\n\n const promise = generator.schema?.({\n instance: this,\n schema: {\n name,\n value,\n tree,\n },\n options: {\n ...this.options,\n ...options,\n },\n } as any) as Promise<Array<KubbFile.File<TFileMeta>>>\n\n if (promise) {\n acc.push(promise)\n }\n })\n\n return acc\n }, [] as SchemaMethodResult<TFileMeta>[])\n\n const files = await Promise.all(promises)\n\n // using .flat because schemaGenerator[method] can return an array of files or just one file\n return files.flat().filter(Boolean)\n }\n\n /**\n * Schema\n */\n async schema(name: string, object: SchemaObject, options: TOptions): SchemaMethodResult<TFileMeta> {\n return []\n }\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"chunk-PADR76WZ.cjs"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"chunk-R47XMJ32.js"}
|