@hey-api/shared 0.3.0 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.mts +19 -5
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +283 -290
- package/dist/index.mjs.map +1 -1
- package/package.json +11 -12
package/dist/index.mjs
CHANGED
|
@@ -7,7 +7,6 @@ import * as semver from "semver";
|
|
|
7
7
|
import { getResolvedInput, sendRequest } from "@hey-api/json-schema-ref-parser";
|
|
8
8
|
import { fromRef, ref } from "@hey-api/codegen-core";
|
|
9
9
|
import { EOL } from "node:os";
|
|
10
|
-
|
|
11
10
|
//#region src/tsConfig.ts
|
|
12
11
|
function findPackageJson(initialDir) {
|
|
13
12
|
let dir = initialDir;
|
|
@@ -54,7 +53,6 @@ function findTsConfigPath(baseDir, tsConfigPath) {
|
|
|
54
53
|
}
|
|
55
54
|
return null;
|
|
56
55
|
}
|
|
57
|
-
|
|
58
56
|
//#endregion
|
|
59
57
|
//#region src/cli.ts
|
|
60
58
|
const textAscii = `
|
|
@@ -103,13 +101,11 @@ function printCliIntro(initialDir, showLogo = false) {
|
|
|
103
101
|
}
|
|
104
102
|
console.log("");
|
|
105
103
|
}
|
|
106
|
-
|
|
107
104
|
//#endregion
|
|
108
105
|
//#region src/fs.ts
|
|
109
106
|
function ensureDirSync(path) {
|
|
110
107
|
if (!fs.existsSync(path)) fs.mkdirSync(path, { recursive: true });
|
|
111
108
|
}
|
|
112
|
-
|
|
113
109
|
//#endregion
|
|
114
110
|
//#region src/error.ts
|
|
115
111
|
/**
|
|
@@ -135,6 +131,19 @@ var ConfigValidationError = class extends Error {
|
|
|
135
131
|
}
|
|
136
132
|
};
|
|
137
133
|
/**
|
|
134
|
+
* Represents an error caused by invalid or inaccessible input.
|
|
135
|
+
*
|
|
136
|
+
* Used for errors like file not found, URL not reachable, etc.
|
|
137
|
+
*/
|
|
138
|
+
var InputError = class extends Error {
|
|
139
|
+
originalError;
|
|
140
|
+
constructor(message, originalError) {
|
|
141
|
+
super(message);
|
|
142
|
+
this.name = "InputError";
|
|
143
|
+
this.originalError = originalError;
|
|
144
|
+
}
|
|
145
|
+
};
|
|
146
|
+
/**
|
|
138
147
|
* Represents a runtime error originating from a specific job.
|
|
139
148
|
*
|
|
140
149
|
* Used for reporting job-level failures that are not config validation errors.
|
|
@@ -163,7 +172,7 @@ var HeyApiError = class extends Error {
|
|
|
163
172
|
}
|
|
164
173
|
};
|
|
165
174
|
function logCrashReport(error, logsDir) {
|
|
166
|
-
if (error instanceof ConfigError || error instanceof ConfigValidationError) return;
|
|
175
|
+
if (error instanceof ConfigError || error instanceof ConfigValidationError || error instanceof InputError) return;
|
|
167
176
|
if (error instanceof JobError) error = error.originalError.error;
|
|
168
177
|
const logName = `openapi-ts-error-${Date.now()}.log`;
|
|
169
178
|
const fullDir = path.resolve(process.cwd(), logsDir);
|
|
@@ -203,6 +212,10 @@ async function openGitHubIssueWithCrashReport(error, initialDir) {
|
|
|
203
212
|
});
|
|
204
213
|
await open(`${packageJson.bugs.url}new?${search.toString()}`);
|
|
205
214
|
}
|
|
215
|
+
function getInputError(error) {
|
|
216
|
+
if (error instanceof InputError) return error;
|
|
217
|
+
if (error instanceof JobError && error.originalError.error instanceof InputError) return error.originalError.error;
|
|
218
|
+
}
|
|
206
219
|
function printCrashReport({ error, logPath }) {
|
|
207
220
|
if (error instanceof ConfigValidationError && error.errors.length) {
|
|
208
221
|
const groupByJob = /* @__PURE__ */ new Map();
|
|
@@ -227,6 +240,26 @@ function printCrashReport({ error, logPath }) {
|
|
|
227
240
|
jobPrefix = colors.gray(`[Job ${error.originalError.jobIndex + 1}] `);
|
|
228
241
|
error = error.originalError.error;
|
|
229
242
|
}
|
|
243
|
+
if (error instanceof InputError) {
|
|
244
|
+
const source = error.originalError.source;
|
|
245
|
+
const itemPrefixStr = ` `;
|
|
246
|
+
if (error.message.startsWith("Input request failed")) {
|
|
247
|
+
console.error(`${jobPrefix}${colors.red(`❌ ${error.message}`)}`);
|
|
248
|
+
if (source) console.error(colors.gray(source));
|
|
249
|
+
console.error(colors.gray("\nPlease verify that:"));
|
|
250
|
+
console.error(colors.gray(`${itemPrefixStr}• The URL is correct`));
|
|
251
|
+
console.error(colors.gray(`${itemPrefixStr}• Your API key is valid`));
|
|
252
|
+
console.error(colors.gray(`${itemPrefixStr}• You have network access`));
|
|
253
|
+
return;
|
|
254
|
+
}
|
|
255
|
+
console.error(`${jobPrefix}${colors.red("❌ Input file not found:")}`);
|
|
256
|
+
if (source) console.error(colors.gray(source));
|
|
257
|
+
console.error(colors.gray("\nPlease verify that:"));
|
|
258
|
+
console.error(colors.gray(`${itemPrefixStr}• The file exists`));
|
|
259
|
+
console.error(colors.gray(`${itemPrefixStr}• The path is correct`));
|
|
260
|
+
console.error(colors.gray(`${itemPrefixStr}• You have read permissions`));
|
|
261
|
+
return;
|
|
262
|
+
}
|
|
230
263
|
const baseString = colors.red("Failed with the message:");
|
|
231
264
|
console.error(`${jobPrefix}❌ ${baseString}`);
|
|
232
265
|
const itemPrefix = colors.red(` `);
|
|
@@ -238,7 +271,7 @@ function printCrashReport({ error, logPath }) {
|
|
|
238
271
|
}
|
|
239
272
|
}
|
|
240
273
|
async function shouldReportCrash({ error, isInteractive }) {
|
|
241
|
-
if (!isInteractive || error instanceof ConfigError || error instanceof ConfigValidationError) return false;
|
|
274
|
+
if (!isInteractive || error instanceof ConfigError || error instanceof ConfigValidationError || error instanceof InputError) return false;
|
|
242
275
|
return new Promise((resolve) => {
|
|
243
276
|
const jobPrefix = colors.gray("[root] ");
|
|
244
277
|
console.log(`${jobPrefix}${colors.yellow("📢 Open a GitHub issue with crash details? (y/N):")}`);
|
|
@@ -248,7 +281,6 @@ async function shouldReportCrash({ error, isInteractive }) {
|
|
|
248
281
|
});
|
|
249
282
|
});
|
|
250
283
|
}
|
|
251
|
-
|
|
252
284
|
//#endregion
|
|
253
285
|
//#region src/config/engine.ts
|
|
254
286
|
function checkNodeVersion() {
|
|
@@ -260,7 +292,6 @@ function checkNodeVersion() {
|
|
|
260
292
|
if (major < 20) throw new ConfigError(`Unsupported Node version ${process.versions.node}. Please use Node 20 or newer.`);
|
|
261
293
|
}
|
|
262
294
|
}
|
|
263
|
-
|
|
264
295
|
//#endregion
|
|
265
296
|
//#region src/utils/input/heyApi.ts
|
|
266
297
|
const registryRegExp$2 = /^([\w-]+)\/([\w-]+)(?:\?([\w=&.-]*))?$/;
|
|
@@ -315,7 +346,6 @@ function inputToHeyApiPath(input) {
|
|
|
315
346
|
registry: "hey-api"
|
|
316
347
|
};
|
|
317
348
|
}
|
|
318
|
-
|
|
319
349
|
//#endregion
|
|
320
350
|
//#region src/utils/input/readme.ts
|
|
321
351
|
const registryRegExp$1 = /^(@([\w-]+)\/([\w\-.]+)#)?([\w-]+)$/;
|
|
@@ -361,7 +391,6 @@ function inputToReadmePath(input) {
|
|
|
361
391
|
registry: "readme"
|
|
362
392
|
};
|
|
363
393
|
}
|
|
364
|
-
|
|
365
394
|
//#endregion
|
|
366
395
|
//#region src/utils/input/scalar.ts
|
|
367
396
|
const registryRegExp = /^(@[\w-]+)\/([\w.-]+)$/;
|
|
@@ -408,7 +437,6 @@ function inputToScalarPath(input) {
|
|
|
408
437
|
registry: "scalar"
|
|
409
438
|
};
|
|
410
439
|
}
|
|
411
|
-
|
|
412
440
|
//#endregion
|
|
413
441
|
//#region src/utils/input/index.ts
|
|
414
442
|
function inputToApiRegistry(input) {
|
|
@@ -422,7 +450,7 @@ function inputToApiRegistry(input) {
|
|
|
422
450
|
}
|
|
423
451
|
if (input.path.startsWith(".")) return;
|
|
424
452
|
if (input.path.startsWith("https://get.heyapi.dev")) {
|
|
425
|
-
input.path = input.path.slice(
|
|
453
|
+
input.path = input.path.slice(23);
|
|
426
454
|
Object.assign(input, inputToHeyApiPath(input));
|
|
427
455
|
return;
|
|
428
456
|
}
|
|
@@ -432,7 +460,6 @@ function inputToApiRegistry(input) {
|
|
|
432
460
|
return;
|
|
433
461
|
}
|
|
434
462
|
}
|
|
435
|
-
|
|
436
463
|
//#endregion
|
|
437
464
|
//#region src/config/input/input.ts
|
|
438
465
|
const defaultWatch = {
|
|
@@ -482,7 +509,6 @@ function getInput(userConfig) {
|
|
|
482
509
|
}
|
|
483
510
|
return inputs;
|
|
484
511
|
}
|
|
485
|
-
|
|
486
512
|
//#endregion
|
|
487
513
|
//#region src/config/input/path.ts
|
|
488
514
|
function compileInputPath(input) {
|
|
@@ -584,7 +610,6 @@ function logInputPaths(inputPaths, jobIndex) {
|
|
|
584
610
|
});
|
|
585
611
|
for (const line of lines) console.log(line);
|
|
586
612
|
}
|
|
587
|
-
|
|
588
613
|
//#endregion
|
|
589
614
|
//#region src/config/logs.ts
|
|
590
615
|
function getLogs(userLogs) {
|
|
@@ -600,7 +625,6 @@ function getLogs(userLogs) {
|
|
|
600
625
|
};
|
|
601
626
|
return logs;
|
|
602
627
|
}
|
|
603
|
-
|
|
604
628
|
//#endregion
|
|
605
629
|
//#region src/config/output/postprocess.ts
|
|
606
630
|
function postprocessOutput(config, postProcessors, jobPrefix) {
|
|
@@ -613,7 +637,6 @@ function postprocessOutput(config, postProcessors, jobPrefix) {
|
|
|
613
637
|
sync(resolved.command, args);
|
|
614
638
|
}
|
|
615
639
|
}
|
|
616
|
-
|
|
617
640
|
//#endregion
|
|
618
641
|
//#region src/config/utils/config.ts
|
|
619
642
|
const isPlainObject = (value) => typeof value === "object" && value !== null && !Array.isArray(value) && typeof value !== "function";
|
|
@@ -657,7 +680,6 @@ const valueToObject = ({ defaultValue, mappers, value }) => {
|
|
|
657
680
|
}
|
|
658
681
|
return result;
|
|
659
682
|
};
|
|
660
|
-
|
|
661
683
|
//#endregion
|
|
662
684
|
//#region src/config/output/source/config.ts
|
|
663
685
|
function resolveSource(config) {
|
|
@@ -675,7 +697,6 @@ function resolveSource(config) {
|
|
|
675
697
|
else if (source.path === false) source.path = null;
|
|
676
698
|
return source;
|
|
677
699
|
}
|
|
678
|
-
|
|
679
700
|
//#endregion
|
|
680
701
|
//#region src/config/parser/config.ts
|
|
681
702
|
const defaultPaginationKeywords = [
|
|
@@ -774,7 +795,6 @@ function getParser(userConfig) {
|
|
|
774
795
|
value: userConfig.parser
|
|
775
796
|
});
|
|
776
797
|
}
|
|
777
|
-
|
|
778
798
|
//#endregion
|
|
779
799
|
//#region src/config/utils/dependencies.ts
|
|
780
800
|
const satisfies = (...args) => semver.satisfies(...args);
|
|
@@ -799,7 +819,6 @@ function dependencyFactory(dependencies) {
|
|
|
799
819
|
}
|
|
800
820
|
};
|
|
801
821
|
}
|
|
802
|
-
|
|
803
822
|
//#endregion
|
|
804
823
|
//#region src/debug/graph.ts
|
|
805
824
|
const analyzeStructure = (graph) => {
|
|
@@ -836,7 +855,6 @@ const graph = {
|
|
|
836
855
|
analyzeStructure,
|
|
837
856
|
exportForVisualization
|
|
838
857
|
};
|
|
839
|
-
|
|
840
858
|
//#endregion
|
|
841
859
|
//#region src/ir/parameter.ts
|
|
842
860
|
const getPaginationSchema = ({ context, parameter }) => {
|
|
@@ -905,7 +923,6 @@ const parameterWithPagination = ({ context, parameters }) => {
|
|
|
905
923
|
};
|
|
906
924
|
}
|
|
907
925
|
};
|
|
908
|
-
|
|
909
926
|
//#endregion
|
|
910
927
|
//#region src/ir/schema.ts
|
|
911
928
|
/**
|
|
@@ -957,7 +974,6 @@ function deduplicateSchema({ detectFormat = true, schema }) {
|
|
|
957
974
|
if (result.type === "unknown") return {};
|
|
958
975
|
return result;
|
|
959
976
|
}
|
|
960
|
-
|
|
961
977
|
//#endregion
|
|
962
978
|
//#region src/ir/utils.ts
|
|
963
979
|
/**
|
|
@@ -985,7 +1001,6 @@ function addItemsToSchema({ items, logicalOperator = "or", mutateSchemaOneItem =
|
|
|
985
1001
|
schema.items = items;
|
|
986
1002
|
return schema;
|
|
987
1003
|
}
|
|
988
|
-
|
|
989
1004
|
//#endregion
|
|
990
1005
|
//#region src/ir/operation.ts
|
|
991
1006
|
const hasOperationDataRequired = (operation) => {
|
|
@@ -1102,7 +1117,6 @@ const operationResponsesMap = (operation) => {
|
|
|
1102
1117
|
}
|
|
1103
1118
|
return result;
|
|
1104
1119
|
};
|
|
1105
|
-
|
|
1106
1120
|
//#endregion
|
|
1107
1121
|
//#region src/utils/naming/naming.ts
|
|
1108
1122
|
const uppercaseRegExp = /[\p{Lu}]/u;
|
|
@@ -1220,7 +1234,6 @@ function applyNaming(value, config) {
|
|
|
1220
1234
|
}
|
|
1221
1235
|
return toCase(result, casing);
|
|
1222
1236
|
}
|
|
1223
|
-
|
|
1224
1237
|
//#endregion
|
|
1225
1238
|
//#region src/openApi/shared/utils/operation.ts
|
|
1226
1239
|
const httpMethods = [
|
|
@@ -1278,7 +1291,6 @@ function operationToId({ context, count = 1, id, method, path, state }) {
|
|
|
1278
1291
|
}));
|
|
1279
1292
|
return result;
|
|
1280
1293
|
}
|
|
1281
|
-
|
|
1282
1294
|
//#endregion
|
|
1283
1295
|
//#region src/debug/ir.ts
|
|
1284
1296
|
const indent = (level) => " ".repeat(level);
|
|
@@ -1331,15 +1343,12 @@ const print = (ir, options = {}) => {
|
|
|
1331
1343
|
}
|
|
1332
1344
|
}
|
|
1333
1345
|
};
|
|
1334
|
-
const ir = { print };
|
|
1335
|
-
|
|
1336
1346
|
//#endregion
|
|
1337
1347
|
//#region src/debug/index.ts
|
|
1338
1348
|
const debugTools = {
|
|
1339
1349
|
graph,
|
|
1340
|
-
ir
|
|
1350
|
+
ir: { print }
|
|
1341
1351
|
};
|
|
1342
|
-
|
|
1343
1352
|
//#endregion
|
|
1344
1353
|
//#region src/getSpec.ts
|
|
1345
1354
|
const headersEntries = (headers) => {
|
|
@@ -1462,7 +1471,6 @@ async function getSpec({ fetchOptions, inputPath, timeout, watch }) {
|
|
|
1462
1471
|
resolvedInput
|
|
1463
1472
|
};
|
|
1464
1473
|
}
|
|
1465
|
-
|
|
1466
1474
|
//#endregion
|
|
1467
1475
|
//#region src/utils/minHeap.ts
|
|
1468
1476
|
var MinHeap = class {
|
|
@@ -1523,7 +1531,6 @@ var MinHeap = class {
|
|
|
1523
1531
|
}
|
|
1524
1532
|
}
|
|
1525
1533
|
};
|
|
1526
|
-
|
|
1527
1534
|
//#endregion
|
|
1528
1535
|
//#region src/graph/walk.ts
|
|
1529
1536
|
/**
|
|
@@ -1648,7 +1655,6 @@ const walk = (graph, callback, options) => {
|
|
|
1648
1655
|
if (options?.order === "topological") return walkTopological(graph, callback, options);
|
|
1649
1656
|
return walkDeclarations(graph, callback, options);
|
|
1650
1657
|
};
|
|
1651
|
-
|
|
1652
1658
|
//#endregion
|
|
1653
1659
|
//#region src/ir/graph.ts
|
|
1654
1660
|
const irTopLevelKinds = [
|
|
@@ -1711,7 +1717,6 @@ const getIrPointerPriority = (pointer) => {
|
|
|
1711
1717
|
if (result.matched) return kindPriority[result.kind] ?? defaultPriority;
|
|
1712
1718
|
return defaultPriority;
|
|
1713
1719
|
};
|
|
1714
|
-
|
|
1715
1720
|
//#endregion
|
|
1716
1721
|
//#region src/utils/ref.ts
|
|
1717
1722
|
const jsonPointerSlash = /~1/g;
|
|
@@ -1814,7 +1819,6 @@ function resolveRef({ $ref, spec }) {
|
|
|
1814
1819
|
}
|
|
1815
1820
|
return current;
|
|
1816
1821
|
}
|
|
1817
|
-
|
|
1818
1822
|
//#endregion
|
|
1819
1823
|
//#region src/plugins/shared/utils/instance.ts
|
|
1820
1824
|
const defaultGetFilePath = (symbol) => {
|
|
@@ -2145,7 +2149,6 @@ var PluginInstance = class {
|
|
|
2145
2149
|
return false;
|
|
2146
2150
|
}
|
|
2147
2151
|
};
|
|
2148
|
-
|
|
2149
2152
|
//#endregion
|
|
2150
2153
|
//#region src/ir/context.ts
|
|
2151
2154
|
var Context = class {
|
|
@@ -2256,7 +2259,6 @@ var Context = class {
|
|
|
2256
2259
|
});
|
|
2257
2260
|
}
|
|
2258
2261
|
};
|
|
2259
|
-
|
|
2260
2262
|
//#endregion
|
|
2261
2263
|
//#region src/ir/intents.ts
|
|
2262
2264
|
var IntentContext = class {
|
|
@@ -2276,7 +2278,6 @@ var IntentContext = class {
|
|
|
2276
2278
|
source["x-codeSamples"].push(example);
|
|
2277
2279
|
}
|
|
2278
2280
|
};
|
|
2279
|
-
|
|
2280
2281
|
//#endregion
|
|
2281
2282
|
//#region src/ir/schema-processor.ts
|
|
2282
2283
|
function createSchemaProcessor() {
|
|
@@ -2313,7 +2314,6 @@ function createSchemaProcessor() {
|
|
|
2313
2314
|
}
|
|
2314
2315
|
};
|
|
2315
2316
|
}
|
|
2316
|
-
|
|
2317
2317
|
//#endregion
|
|
2318
2318
|
//#region src/ir/schema-walker.ts
|
|
2319
2319
|
/**
|
|
@@ -2382,24 +2382,25 @@ function childContext(ctx, ...segments) {
|
|
|
2382
2382
|
path: ref([...fromRef(ctx.path), ...segments])
|
|
2383
2383
|
};
|
|
2384
2384
|
}
|
|
2385
|
-
|
|
2386
2385
|
//#endregion
|
|
2387
2386
|
//#region src/openApi/shared/utils/filter.ts
|
|
2388
2387
|
const namespaceNeedle = "/";
|
|
2389
|
-
|
|
2390
|
-
|
|
2388
|
+
function addNamespace(namespace, value = "") {
|
|
2389
|
+
return `${namespace}${namespaceNeedle}${value}`;
|
|
2390
|
+
}
|
|
2391
|
+
function removeNamespace(key) {
|
|
2391
2392
|
const index = key.indexOf(namespaceNeedle);
|
|
2392
2393
|
return {
|
|
2393
2394
|
name: key.slice(index + 1),
|
|
2394
2395
|
namespace: key.slice(0, index)
|
|
2395
2396
|
};
|
|
2396
|
-
}
|
|
2397
|
+
}
|
|
2397
2398
|
/**
|
|
2398
2399
|
* Converts reference strings from OpenAPI $ref keywords into namespaces.
|
|
2399
2400
|
*
|
|
2400
2401
|
* @example '#/components/schemas/Foo' -> 'schema'
|
|
2401
2402
|
*/
|
|
2402
|
-
|
|
2403
|
+
function stringToNamespace(value) {
|
|
2403
2404
|
switch (value) {
|
|
2404
2405
|
case "parameters": return "parameter";
|
|
2405
2406
|
case "requestBodies": return "body";
|
|
@@ -2408,8 +2409,16 @@ const stringToNamespace = (value) => {
|
|
|
2408
2409
|
case "schemas": return "schema";
|
|
2409
2410
|
default: return "unknown";
|
|
2410
2411
|
}
|
|
2411
|
-
}
|
|
2412
|
-
|
|
2412
|
+
}
|
|
2413
|
+
function getResourceDependencies(key, resourceMetadata) {
|
|
2414
|
+
const { namespace } = removeNamespace(key);
|
|
2415
|
+
if (namespace === "body") return resourceMetadata.requestBodies.get(key)?.dependencies;
|
|
2416
|
+
if (namespace === "operation") return resourceMetadata.operations.get(key)?.dependencies;
|
|
2417
|
+
if (namespace === "parameter") return resourceMetadata.parameters.get(key)?.dependencies;
|
|
2418
|
+
if (namespace === "response") return resourceMetadata.responses.get(key)?.dependencies;
|
|
2419
|
+
if (namespace === "schema") return resourceMetadata.schemas.get(key)?.dependencies;
|
|
2420
|
+
}
|
|
2421
|
+
function createFiltersSetAndRegExps(type, filters) {
|
|
2413
2422
|
const keys = [];
|
|
2414
2423
|
const regexps = [];
|
|
2415
2424
|
if (filters) for (const value of filters) if (value.startsWith("/") && value.endsWith("/")) regexps.push(new RegExp(value.slice(1, value.length - 1)));
|
|
@@ -2418,8 +2427,8 @@ const createFiltersSetAndRegExps = (type, filters) => {
|
|
|
2418
2427
|
regexps,
|
|
2419
2428
|
set: new Set(keys)
|
|
2420
2429
|
};
|
|
2421
|
-
}
|
|
2422
|
-
|
|
2430
|
+
}
|
|
2431
|
+
function collectFiltersSetFromRegExpsOpenApiV2({ excludeOperations, excludeSchemas, includeOperations, includeSchemas, spec }) {
|
|
2423
2432
|
if ((excludeOperations.regexps.length || includeOperations.regexps.length) && spec.paths) for (const entry of Object.entries(spec.paths)) {
|
|
2424
2433
|
const path = entry[0];
|
|
2425
2434
|
const pathItem = entry[1];
|
|
@@ -2439,8 +2448,8 @@ const collectFiltersSetFromRegExpsOpenApiV2 = ({ excludeOperations, excludeSchem
|
|
|
2439
2448
|
if (includeSchemas.regexps.some((regexp) => regexp.test(key))) includeSchemas.set.add(addNamespace("schema", key));
|
|
2440
2449
|
}
|
|
2441
2450
|
}
|
|
2442
|
-
}
|
|
2443
|
-
|
|
2451
|
+
}
|
|
2452
|
+
function collectFiltersSetFromRegExpsOpenApiV3({ excludeOperations, excludeParameters, excludeRequestBodies, excludeResponses, excludeSchemas, includeOperations, includeParameters, includeRequestBodies, includeResponses, includeSchemas, spec }) {
|
|
2444
2453
|
if ((excludeOperations.regexps.length || includeOperations.regexps.length) && spec.paths) for (const entry of Object.entries(spec.paths)) {
|
|
2445
2454
|
const path = entry[0];
|
|
2446
2455
|
const pathItem = entry[1];
|
|
@@ -2472,8 +2481,8 @@ const collectFiltersSetFromRegExpsOpenApiV3 = ({ excludeOperations, excludeParam
|
|
|
2472
2481
|
if (includeSchemas.regexps.some((regexp) => regexp.test(key))) includeSchemas.set.add(addNamespace("schema", key));
|
|
2473
2482
|
}
|
|
2474
2483
|
}
|
|
2475
|
-
}
|
|
2476
|
-
|
|
2484
|
+
}
|
|
2485
|
+
function collectFiltersSetFromRegExps({ spec, ...filters }) {
|
|
2477
2486
|
if ("swagger" in spec) collectFiltersSetFromRegExpsOpenApiV2({
|
|
2478
2487
|
...filters,
|
|
2479
2488
|
spec
|
|
@@ -2482,8 +2491,8 @@ const collectFiltersSetFromRegExps = ({ spec, ...filters }) => {
|
|
|
2482
2491
|
...filters,
|
|
2483
2492
|
spec
|
|
2484
2493
|
});
|
|
2485
|
-
}
|
|
2486
|
-
|
|
2494
|
+
}
|
|
2495
|
+
function createFilters(config, spec, logger) {
|
|
2487
2496
|
const eventCreateFilters = logger.timeEvent("create-filters");
|
|
2488
2497
|
const excludeOperations = createFiltersSetAndRegExps("operation", config?.operations?.exclude);
|
|
2489
2498
|
const includeOperations = createFiltersSetAndRegExps("operation", config?.operations?.include);
|
|
@@ -2539,16 +2548,18 @@ const createFilters = (config, spec, logger) => {
|
|
|
2539
2548
|
};
|
|
2540
2549
|
eventCreateFilters.timeEnd();
|
|
2541
2550
|
return filters;
|
|
2542
|
-
}
|
|
2543
|
-
|
|
2551
|
+
}
|
|
2552
|
+
function hasFilters(config) {
|
|
2544
2553
|
if (!config) return false;
|
|
2545
2554
|
if (config.orphans === false || config.deprecated === false) return true;
|
|
2546
2555
|
return Boolean(config.operations?.exclude?.length || config.operations?.include?.length || config.parameters?.exclude?.length || config.parameters?.include?.length || config.requestBodies?.exclude?.length || config.requestBodies?.include?.length || config.responses?.exclude?.length || config.responses?.include?.length || config.schemas?.exclude?.length || config.schemas?.include?.length || config.tags?.exclude?.length || config.tags?.include?.length);
|
|
2547
|
-
}
|
|
2556
|
+
}
|
|
2548
2557
|
/**
|
|
2549
2558
|
* Collect operations that satisfy the include/exclude filters and schema dependencies.
|
|
2559
|
+
*
|
|
2560
|
+
* Must be called after dropping components.
|
|
2550
2561
|
*/
|
|
2551
|
-
|
|
2562
|
+
function collectOperations({ filters, parameters, requestBodies, resourceMetadata, responses, schemas }) {
|
|
2552
2563
|
const finalSet = /* @__PURE__ */ new Set();
|
|
2553
2564
|
const stack = [...filters.operations.include.size ? filters.operations.include : new Set(resourceMetadata.operations.keys())];
|
|
2554
2565
|
while (stack.length) {
|
|
@@ -2572,11 +2583,11 @@ const collectOperations = ({ filters, parameters, requestBodies, resourceMetadat
|
|
|
2572
2583
|
finalSet.add(key);
|
|
2573
2584
|
}
|
|
2574
2585
|
return { operations: finalSet };
|
|
2575
|
-
}
|
|
2586
|
+
}
|
|
2576
2587
|
/**
|
|
2577
2588
|
* Collect parameters that satisfy the include/exclude filters and schema dependencies.
|
|
2578
2589
|
*/
|
|
2579
|
-
|
|
2590
|
+
function collectParameters({ filters, resourceMetadata, schemas }) {
|
|
2580
2591
|
const finalSet = /* @__PURE__ */ new Set();
|
|
2581
2592
|
const stack = [...filters.parameters.include.size ? filters.parameters.include : new Set(resourceMetadata.parameters.keys())];
|
|
2582
2593
|
while (stack.length) {
|
|
@@ -2602,11 +2613,11 @@ const collectParameters = ({ filters, resourceMetadata, schemas }) => {
|
|
|
2602
2613
|
}
|
|
2603
2614
|
}
|
|
2604
2615
|
return { parameters: finalSet };
|
|
2605
|
-
}
|
|
2616
|
+
}
|
|
2606
2617
|
/**
|
|
2607
2618
|
* Collect request bodies that satisfy the include/exclude filters and schema dependencies.
|
|
2608
2619
|
*/
|
|
2609
|
-
|
|
2620
|
+
function collectRequestBodies({ filters, resourceMetadata, schemas }) {
|
|
2610
2621
|
const finalSet = /* @__PURE__ */ new Set();
|
|
2611
2622
|
const stack = [...filters.requestBodies.include.size ? filters.requestBodies.include : new Set(resourceMetadata.requestBodies.keys())];
|
|
2612
2623
|
while (stack.length) {
|
|
@@ -2632,11 +2643,11 @@ const collectRequestBodies = ({ filters, resourceMetadata, schemas }) => {
|
|
|
2632
2643
|
}
|
|
2633
2644
|
}
|
|
2634
2645
|
return { requestBodies: finalSet };
|
|
2635
|
-
}
|
|
2646
|
+
}
|
|
2636
2647
|
/**
|
|
2637
2648
|
* Collect responses that satisfy the include/exclude filters and schema dependencies.
|
|
2638
2649
|
*/
|
|
2639
|
-
|
|
2650
|
+
function collectResponses({ filters, resourceMetadata, schemas }) {
|
|
2640
2651
|
const finalSet = /* @__PURE__ */ new Set();
|
|
2641
2652
|
const stack = [...filters.responses.include.size ? filters.responses.include : new Set(resourceMetadata.responses.keys())];
|
|
2642
2653
|
while (stack.length) {
|
|
@@ -2662,11 +2673,11 @@ const collectResponses = ({ filters, resourceMetadata, schemas }) => {
|
|
|
2662
2673
|
}
|
|
2663
2674
|
}
|
|
2664
2675
|
return { responses: finalSet };
|
|
2665
|
-
}
|
|
2676
|
+
}
|
|
2666
2677
|
/**
|
|
2667
2678
|
* Collect schemas that satisfy the include/exclude filters.
|
|
2668
2679
|
*/
|
|
2669
|
-
|
|
2680
|
+
function collectSchemas({ filters, resourceMetadata }) {
|
|
2670
2681
|
const finalSet = /* @__PURE__ */ new Set();
|
|
2671
2682
|
const stack = [...filters.schemas.include.size ? filters.schemas.include : new Set(resourceMetadata.schemas.keys())];
|
|
2672
2683
|
while (stack.length) {
|
|
@@ -2687,11 +2698,11 @@ const collectSchemas = ({ filters, resourceMetadata }) => {
|
|
|
2687
2698
|
}
|
|
2688
2699
|
}
|
|
2689
2700
|
return { schemas: finalSet };
|
|
2690
|
-
}
|
|
2701
|
+
}
|
|
2691
2702
|
/**
|
|
2692
2703
|
* Drop parameters that depend on already excluded parameters.
|
|
2693
2704
|
*/
|
|
2694
|
-
|
|
2705
|
+
function dropExcludedParameters({ filters, parameters, resourceMetadata }) {
|
|
2695
2706
|
if (!filters.parameters.exclude.size) return;
|
|
2696
2707
|
for (const key of parameters) {
|
|
2697
2708
|
const node = resourceMetadata.parameters.get(key);
|
|
@@ -2701,11 +2712,11 @@ const dropExcludedParameters = ({ filters, parameters, resourceMetadata }) => {
|
|
|
2701
2712
|
break;
|
|
2702
2713
|
}
|
|
2703
2714
|
}
|
|
2704
|
-
}
|
|
2715
|
+
}
|
|
2705
2716
|
/**
|
|
2706
2717
|
* Drop request bodies that depend on already excluded request bodies.
|
|
2707
2718
|
*/
|
|
2708
|
-
|
|
2719
|
+
function dropExcludedRequestBodies({ filters, requestBodies, resourceMetadata }) {
|
|
2709
2720
|
if (!filters.requestBodies.exclude.size) return;
|
|
2710
2721
|
for (const key of requestBodies) {
|
|
2711
2722
|
const node = resourceMetadata.requestBodies.get(key);
|
|
@@ -2715,11 +2726,11 @@ const dropExcludedRequestBodies = ({ filters, requestBodies, resourceMetadata })
|
|
|
2715
2726
|
break;
|
|
2716
2727
|
}
|
|
2717
2728
|
}
|
|
2718
|
-
}
|
|
2729
|
+
}
|
|
2719
2730
|
/**
|
|
2720
2731
|
* Drop responses that depend on already excluded responses.
|
|
2721
2732
|
*/
|
|
2722
|
-
|
|
2733
|
+
function dropExcludedResponses({ filters, resourceMetadata, responses }) {
|
|
2723
2734
|
if (!filters.responses.exclude.size) return;
|
|
2724
2735
|
for (const key of responses) {
|
|
2725
2736
|
const node = resourceMetadata.responses.get(key);
|
|
@@ -2729,11 +2740,11 @@ const dropExcludedResponses = ({ filters, resourceMetadata, responses }) => {
|
|
|
2729
2740
|
break;
|
|
2730
2741
|
}
|
|
2731
2742
|
}
|
|
2732
|
-
}
|
|
2743
|
+
}
|
|
2733
2744
|
/**
|
|
2734
2745
|
* Drop schemas that depend on already excluded schemas.
|
|
2735
2746
|
*/
|
|
2736
|
-
|
|
2747
|
+
function dropExcludedSchemas({ filters, resourceMetadata, schemas }) {
|
|
2737
2748
|
if (!filters.schemas.exclude.size) return;
|
|
2738
2749
|
for (const key of schemas) {
|
|
2739
2750
|
const node = resourceMetadata.schemas.get(key);
|
|
@@ -2743,33 +2754,56 @@ const dropExcludedSchemas = ({ filters, resourceMetadata, schemas }) => {
|
|
|
2743
2754
|
break;
|
|
2744
2755
|
}
|
|
2745
2756
|
}
|
|
2746
|
-
}
|
|
2747
|
-
|
|
2748
|
-
for (const key of schemas) if (!operationDependencies.has(key)) schemas.delete(key);
|
|
2749
|
-
for (const key of parameters) if (!operationDependencies.has(key)) parameters.delete(key);
|
|
2750
|
-
for (const key of requestBodies) if (!operationDependencies.has(key)) requestBodies.delete(key);
|
|
2751
|
-
for (const key of responses) if (!operationDependencies.has(key)) responses.delete(key);
|
|
2752
|
-
}
|
|
2753
|
-
|
|
2757
|
+
}
|
|
2758
|
+
function dropOrphans({ includedDependencies, operationDependencies, parameters, requestBodies, responses, schemas }) {
|
|
2759
|
+
for (const key of schemas) if (!operationDependencies.has(key) && !includedDependencies.has(key)) schemas.delete(key);
|
|
2760
|
+
for (const key of parameters) if (!operationDependencies.has(key) && !includedDependencies.has(key)) parameters.delete(key);
|
|
2761
|
+
for (const key of requestBodies) if (!operationDependencies.has(key) && !includedDependencies.has(key)) requestBodies.delete(key);
|
|
2762
|
+
for (const key of responses) if (!operationDependencies.has(key) && !includedDependencies.has(key)) responses.delete(key);
|
|
2763
|
+
}
|
|
2764
|
+
function collectDependencies({ resourceMetadata, seeds }) {
|
|
2754
2765
|
const finalSet = /* @__PURE__ */ new Set();
|
|
2755
|
-
const stack = [...
|
|
2766
|
+
const stack = [...seeds];
|
|
2756
2767
|
while (stack.length) {
|
|
2757
2768
|
const key = stack.pop();
|
|
2758
2769
|
if (finalSet.has(key)) continue;
|
|
2759
2770
|
finalSet.add(key);
|
|
2771
|
+
const dependencies = getResourceDependencies(key, resourceMetadata);
|
|
2772
|
+
if (!dependencies?.size) continue;
|
|
2773
|
+
for (const dependency of dependencies) if (!finalSet.has(dependency)) stack.push(dependency);
|
|
2774
|
+
}
|
|
2775
|
+
return { dependencies: finalSet };
|
|
2776
|
+
}
|
|
2777
|
+
function collectExplicitDependencies({ filters, resourceMetadata }) {
|
|
2778
|
+
const seeds = /* @__PURE__ */ new Set();
|
|
2779
|
+
for (const key of filters.parameters.include) if (!filters.parameters.exclude.has(key)) seeds.add(key);
|
|
2780
|
+
for (const key of filters.requestBodies.include) if (!filters.requestBodies.exclude.has(key)) seeds.add(key);
|
|
2781
|
+
for (const key of filters.responses.include) if (!filters.responses.exclude.has(key)) seeds.add(key);
|
|
2782
|
+
for (const key of filters.schemas.include) if (!filters.schemas.exclude.has(key)) seeds.add(key);
|
|
2783
|
+
const { dependencies } = collectDependencies({
|
|
2784
|
+
resourceMetadata,
|
|
2785
|
+
seeds
|
|
2786
|
+
});
|
|
2787
|
+
for (const key of dependencies) {
|
|
2760
2788
|
const { namespace } = removeNamespace(key);
|
|
2761
|
-
|
|
2762
|
-
|
|
2763
|
-
|
|
2764
|
-
|
|
2765
|
-
|
|
2766
|
-
|
|
2789
|
+
if (namespace === "body" && filters.requestBodies.exclude.has(key) || namespace === "parameter" && filters.parameters.exclude.has(key) || namespace === "response" && filters.responses.exclude.has(key) || namespace === "schema" && filters.schemas.exclude.has(key)) dependencies.delete(key);
|
|
2790
|
+
}
|
|
2791
|
+
return { explicitDependencies: dependencies };
|
|
2792
|
+
}
|
|
2793
|
+
function collectOperationDependencies({ operations, resourceMetadata }) {
|
|
2794
|
+
const finalSet = /* @__PURE__ */ new Set();
|
|
2795
|
+
const stack = [...new Set([...operations].flatMap((key) => [...resourceMetadata.operations.get(key)?.dependencies ?? []]))];
|
|
2796
|
+
while (stack.length) {
|
|
2797
|
+
const key = stack.pop();
|
|
2798
|
+
if (finalSet.has(key)) continue;
|
|
2799
|
+
finalSet.add(key);
|
|
2800
|
+
const dependencies = getResourceDependencies(key, resourceMetadata);
|
|
2767
2801
|
if (!dependencies?.size) continue;
|
|
2768
2802
|
for (const dependency of dependencies) if (!finalSet.has(dependency)) stack.push(dependency);
|
|
2769
2803
|
}
|
|
2770
2804
|
return { operationDependencies: finalSet };
|
|
2771
|
-
}
|
|
2772
|
-
|
|
2805
|
+
}
|
|
2806
|
+
function createFilteredDependencies({ filters, logger, resourceMetadata }) {
|
|
2773
2807
|
const eventCreateFilteredDependencies = logger.timeEvent("create-filtered-dependencies");
|
|
2774
2808
|
const { schemas } = collectSchemas({
|
|
2775
2809
|
filters,
|
|
@@ -2823,7 +2857,12 @@ const createFilteredDependencies = ({ filters, logger, resourceMetadata }) => {
|
|
|
2823
2857
|
operations,
|
|
2824
2858
|
resourceMetadata
|
|
2825
2859
|
});
|
|
2860
|
+
const { explicitDependencies } = collectExplicitDependencies({
|
|
2861
|
+
filters,
|
|
2862
|
+
resourceMetadata
|
|
2863
|
+
});
|
|
2826
2864
|
dropOrphans({
|
|
2865
|
+
includedDependencies: explicitDependencies,
|
|
2827
2866
|
operationDependencies,
|
|
2828
2867
|
parameters,
|
|
2829
2868
|
requestBodies,
|
|
@@ -2839,8 +2878,7 @@ const createFilteredDependencies = ({ filters, logger, resourceMetadata }) => {
|
|
|
2839
2878
|
responses,
|
|
2840
2879
|
schemas
|
|
2841
2880
|
};
|
|
2842
|
-
}
|
|
2843
|
-
|
|
2881
|
+
}
|
|
2844
2882
|
//#endregion
|
|
2845
2883
|
//#region src/openApi/shared/graph/meta.ts
|
|
2846
2884
|
/**
|
|
@@ -2932,11 +2970,9 @@ const buildResourceMetadata = (graph, logger) => {
|
|
|
2932
2970
|
eventBuildResourceMetadata.timeEnd();
|
|
2933
2971
|
return { resourceMetadata };
|
|
2934
2972
|
};
|
|
2935
|
-
|
|
2936
2973
|
//#endregion
|
|
2937
2974
|
//#region src/openApi/shared/utils/schema.ts
|
|
2938
2975
|
const deepClone = (obj) => JSON.parse(JSON.stringify(obj));
|
|
2939
|
-
|
|
2940
2976
|
//#endregion
|
|
2941
2977
|
//#region src/openApi/shared/utils/schemaChildRelationships.ts
|
|
2942
2978
|
const childSchemaRelationships = [
|
|
@@ -2955,7 +2991,6 @@ const childSchemaRelationships = [
|
|
|
2955
2991
|
["then", "single"],
|
|
2956
2992
|
["unevaluatedProperties", "single"]
|
|
2957
2993
|
];
|
|
2958
|
-
|
|
2959
2994
|
//#endregion
|
|
2960
2995
|
//#region src/openApi/shared/utils/transforms.ts
|
|
2961
2996
|
const getSchemasObject = (spec) => {
|
|
@@ -2972,7 +3007,6 @@ const hasComponentsSchemasObject = (spec) => typeof spec === "object" && spec !=
|
|
|
2972
3007
|
* Returns true if present, false otherwise.
|
|
2973
3008
|
*/
|
|
2974
3009
|
const hasDefinitionsObject = (spec) => typeof spec === "object" && spec !== null && "definitions" in spec && typeof spec.definitions === "object" && spec.definitions !== null;
|
|
2975
|
-
|
|
2976
3010
|
//#endregion
|
|
2977
3011
|
//#region src/openApi/shared/transforms/utils.ts
|
|
2978
3012
|
const hasName = (obj, value) => {
|
|
@@ -2997,7 +3031,6 @@ const specToSchemasPointerNamespace = (spec) => {
|
|
|
2997
3031
|
}
|
|
2998
3032
|
return "";
|
|
2999
3033
|
};
|
|
3000
|
-
|
|
3001
3034
|
//#endregion
|
|
3002
3035
|
//#region src/openApi/shared/transforms/enums.ts
|
|
3003
3036
|
/**
|
|
@@ -3161,7 +3194,6 @@ const enumsTransform = ({ config, spec }) => {
|
|
|
3161
3194
|
return;
|
|
3162
3195
|
}
|
|
3163
3196
|
};
|
|
3164
|
-
|
|
3165
3197
|
//#endregion
|
|
3166
3198
|
//#region src/openApi/shared/transforms/propertiesRequiredByDefault.ts
|
|
3167
3199
|
/**
|
|
@@ -3221,7 +3253,6 @@ const propertiesRequiredByDefaultTransform = ({ spec }) => {
|
|
|
3221
3253
|
}
|
|
3222
3254
|
});
|
|
3223
3255
|
};
|
|
3224
|
-
|
|
3225
3256
|
//#endregion
|
|
3226
3257
|
//#region src/openApi/shared/utils/deepEqual.ts
|
|
3227
3258
|
/**
|
|
@@ -3249,7 +3280,6 @@ const deepEqual = (a, b) => {
|
|
|
3249
3280
|
for (const key of keysA) if (!deepEqual(objA[key], objB[key])) return false;
|
|
3250
3281
|
return true;
|
|
3251
3282
|
};
|
|
3252
|
-
|
|
3253
3283
|
//#endregion
|
|
3254
3284
|
//#region src/openApi/shared/utils/graph.ts
|
|
3255
3285
|
/**
|
|
@@ -3543,7 +3573,6 @@ function buildGraph(root, logger) {
|
|
|
3543
3573
|
eventBuildGraph.timeEnd();
|
|
3544
3574
|
return { graph };
|
|
3545
3575
|
}
|
|
3546
|
-
|
|
3547
3576
|
//#endregion
|
|
3548
3577
|
//#region src/openApi/shared/transforms/readWrite.ts
|
|
3549
3578
|
const schemaKeys = new Set([
|
|
@@ -4072,7 +4101,6 @@ const readWriteTransform = ({ config, logger, spec }) => {
|
|
|
4072
4101
|
split
|
|
4073
4102
|
});
|
|
4074
4103
|
};
|
|
4075
|
-
|
|
4076
4104
|
//#endregion
|
|
4077
4105
|
//#region src/openApi/shared/transforms/schemas.ts
|
|
4078
4106
|
/**
|
|
@@ -4113,7 +4141,6 @@ const schemaNameTransform = ({ config, spec }) => {
|
|
|
4113
4141
|
}
|
|
4114
4142
|
if (Object.keys(renameMap).length) rewriteRefs(spec, renameMap);
|
|
4115
4143
|
};
|
|
4116
|
-
|
|
4117
4144
|
//#endregion
|
|
4118
4145
|
//#region src/openApi/shared/transforms/index.ts
|
|
4119
4146
|
const transformOpenApiSpec = ({ context }) => {
|
|
@@ -4135,7 +4162,6 @@ const transformOpenApiSpec = ({ context }) => {
|
|
|
4135
4162
|
});
|
|
4136
4163
|
eventTransformOpenApiSpec.timeEnd();
|
|
4137
4164
|
};
|
|
4138
|
-
|
|
4139
4165
|
//#endregion
|
|
4140
4166
|
//#region src/openApi/shared/utils/parameter.ts
|
|
4141
4167
|
const mergeParametersObjects = ({ source, target }) => {
|
|
@@ -4165,7 +4191,6 @@ const mergeParametersObjects = ({ source, target }) => {
|
|
|
4165
4191
|
if (!Object.keys(result).length) return;
|
|
4166
4192
|
return result;
|
|
4167
4193
|
};
|
|
4168
|
-
|
|
4169
4194
|
//#endregion
|
|
4170
4195
|
//#region src/openApi/shared/utils/validator.ts
|
|
4171
4196
|
const isSimpleKey = (key) => /^[A-Za-z_$][A-Za-z0-9_$]*$/.test(key);
|
|
@@ -4192,7 +4217,6 @@ const handleValidatorResult = ({ context, result }) => {
|
|
|
4192
4217
|
})) console.log(formatValidatorIssue(issue));
|
|
4193
4218
|
if (!result.valid) process.exit(1);
|
|
4194
4219
|
};
|
|
4195
|
-
|
|
4196
4220
|
//#endregion
|
|
4197
4221
|
//#region src/openApi/2.0.x/parser/filter.ts
|
|
4198
4222
|
/**
|
|
@@ -4226,7 +4250,6 @@ const filterSpec$2 = ({ logger, operations, preserveOrder, schemas, spec }) => {
|
|
|
4226
4250
|
}
|
|
4227
4251
|
eventFilterSpec.timeEnd();
|
|
4228
4252
|
};
|
|
4229
|
-
|
|
4230
4253
|
//#endregion
|
|
4231
4254
|
//#region src/ir/mediaType.ts
|
|
4232
4255
|
const fileLikeRegExp = /^(application\/(pdf|rtf|msword|vnd\.(ms-|openxmlformats-officedocument\.)|zip|x-(7z|tar|rar|zip|iso)|octet-stream|gzip|x-msdownload|json\+download|xml|x-yaml|x-7z-compressed|x-tar)|text\/(yaml|css|javascript)|audio\/(mpeg|wav)|video\/(mp4|x-matroska)|image\/(vnd\.adobe\.photoshop|svg\+xml))(; ?charset=[^;]+)?$/i;
|
|
@@ -4251,7 +4274,6 @@ const mediaTypeToIrMediaType = ({ mediaType }) => {
|
|
|
4251
4274
|
octetStreamMimeRegExp.lastIndex = 0;
|
|
4252
4275
|
if (octetStreamMimeRegExp.test(mediaType)) return "octet-stream";
|
|
4253
4276
|
};
|
|
4254
|
-
|
|
4255
4277
|
//#endregion
|
|
4256
4278
|
//#region src/openApi/2.0.x/parser/mediaType.ts
|
|
4257
4279
|
const contentToSchema$2 = ({ content }) => {
|
|
@@ -4279,14 +4301,12 @@ const mediaTypeObjects$2 = ({ mimeTypes, response }) => {
|
|
|
4279
4301
|
});
|
|
4280
4302
|
return objects;
|
|
4281
4303
|
};
|
|
4282
|
-
|
|
4283
4304
|
//#endregion
|
|
4284
4305
|
//#region src/ir/pagination.ts
|
|
4285
4306
|
function getPaginationKeywordsRegExp(pagination) {
|
|
4286
4307
|
const pattern = `^(${pagination.keywords.join("|")})$`;
|
|
4287
4308
|
return new RegExp(pattern);
|
|
4288
4309
|
}
|
|
4289
|
-
|
|
4290
4310
|
//#endregion
|
|
4291
4311
|
//#region src/openApi/shared/utils/discriminator.ts
|
|
4292
4312
|
/**
|
|
@@ -4353,19 +4373,18 @@ const discriminatorValues = ($ref, mapping, shouldUseRefAsValue) => {
|
|
|
4353
4373
|
if (!values.length && (!shouldUseRefAsValue || shouldUseRefAsValue())) return [refToName($ref)];
|
|
4354
4374
|
return values;
|
|
4355
4375
|
};
|
|
4356
|
-
|
|
4357
4376
|
//#endregion
|
|
4358
4377
|
//#region src/openApi/2.0.x/parser/schema.ts
|
|
4359
|
-
|
|
4378
|
+
function getSchemaType$1({ schema }) {
|
|
4360
4379
|
if (schema.type) return schema.type;
|
|
4361
4380
|
if (schema.properties) return "object";
|
|
4362
|
-
}
|
|
4363
|
-
|
|
4381
|
+
}
|
|
4382
|
+
function parseSchemaJsDoc$2({ irSchema, schema }) {
|
|
4364
4383
|
if (schema.example) irSchema.example = schema.example;
|
|
4365
4384
|
if (schema.description) irSchema.description = schema.description;
|
|
4366
4385
|
if (schema.title) irSchema.title = schema.title;
|
|
4367
|
-
}
|
|
4368
|
-
|
|
4386
|
+
}
|
|
4387
|
+
function parseSchemaMeta$2({ irSchema, schema }) {
|
|
4369
4388
|
if (schema.default !== void 0) irSchema.default = schema.default;
|
|
4370
4389
|
if (schema.exclusiveMaximum) {
|
|
4371
4390
|
if (schema.maximum !== void 0) irSchema.exclusiveMaximum = schema.maximum;
|
|
@@ -4380,8 +4399,8 @@ const parseSchemaMeta$2 = ({ irSchema, schema }) => {
|
|
|
4380
4399
|
if (schema.minLength !== void 0) irSchema.minLength = schema.minLength;
|
|
4381
4400
|
if (schema.pattern) irSchema.pattern = schema.pattern;
|
|
4382
4401
|
if (schema.readOnly) irSchema.accessScope = "read";
|
|
4383
|
-
}
|
|
4384
|
-
|
|
4402
|
+
}
|
|
4403
|
+
function parseArray$2({ context, irSchema = {}, schema, state }) {
|
|
4385
4404
|
if (schema.maxItems && schema.maxItems === schema.minItems) irSchema.type = "tuple";
|
|
4386
4405
|
else irSchema.type = "array";
|
|
4387
4406
|
let schemaItems = [];
|
|
@@ -4407,16 +4426,16 @@ const parseArray$2 = ({ context, irSchema = {}, schema, state }) => {
|
|
|
4407
4426
|
schema: irSchema
|
|
4408
4427
|
});
|
|
4409
4428
|
return irSchema;
|
|
4410
|
-
}
|
|
4411
|
-
|
|
4429
|
+
}
|
|
4430
|
+
function parseBoolean$2({ irSchema = {} }) {
|
|
4412
4431
|
irSchema.type = "boolean";
|
|
4413
4432
|
return irSchema;
|
|
4414
|
-
}
|
|
4415
|
-
|
|
4433
|
+
}
|
|
4434
|
+
function parseNumber$2({ irSchema = {}, schema }) {
|
|
4416
4435
|
irSchema.type = schema.type;
|
|
4417
4436
|
return irSchema;
|
|
4418
|
-
}
|
|
4419
|
-
|
|
4437
|
+
}
|
|
4438
|
+
function parseObject$2({ context, irSchema = {}, schema, state }) {
|
|
4420
4439
|
irSchema.type = "object";
|
|
4421
4440
|
const schemaProperties = {};
|
|
4422
4441
|
for (const name in schema.properties) {
|
|
@@ -4439,15 +4458,15 @@ const parseObject$2 = ({ context, irSchema = {}, schema, state }) => {
|
|
|
4439
4458
|
});
|
|
4440
4459
|
if (schema.required) irSchema.required = schema.required;
|
|
4441
4460
|
return irSchema;
|
|
4442
|
-
}
|
|
4443
|
-
|
|
4461
|
+
}
|
|
4462
|
+
function parseString$2({ irSchema = {} }) {
|
|
4444
4463
|
irSchema.type = "string";
|
|
4445
4464
|
return irSchema;
|
|
4446
|
-
}
|
|
4447
|
-
|
|
4465
|
+
}
|
|
4466
|
+
function parseExtensions$2({ source, target }) {
|
|
4448
4467
|
for (const key in source) if (key.startsWith("x-")) target[key] = source[key];
|
|
4449
|
-
}
|
|
4450
|
-
|
|
4468
|
+
}
|
|
4469
|
+
function initIrSchema$2({ schema }) {
|
|
4451
4470
|
const irSchema = {};
|
|
4452
4471
|
parseSchemaJsDoc$2({
|
|
4453
4472
|
irSchema,
|
|
@@ -4458,8 +4477,8 @@ const initIrSchema$2 = ({ schema }) => {
|
|
|
4458
4477
|
target: irSchema
|
|
4459
4478
|
});
|
|
4460
4479
|
return irSchema;
|
|
4461
|
-
}
|
|
4462
|
-
|
|
4480
|
+
}
|
|
4481
|
+
function parseAllOf$2({ context, schema, state }) {
|
|
4463
4482
|
let irSchema = initIrSchema$2({ schema });
|
|
4464
4483
|
const schemaItems = [];
|
|
4465
4484
|
const schemaType = getSchemaType$1({ schema });
|
|
@@ -4543,9 +4562,13 @@ const parseAllOf$2 = ({ context, schema, state }) => {
|
|
|
4543
4562
|
if (nestedItems[0].description) irSchema.description = nestedItems[0].description;
|
|
4544
4563
|
}
|
|
4545
4564
|
return irSchema;
|
|
4546
|
-
}
|
|
4547
|
-
|
|
4565
|
+
}
|
|
4566
|
+
function parseEnum$2({ context, schema, state }) {
|
|
4548
4567
|
let irSchema = initIrSchema$2({ schema });
|
|
4568
|
+
parseSchemaMeta$2({
|
|
4569
|
+
irSchema,
|
|
4570
|
+
schema
|
|
4571
|
+
});
|
|
4549
4572
|
irSchema.type = "enum";
|
|
4550
4573
|
const schemaItems = [];
|
|
4551
4574
|
for (const [index, enumValue] of schema.enum.entries()) {
|
|
@@ -4576,8 +4599,8 @@ const parseEnum$2 = ({ context, schema, state }) => {
|
|
|
4576
4599
|
schema: irSchema
|
|
4577
4600
|
});
|
|
4578
4601
|
return irSchema;
|
|
4579
|
-
}
|
|
4580
|
-
|
|
4602
|
+
}
|
|
4603
|
+
function parseRef$2({ context, schema, state }) {
|
|
4581
4604
|
const irSchema = {};
|
|
4582
4605
|
if (!isTopLevelComponent(schema.$ref)) {
|
|
4583
4606
|
if (!state.circularReferenceTracker.has(schema.$ref)) {
|
|
@@ -4607,8 +4630,8 @@ const parseRef$2 = ({ context, schema, state }) => {
|
|
|
4607
4630
|
state.$ref = originalRef;
|
|
4608
4631
|
}
|
|
4609
4632
|
return irSchema;
|
|
4610
|
-
}
|
|
4611
|
-
|
|
4633
|
+
}
|
|
4634
|
+
function parseNullableType$1({ context, irSchema, schema, state }) {
|
|
4612
4635
|
if (!irSchema) irSchema = initIrSchema$2({ schema });
|
|
4613
4636
|
const typeIrSchema = {};
|
|
4614
4637
|
parseSchemaMeta$2({
|
|
@@ -4626,8 +4649,8 @@ const parseNullableType$1 = ({ context, irSchema, schema, state }) => {
|
|
|
4626
4649
|
schema: irSchema
|
|
4627
4650
|
});
|
|
4628
4651
|
return irSchema;
|
|
4629
|
-
}
|
|
4630
|
-
|
|
4652
|
+
}
|
|
4653
|
+
function parseType$2({ context, schema, state }) {
|
|
4631
4654
|
const irSchema = initIrSchema$2({ schema });
|
|
4632
4655
|
parseSchemaMeta$2({
|
|
4633
4656
|
irSchema,
|
|
@@ -4653,8 +4676,8 @@ const parseType$2 = ({ context, schema, state }) => {
|
|
|
4653
4676
|
},
|
|
4654
4677
|
state
|
|
4655
4678
|
});
|
|
4656
|
-
}
|
|
4657
|
-
|
|
4679
|
+
}
|
|
4680
|
+
function parseOneType$2({ context, irSchema, schema, state }) {
|
|
4658
4681
|
if (!irSchema) {
|
|
4659
4682
|
irSchema = initIrSchema$2({ schema });
|
|
4660
4683
|
parseSchemaMeta$2({
|
|
@@ -4700,8 +4723,8 @@ const parseOneType$2 = ({ context, irSchema, schema, state }) => {
|
|
|
4700
4723
|
schema
|
|
4701
4724
|
});
|
|
4702
4725
|
}
|
|
4703
|
-
}
|
|
4704
|
-
|
|
4726
|
+
}
|
|
4727
|
+
function parseUnknown$2({ irSchema, schema }) {
|
|
4705
4728
|
if (!irSchema) irSchema = initIrSchema$2({ schema });
|
|
4706
4729
|
irSchema.type = "unknown";
|
|
4707
4730
|
parseSchemaMeta$2({
|
|
@@ -4709,8 +4732,8 @@ const parseUnknown$2 = ({ irSchema, schema }) => {
|
|
|
4709
4732
|
schema
|
|
4710
4733
|
});
|
|
4711
4734
|
return irSchema;
|
|
4712
|
-
}
|
|
4713
|
-
|
|
4735
|
+
}
|
|
4736
|
+
function schemaToIrSchema$2({ context, schema, state }) {
|
|
4714
4737
|
if (!state) state = { circularReferenceTracker: /* @__PURE__ */ new Set() };
|
|
4715
4738
|
if (state.$ref) state.circularReferenceTracker.add(state.$ref);
|
|
4716
4739
|
if (schema.$ref) return parseRef$2({
|
|
@@ -4737,8 +4760,8 @@ const schemaToIrSchema$2 = ({ context, schema, state }) => {
|
|
|
4737
4760
|
context,
|
|
4738
4761
|
schema
|
|
4739
4762
|
});
|
|
4740
|
-
}
|
|
4741
|
-
|
|
4763
|
+
}
|
|
4764
|
+
function parseSchema$2({ $ref, context, schema }) {
|
|
4742
4765
|
if (!context.ir.components) context.ir.components = {};
|
|
4743
4766
|
if (!context.ir.components.schemas) context.ir.components.schemas = {};
|
|
4744
4767
|
context.ir.components.schemas[refToName($ref)] = schemaToIrSchema$2({
|
|
@@ -4749,8 +4772,7 @@ const parseSchema$2 = ({ $ref, context, schema }) => {
|
|
|
4749
4772
|
circularReferenceTracker: /* @__PURE__ */ new Set()
|
|
4750
4773
|
}
|
|
4751
4774
|
});
|
|
4752
|
-
}
|
|
4753
|
-
|
|
4775
|
+
}
|
|
4754
4776
|
//#endregion
|
|
4755
4777
|
//#region src/openApi/2.0.x/parser/pagination.ts
|
|
4756
4778
|
const isPaginationType$2 = (schemaType) => schemaType === "boolean" || schemaType === "integer" || schemaType === "number" || schemaType === "string";
|
|
@@ -4799,7 +4821,6 @@ const paginationField$2 = ({ context, name, schema }) => {
|
|
|
4799
4821
|
}
|
|
4800
4822
|
return false;
|
|
4801
4823
|
};
|
|
4802
|
-
|
|
4803
4824
|
//#endregion
|
|
4804
4825
|
//#region src/openApi/2.0.x/parser/operation.ts
|
|
4805
4826
|
const parseOperationJsDoc$2 = ({ irOperation, operation }) => {
|
|
@@ -5005,7 +5026,6 @@ const parsePathOperation$2 = ({ context, method, operation, path, securityScheme
|
|
|
5005
5026
|
state
|
|
5006
5027
|
});
|
|
5007
5028
|
};
|
|
5008
|
-
|
|
5009
5029
|
//#endregion
|
|
5010
5030
|
//#region src/openApi/2.0.x/parser/parameter.ts
|
|
5011
5031
|
/**
|
|
@@ -5092,7 +5112,6 @@ const parameterToIrParameter$2 = ({ $ref, context, parameter }) => {
|
|
|
5092
5112
|
});
|
|
5093
5113
|
return irParameter;
|
|
5094
5114
|
};
|
|
5095
|
-
|
|
5096
5115
|
//#endregion
|
|
5097
5116
|
//#region src/utils/url.ts
|
|
5098
5117
|
const parseUrlRegExp = /^(([^:/?#]+):)?((\/\/)?([^:/?#]*)(:?([^/?#]*)))?([^?#]*)(\?([^#]*))?(#(.*))?/;
|
|
@@ -5118,7 +5137,6 @@ function parseUrl(value) {
|
|
|
5118
5137
|
protocol
|
|
5119
5138
|
};
|
|
5120
5139
|
}
|
|
5121
|
-
|
|
5122
5140
|
//#endregion
|
|
5123
5141
|
//#region src/openApi/2.0.x/parser/server.ts
|
|
5124
5142
|
const parseServers$2 = ({ context }) => {
|
|
@@ -5136,7 +5154,6 @@ const parseServers$2 = ({ context }) => {
|
|
|
5136
5154
|
const servers = schemes.map((scheme) => `${scheme ? `${scheme}://` : ""}${host}${path}`).filter(Boolean);
|
|
5137
5155
|
if (servers.length) context.ir.servers = servers.map((url) => ({ url }));
|
|
5138
5156
|
};
|
|
5139
|
-
|
|
5140
5157
|
//#endregion
|
|
5141
5158
|
//#region src/openApi/2.0.x/parser/validate.ts
|
|
5142
5159
|
const validateOpenApiSpec$2 = (spec, logger) => {
|
|
@@ -5178,7 +5195,6 @@ const validateOpenApiSpec$2 = (spec, logger) => {
|
|
|
5178
5195
|
valid: !issues.some((issue) => issue.severity === "error")
|
|
5179
5196
|
};
|
|
5180
5197
|
};
|
|
5181
|
-
|
|
5182
5198
|
//#endregion
|
|
5183
5199
|
//#region src/openApi/2.0.x/parser/index.ts
|
|
5184
5200
|
const parseV2_0_X = (context) => {
|
|
@@ -5380,7 +5396,6 @@ const parseV2_0_X = (context) => {
|
|
|
5380
5396
|
}
|
|
5381
5397
|
}
|
|
5382
5398
|
};
|
|
5383
|
-
|
|
5384
5399
|
//#endregion
|
|
5385
5400
|
//#region src/openApi/3.0.x/parser/filter.ts
|
|
5386
5401
|
/**
|
|
@@ -5449,7 +5464,6 @@ const filterSpec$1 = ({ logger, operations, parameters, preserveOrder, requestBo
|
|
|
5449
5464
|
}
|
|
5450
5465
|
eventFilterSpec.timeEnd();
|
|
5451
5466
|
};
|
|
5452
|
-
|
|
5453
5467
|
//#endregion
|
|
5454
5468
|
//#region src/openApi/3.0.x/parser/mediaType.ts
|
|
5455
5469
|
const contentToSchema$1 = ({ content }) => {
|
|
@@ -5477,18 +5491,17 @@ const mediaTypeObjects$1 = ({ content }) => {
|
|
|
5477
5491
|
});
|
|
5478
5492
|
return objects;
|
|
5479
5493
|
};
|
|
5480
|
-
|
|
5481
5494
|
//#endregion
|
|
5482
5495
|
//#region src/openApi/3.0.x/parser/schema.ts
|
|
5483
|
-
|
|
5496
|
+
function getSchemaType({ schema }) {
|
|
5484
5497
|
if (schema.type) return schema.type;
|
|
5485
5498
|
if (schema.properties) return "object";
|
|
5486
|
-
}
|
|
5499
|
+
}
|
|
5487
5500
|
/**
|
|
5488
5501
|
* Finds the type of a discriminator property by looking it up in the provided schemas.
|
|
5489
5502
|
* Searches through properties and allOf chains to find the property definition.
|
|
5490
5503
|
*/
|
|
5491
|
-
|
|
5504
|
+
function findDiscriminatorPropertyType$1({ context, propertyName, schemas }) {
|
|
5492
5505
|
for (const schema of schemas) {
|
|
5493
5506
|
const resolved = "$ref" in schema ? context.resolveRef(schema.$ref) : schema;
|
|
5494
5507
|
const property = resolved.properties?.[propertyName];
|
|
@@ -5506,13 +5519,13 @@ const findDiscriminatorPropertyType$1 = ({ context, propertyName, schemas }) =>
|
|
|
5506
5519
|
}
|
|
5507
5520
|
}
|
|
5508
5521
|
return "string";
|
|
5509
|
-
}
|
|
5522
|
+
}
|
|
5510
5523
|
/**
|
|
5511
5524
|
* Recursively finds discriminators in a schema, including nested allOf compositions.
|
|
5512
5525
|
* This is needed when a schema extends another schema via allOf, and that parent
|
|
5513
5526
|
* schema is itself an allOf composition with discriminators in inline schemas.
|
|
5514
5527
|
*/
|
|
5515
|
-
|
|
5528
|
+
function findDiscriminatorsInSchema$1({ context, discriminators = [], schema }) {
|
|
5516
5529
|
if (schema.discriminator) discriminators.push({
|
|
5517
5530
|
discriminator: schema.discriminator,
|
|
5518
5531
|
oneOf: schema.oneOf
|
|
@@ -5528,23 +5541,23 @@ const findDiscriminatorsInSchema$1 = ({ context, discriminators = [], schema })
|
|
|
5528
5541
|
});
|
|
5529
5542
|
}
|
|
5530
5543
|
return discriminators;
|
|
5531
|
-
}
|
|
5544
|
+
}
|
|
5532
5545
|
/**
|
|
5533
5546
|
* Gets the discriminator value for a schema.
|
|
5534
5547
|
* Returns only the schema's own discriminator value, not child values.
|
|
5535
5548
|
*/
|
|
5536
|
-
|
|
5549
|
+
function getAllDiscriminatorValues$1({ discriminator, schemaRef }) {
|
|
5537
5550
|
const values = [];
|
|
5538
5551
|
for (const [value, mappedSchemaRef] of Object.entries(discriminator.mapping || {})) if (mappedSchemaRef === schemaRef) values.push(value);
|
|
5539
5552
|
return values;
|
|
5540
|
-
}
|
|
5541
|
-
|
|
5553
|
+
}
|
|
5554
|
+
function parseSchemaJsDoc$1({ irSchema, schema }) {
|
|
5542
5555
|
if (schema.deprecated !== void 0) irSchema.deprecated = schema.deprecated;
|
|
5543
5556
|
if (schema.example) irSchema.example = schema.example;
|
|
5544
5557
|
if (schema.description) irSchema.description = schema.description;
|
|
5545
5558
|
if (schema.title) irSchema.title = schema.title;
|
|
5546
|
-
}
|
|
5547
|
-
|
|
5559
|
+
}
|
|
5560
|
+
function parseSchemaMeta$1({ irSchema, schema }) {
|
|
5548
5561
|
if (schema.default !== void 0) irSchema.default = schema.default;
|
|
5549
5562
|
if (schema.exclusiveMaximum) {
|
|
5550
5563
|
if (schema.maximum !== void 0) irSchema.exclusiveMaximum = schema.maximum;
|
|
@@ -5560,8 +5573,8 @@ const parseSchemaMeta$1 = ({ irSchema, schema }) => {
|
|
|
5560
5573
|
if (schema.pattern) irSchema.pattern = schema.pattern;
|
|
5561
5574
|
if (schema.readOnly) irSchema.accessScope = "read";
|
|
5562
5575
|
else if (schema.writeOnly) irSchema.accessScope = "write";
|
|
5563
|
-
}
|
|
5564
|
-
|
|
5576
|
+
}
|
|
5577
|
+
function parseArray$1({ context, irSchema = {}, schema, state }) {
|
|
5565
5578
|
if (schema.maxItems && schema.maxItems === schema.minItems) irSchema.type = "tuple";
|
|
5566
5579
|
else irSchema.type = "array";
|
|
5567
5580
|
let schemaItems = [];
|
|
@@ -5587,16 +5600,16 @@ const parseArray$1 = ({ context, irSchema = {}, schema, state }) => {
|
|
|
5587
5600
|
schema: irSchema
|
|
5588
5601
|
});
|
|
5589
5602
|
return irSchema;
|
|
5590
|
-
}
|
|
5591
|
-
|
|
5603
|
+
}
|
|
5604
|
+
function parseBoolean$1({ irSchema = {} }) {
|
|
5592
5605
|
irSchema.type = "boolean";
|
|
5593
5606
|
return irSchema;
|
|
5594
|
-
}
|
|
5595
|
-
|
|
5607
|
+
}
|
|
5608
|
+
function parseNumber$1({ irSchema = {}, schema }) {
|
|
5596
5609
|
irSchema.type = schema.type;
|
|
5597
5610
|
return irSchema;
|
|
5598
|
-
}
|
|
5599
|
-
|
|
5611
|
+
}
|
|
5612
|
+
function parseObject$1({ context, irSchema = {}, schema, state }) {
|
|
5600
5613
|
irSchema.type = "object";
|
|
5601
5614
|
const schemaProperties = {};
|
|
5602
5615
|
for (const name in schema.properties) {
|
|
@@ -5638,15 +5651,15 @@ const parseObject$1 = ({ context, irSchema = {}, schema, state }) => {
|
|
|
5638
5651
|
}
|
|
5639
5652
|
}
|
|
5640
5653
|
return irSchema;
|
|
5641
|
-
}
|
|
5642
|
-
|
|
5654
|
+
}
|
|
5655
|
+
function parseString$1({ irSchema = {} }) {
|
|
5643
5656
|
irSchema.type = "string";
|
|
5644
5657
|
return irSchema;
|
|
5645
|
-
}
|
|
5646
|
-
|
|
5658
|
+
}
|
|
5659
|
+
function parseExtensions$1({ source, target }) {
|
|
5647
5660
|
for (const key in source) if (key.startsWith("x-")) target[key] = source[key];
|
|
5648
|
-
}
|
|
5649
|
-
|
|
5661
|
+
}
|
|
5662
|
+
function initIrSchema$1({ schema }) {
|
|
5650
5663
|
const irSchema = {};
|
|
5651
5664
|
parseSchemaJsDoc$1({
|
|
5652
5665
|
irSchema,
|
|
@@ -5657,8 +5670,8 @@ const initIrSchema$1 = ({ schema }) => {
|
|
|
5657
5670
|
target: irSchema
|
|
5658
5671
|
});
|
|
5659
5672
|
return irSchema;
|
|
5660
|
-
}
|
|
5661
|
-
|
|
5673
|
+
}
|
|
5674
|
+
function parseAllOf$1({ context, schema, state }) {
|
|
5662
5675
|
let irSchema = initIrSchema$1({ schema });
|
|
5663
5676
|
const schemaItems = [];
|
|
5664
5677
|
const schemaType = getSchemaType({ schema });
|
|
@@ -5807,8 +5820,8 @@ const parseAllOf$1 = ({ context, schema, state }) => {
|
|
|
5807
5820
|
if (nestedItems[0].description) irSchema.description = nestedItems[0].description;
|
|
5808
5821
|
}
|
|
5809
5822
|
return irSchema;
|
|
5810
|
-
}
|
|
5811
|
-
|
|
5823
|
+
}
|
|
5824
|
+
function parseAnyOf$1({ context, schema, state }) {
|
|
5812
5825
|
let irSchema = initIrSchema$1({ schema });
|
|
5813
5826
|
const schemaItems = [];
|
|
5814
5827
|
const schemaType = getSchemaType({ schema });
|
|
@@ -5860,9 +5873,13 @@ const parseAnyOf$1 = ({ context, schema, state }) => {
|
|
|
5860
5873
|
};
|
|
5861
5874
|
}
|
|
5862
5875
|
return irSchema;
|
|
5863
|
-
}
|
|
5864
|
-
|
|
5876
|
+
}
|
|
5877
|
+
function parseEnum$1({ context, schema, state }) {
|
|
5865
5878
|
let irSchema = initIrSchema$1({ schema });
|
|
5879
|
+
parseSchemaMeta$1({
|
|
5880
|
+
irSchema,
|
|
5881
|
+
schema
|
|
5882
|
+
});
|
|
5866
5883
|
irSchema.type = "enum";
|
|
5867
5884
|
const schemaItems = [];
|
|
5868
5885
|
for (const [index, enumValue] of schema.enum.entries()) {
|
|
@@ -5893,8 +5910,8 @@ const parseEnum$1 = ({ context, schema, state }) => {
|
|
|
5893
5910
|
schema: irSchema
|
|
5894
5911
|
});
|
|
5895
5912
|
return irSchema;
|
|
5896
|
-
}
|
|
5897
|
-
|
|
5913
|
+
}
|
|
5914
|
+
function parseOneOf$1({ context, schema, state }) {
|
|
5898
5915
|
let irSchema = initIrSchema$1({ schema });
|
|
5899
5916
|
let schemaItems = [];
|
|
5900
5917
|
const schemaType = getSchemaType({ schema });
|
|
@@ -5948,8 +5965,8 @@ const parseOneOf$1 = ({ context, schema, state }) => {
|
|
|
5948
5965
|
};
|
|
5949
5966
|
}
|
|
5950
5967
|
return irSchema;
|
|
5951
|
-
}
|
|
5952
|
-
|
|
5968
|
+
}
|
|
5969
|
+
function parseRef$1({ context, schema, state }) {
|
|
5953
5970
|
if (!isTopLevelComponent(schema.$ref)) {
|
|
5954
5971
|
if (!state.circularReferenceTracker.has(schema.$ref)) {
|
|
5955
5972
|
const refSchema = context.resolveRef(schema.$ref);
|
|
@@ -5978,8 +5995,8 @@ const parseRef$1 = ({ context, schema, state }) => {
|
|
|
5978
5995
|
state.$ref = originalRef;
|
|
5979
5996
|
}
|
|
5980
5997
|
return irSchema;
|
|
5981
|
-
}
|
|
5982
|
-
|
|
5998
|
+
}
|
|
5999
|
+
function parseNullableType({ context, irSchema, schema, state }) {
|
|
5983
6000
|
if (!irSchema) irSchema = initIrSchema$1({ schema });
|
|
5984
6001
|
const typeIrSchema = {};
|
|
5985
6002
|
parseSchemaMeta$1({
|
|
@@ -5997,8 +6014,8 @@ const parseNullableType = ({ context, irSchema, schema, state }) => {
|
|
|
5997
6014
|
schema: irSchema
|
|
5998
6015
|
});
|
|
5999
6016
|
return irSchema;
|
|
6000
|
-
}
|
|
6001
|
-
|
|
6017
|
+
}
|
|
6018
|
+
function parseType$1({ context, schema, state }) {
|
|
6002
6019
|
const irSchema = initIrSchema$1({ schema });
|
|
6003
6020
|
parseSchemaMeta$1({
|
|
6004
6021
|
irSchema,
|
|
@@ -6024,8 +6041,8 @@ const parseType$1 = ({ context, schema, state }) => {
|
|
|
6024
6041
|
},
|
|
6025
6042
|
state
|
|
6026
6043
|
});
|
|
6027
|
-
}
|
|
6028
|
-
|
|
6044
|
+
}
|
|
6045
|
+
function parseOneType$1({ context, irSchema, schema, state }) {
|
|
6029
6046
|
if (!irSchema) {
|
|
6030
6047
|
irSchema = initIrSchema$1({ schema });
|
|
6031
6048
|
parseSchemaMeta$1({
|
|
@@ -6071,8 +6088,8 @@ const parseOneType$1 = ({ context, irSchema, schema, state }) => {
|
|
|
6071
6088
|
schema
|
|
6072
6089
|
});
|
|
6073
6090
|
}
|
|
6074
|
-
}
|
|
6075
|
-
|
|
6091
|
+
}
|
|
6092
|
+
function parseUnknown$1({ irSchema, schema }) {
|
|
6076
6093
|
if (!irSchema) irSchema = initIrSchema$1({ schema });
|
|
6077
6094
|
irSchema.type = "unknown";
|
|
6078
6095
|
parseSchemaMeta$1({
|
|
@@ -6080,8 +6097,8 @@ const parseUnknown$1 = ({ irSchema, schema }) => {
|
|
|
6080
6097
|
schema
|
|
6081
6098
|
});
|
|
6082
6099
|
return irSchema;
|
|
6083
|
-
}
|
|
6084
|
-
|
|
6100
|
+
}
|
|
6101
|
+
function schemaToIrSchema$1({ context, schema, state }) {
|
|
6085
6102
|
if (!state) state = { circularReferenceTracker: /* @__PURE__ */ new Set() };
|
|
6086
6103
|
if (state.$ref) state.circularReferenceTracker.add(state.$ref);
|
|
6087
6104
|
if ("$ref" in schema) return parseRef$1({
|
|
@@ -6118,8 +6135,8 @@ const schemaToIrSchema$1 = ({ context, schema, state }) => {
|
|
|
6118
6135
|
context,
|
|
6119
6136
|
schema
|
|
6120
6137
|
});
|
|
6121
|
-
}
|
|
6122
|
-
|
|
6138
|
+
}
|
|
6139
|
+
function parseSchema$1({ $ref, context, schema }) {
|
|
6123
6140
|
if (!context.ir.components) context.ir.components = {};
|
|
6124
6141
|
if (!context.ir.components.schemas) context.ir.components.schemas = {};
|
|
6125
6142
|
context.ir.components.schemas[refToName($ref)] = schemaToIrSchema$1({
|
|
@@ -6130,8 +6147,7 @@ const parseSchema$1 = ({ $ref, context, schema }) => {
|
|
|
6130
6147
|
circularReferenceTracker: /* @__PURE__ */ new Set()
|
|
6131
6148
|
}
|
|
6132
6149
|
});
|
|
6133
|
-
}
|
|
6134
|
-
|
|
6150
|
+
}
|
|
6135
6151
|
//#endregion
|
|
6136
6152
|
//#region src/openApi/3.0.x/parser/pagination.ts
|
|
6137
6153
|
const isPaginationType$1 = (schemaType) => schemaType === "boolean" || schemaType === "integer" || schemaType === "number" || schemaType === "string";
|
|
@@ -6176,7 +6192,6 @@ const paginationField$1 = ({ context, name, schema }) => {
|
|
|
6176
6192
|
}
|
|
6177
6193
|
return false;
|
|
6178
6194
|
};
|
|
6179
|
-
|
|
6180
6195
|
//#endregion
|
|
6181
6196
|
//#region src/openApi/3.0.x/parser/operation.ts
|
|
6182
6197
|
const parseOperationJsDoc$1 = ({ irOperation, operation }) => {
|
|
@@ -6302,7 +6317,6 @@ const parsePathOperation$1 = ({ context, method, operation, path, securityScheme
|
|
|
6302
6317
|
state
|
|
6303
6318
|
});
|
|
6304
6319
|
};
|
|
6305
|
-
|
|
6306
6320
|
//#endregion
|
|
6307
6321
|
//#region src/openApi/3.0.x/parser/parameter.ts
|
|
6308
6322
|
/**
|
|
@@ -6406,7 +6420,6 @@ const parseParameter$1 = ({ $ref, context, parameter }) => {
|
|
|
6406
6420
|
parameter
|
|
6407
6421
|
});
|
|
6408
6422
|
};
|
|
6409
|
-
|
|
6410
6423
|
//#endregion
|
|
6411
6424
|
//#region src/openApi/3.0.x/parser/requestBody.ts
|
|
6412
6425
|
const requestBodyToIrRequestBody$1 = ({ $ref, context, requestBody }) => {
|
|
@@ -6437,7 +6450,6 @@ const parseRequestBody$1 = ({ $ref, context, requestBody }) => {
|
|
|
6437
6450
|
requestBody
|
|
6438
6451
|
});
|
|
6439
6452
|
};
|
|
6440
|
-
|
|
6441
6453
|
//#endregion
|
|
6442
6454
|
//#region src/openApi/3.0.x/parser/server.ts
|
|
6443
6455
|
function parseServers$1({ context }) {
|
|
@@ -6451,7 +6463,6 @@ function parseServers$1({ context }) {
|
|
|
6451
6463
|
}
|
|
6452
6464
|
if (!context.ir.servers) context.ir.servers = [{ url: "/" }];
|
|
6453
6465
|
}
|
|
6454
|
-
|
|
6455
6466
|
//#endregion
|
|
6456
6467
|
//#region src/openApi/3.0.x/parser/validate.ts
|
|
6457
6468
|
const validateOpenApiSpec$1 = (spec, logger) => {
|
|
@@ -6520,7 +6531,6 @@ const validateOpenApiSpec$1 = (spec, logger) => {
|
|
|
6520
6531
|
valid: !issues.some((issue) => issue.severity === "error")
|
|
6521
6532
|
};
|
|
6522
6533
|
};
|
|
6523
|
-
|
|
6524
6534
|
//#endregion
|
|
6525
6535
|
//#region src/openApi/3.0.x/parser/index.ts
|
|
6526
6536
|
const parseV3_0_X = (context) => {
|
|
@@ -6726,7 +6736,6 @@ const parseV3_0_X = (context) => {
|
|
|
6726
6736
|
});
|
|
6727
6737
|
}
|
|
6728
6738
|
};
|
|
6729
|
-
|
|
6730
6739
|
//#endregion
|
|
6731
6740
|
//#region src/openApi/3.1.x/parser/filter.ts
|
|
6732
6741
|
/**
|
|
@@ -6795,7 +6804,6 @@ const filterSpec = ({ logger, operations, parameters, preserveOrder, requestBodi
|
|
|
6795
6804
|
}
|
|
6796
6805
|
eventFilterSpec.timeEnd();
|
|
6797
6806
|
};
|
|
6798
|
-
|
|
6799
6807
|
//#endregion
|
|
6800
6808
|
//#region src/openApi/3.1.x/parser/mediaType.ts
|
|
6801
6809
|
const contentToSchema = ({ content }) => {
|
|
@@ -6822,20 +6830,19 @@ const mediaTypeObjects = ({ content }) => {
|
|
|
6822
6830
|
});
|
|
6823
6831
|
return objects;
|
|
6824
6832
|
};
|
|
6825
|
-
|
|
6826
6833
|
//#endregion
|
|
6827
6834
|
//#region src/openApi/3.1.x/parser/schema.ts
|
|
6828
|
-
|
|
6835
|
+
function getSchemaTypes({ schema }) {
|
|
6829
6836
|
if (typeof schema.type === "string") return [schema.type];
|
|
6830
6837
|
if (schema.type) return schema.type;
|
|
6831
6838
|
if (schema.properties) return ["object"];
|
|
6832
6839
|
return [];
|
|
6833
|
-
}
|
|
6840
|
+
}
|
|
6834
6841
|
/**
|
|
6835
6842
|
* Finds the type of a discriminator property by looking it up in the provided schemas.
|
|
6836
6843
|
* Searches through properties and allOf chains to find the property definition.
|
|
6837
6844
|
*/
|
|
6838
|
-
|
|
6845
|
+
function findDiscriminatorPropertyType({ context, propertyName, schemas }) {
|
|
6839
6846
|
for (const schema of schemas) {
|
|
6840
6847
|
const resolved = schema.$ref ? context.resolveRef(schema.$ref) : schema;
|
|
6841
6848
|
const property = resolved.properties?.[propertyName];
|
|
@@ -6855,13 +6862,13 @@ const findDiscriminatorPropertyType = ({ context, propertyName, schemas }) => {
|
|
|
6855
6862
|
}
|
|
6856
6863
|
}
|
|
6857
6864
|
return "string";
|
|
6858
|
-
}
|
|
6865
|
+
}
|
|
6859
6866
|
/**
|
|
6860
6867
|
* Recursively finds discriminators in a schema, including nested allOf compositions.
|
|
6861
6868
|
* This is needed when a schema extends another schema via allOf, and that parent
|
|
6862
6869
|
* schema is itself an allOf composition with discriminators in inline schemas.
|
|
6863
6870
|
*/
|
|
6864
|
-
|
|
6871
|
+
function findDiscriminatorsInSchema({ context, discriminators = [], schema }) {
|
|
6865
6872
|
if (schema.discriminator) discriminators.push({
|
|
6866
6873
|
discriminator: schema.discriminator,
|
|
6867
6874
|
oneOf: schema.oneOf
|
|
@@ -6877,23 +6884,23 @@ const findDiscriminatorsInSchema = ({ context, discriminators = [], schema }) =>
|
|
|
6877
6884
|
});
|
|
6878
6885
|
}
|
|
6879
6886
|
return discriminators;
|
|
6880
|
-
}
|
|
6887
|
+
}
|
|
6881
6888
|
/**
|
|
6882
6889
|
* Gets the discriminator value for a schema.
|
|
6883
6890
|
* Returns only the schema's own discriminator value, not child values.
|
|
6884
6891
|
*/
|
|
6885
|
-
|
|
6892
|
+
function getAllDiscriminatorValues({ discriminator, schemaRef }) {
|
|
6886
6893
|
const values = [];
|
|
6887
6894
|
for (const [value, mappedSchemaRef] of Object.entries(discriminator.mapping || {})) if (mappedSchemaRef === schemaRef) values.push(value);
|
|
6888
6895
|
return values;
|
|
6889
|
-
}
|
|
6890
|
-
|
|
6896
|
+
}
|
|
6897
|
+
function parseSchemaJsDoc({ irSchema, schema }) {
|
|
6891
6898
|
if (schema.deprecated !== void 0) irSchema.deprecated = schema.deprecated;
|
|
6892
6899
|
if (schema.example) irSchema.example = schema.example;
|
|
6893
6900
|
if (schema.description) irSchema.description = schema.description;
|
|
6894
6901
|
if (schema.title) irSchema.title = schema.title;
|
|
6895
|
-
}
|
|
6896
|
-
|
|
6902
|
+
}
|
|
6903
|
+
function parseSchemaMeta({ irSchema, schema }) {
|
|
6897
6904
|
if (schema.const !== void 0) {
|
|
6898
6905
|
irSchema.const = schema.const;
|
|
6899
6906
|
if (!schema.type) if (schema.const === null) irSchema.type = "null";
|
|
@@ -6924,8 +6931,8 @@ const parseSchemaMeta = ({ irSchema, schema }) => {
|
|
|
6924
6931
|
if (schema.pattern) irSchema.pattern = schema.pattern;
|
|
6925
6932
|
if (schema.readOnly) irSchema.accessScope = "read";
|
|
6926
6933
|
else if (schema.writeOnly) irSchema.accessScope = "write";
|
|
6927
|
-
}
|
|
6928
|
-
|
|
6934
|
+
}
|
|
6935
|
+
function parseArray({ context, irSchema = {}, schema, state }) {
|
|
6929
6936
|
if (schema.prefixItems && schema.prefixItems.length || schema.maxItems && schema.maxItems === schema.minItems || schema.const !== void 0) irSchema.type = "tuple";
|
|
6930
6937
|
else irSchema.type = "array";
|
|
6931
6938
|
let schemaItems = [];
|
|
@@ -6958,20 +6965,20 @@ const parseArray = ({ context, irSchema = {}, schema, state }) => {
|
|
|
6958
6965
|
schema: irSchema
|
|
6959
6966
|
});
|
|
6960
6967
|
return irSchema;
|
|
6961
|
-
}
|
|
6962
|
-
|
|
6968
|
+
}
|
|
6969
|
+
function parseBoolean({ irSchema = {} }) {
|
|
6963
6970
|
irSchema.type = "boolean";
|
|
6964
6971
|
return irSchema;
|
|
6965
|
-
}
|
|
6966
|
-
|
|
6972
|
+
}
|
|
6973
|
+
function parseNull({ irSchema = {} }) {
|
|
6967
6974
|
irSchema.type = "null";
|
|
6968
6975
|
return irSchema;
|
|
6969
|
-
}
|
|
6970
|
-
|
|
6976
|
+
}
|
|
6977
|
+
function parseNumber({ irSchema = {}, schema }) {
|
|
6971
6978
|
irSchema.type = schema.type;
|
|
6972
6979
|
return irSchema;
|
|
6973
|
-
}
|
|
6974
|
-
|
|
6980
|
+
}
|
|
6981
|
+
function parseObject({ context, irSchema = {}, schema, state }) {
|
|
6975
6982
|
irSchema.type = "object";
|
|
6976
6983
|
const schemaProperties = {};
|
|
6977
6984
|
for (const name in schema.properties) {
|
|
@@ -7030,15 +7037,15 @@ const parseObject = ({ context, irSchema = {}, schema, state }) => {
|
|
|
7030
7037
|
}
|
|
7031
7038
|
}
|
|
7032
7039
|
return irSchema;
|
|
7033
|
-
}
|
|
7034
|
-
|
|
7040
|
+
}
|
|
7041
|
+
function parseString({ irSchema = {} }) {
|
|
7035
7042
|
irSchema.type = "string";
|
|
7036
7043
|
return irSchema;
|
|
7037
|
-
}
|
|
7038
|
-
|
|
7044
|
+
}
|
|
7045
|
+
function parseExtensions({ source, target }) {
|
|
7039
7046
|
for (const key in source) if (key.startsWith("x-")) target[key] = source[key];
|
|
7040
|
-
}
|
|
7041
|
-
|
|
7047
|
+
}
|
|
7048
|
+
function initIrSchema({ schema }) {
|
|
7042
7049
|
const irSchema = {};
|
|
7043
7050
|
parseSchemaJsDoc({
|
|
7044
7051
|
irSchema,
|
|
@@ -7049,8 +7056,8 @@ const initIrSchema = ({ schema }) => {
|
|
|
7049
7056
|
target: irSchema
|
|
7050
7057
|
});
|
|
7051
7058
|
return irSchema;
|
|
7052
|
-
}
|
|
7053
|
-
|
|
7059
|
+
}
|
|
7060
|
+
function parseAllOf({ context, schema, state }) {
|
|
7054
7061
|
let irSchema = initIrSchema({ schema });
|
|
7055
7062
|
parseSchemaMeta({
|
|
7056
7063
|
irSchema,
|
|
@@ -7201,8 +7208,8 @@ const parseAllOf = ({ context, schema, state }) => {
|
|
|
7201
7208
|
};
|
|
7202
7209
|
}
|
|
7203
7210
|
return irSchema;
|
|
7204
|
-
}
|
|
7205
|
-
|
|
7211
|
+
}
|
|
7212
|
+
function parseAnyOf({ context, schema, state }) {
|
|
7206
7213
|
let irSchema = initIrSchema({ schema });
|
|
7207
7214
|
parseSchemaMeta({
|
|
7208
7215
|
irSchema,
|
|
@@ -7258,9 +7265,13 @@ const parseAnyOf = ({ context, schema, state }) => {
|
|
|
7258
7265
|
};
|
|
7259
7266
|
}
|
|
7260
7267
|
return irSchema;
|
|
7261
|
-
}
|
|
7262
|
-
|
|
7268
|
+
}
|
|
7269
|
+
function parseEnum({ context, schema, state }) {
|
|
7263
7270
|
let irSchema = initIrSchema({ schema });
|
|
7271
|
+
parseSchemaMeta({
|
|
7272
|
+
irSchema,
|
|
7273
|
+
schema
|
|
7274
|
+
});
|
|
7264
7275
|
irSchema.type = "enum";
|
|
7265
7276
|
const schemaItems = [];
|
|
7266
7277
|
const schemaTypes = getSchemaTypes({ schema });
|
|
@@ -7290,8 +7301,8 @@ const parseEnum = ({ context, schema, state }) => {
|
|
|
7290
7301
|
schema: irSchema
|
|
7291
7302
|
});
|
|
7292
7303
|
return irSchema;
|
|
7293
|
-
}
|
|
7294
|
-
|
|
7304
|
+
}
|
|
7305
|
+
function parseOneOf({ context, schema, state }) {
|
|
7295
7306
|
let irSchema = initIrSchema({ schema });
|
|
7296
7307
|
parseSchemaMeta({
|
|
7297
7308
|
irSchema,
|
|
@@ -7349,8 +7360,8 @@ const parseOneOf = ({ context, schema, state }) => {
|
|
|
7349
7360
|
};
|
|
7350
7361
|
}
|
|
7351
7362
|
return irSchema;
|
|
7352
|
-
}
|
|
7353
|
-
|
|
7363
|
+
}
|
|
7364
|
+
function parseRef({ context, schema, state }) {
|
|
7354
7365
|
if (!isTopLevelComponent(schema.$ref)) {
|
|
7355
7366
|
if (!state.circularReferenceTracker.has(schema.$ref)) {
|
|
7356
7367
|
const refSchema = context.resolveRef(schema.$ref);
|
|
@@ -7394,8 +7405,8 @@ const parseRef = ({ context, schema, state }) => {
|
|
|
7394
7405
|
schema: irSchema
|
|
7395
7406
|
});
|
|
7396
7407
|
return irSchema;
|
|
7397
|
-
}
|
|
7398
|
-
|
|
7408
|
+
}
|
|
7409
|
+
function parseOneType({ context, irSchema, schema, state }) {
|
|
7399
7410
|
if (!irSchema) {
|
|
7400
7411
|
irSchema = initIrSchema({ schema });
|
|
7401
7412
|
parseSchemaMeta({
|
|
@@ -7443,8 +7454,8 @@ const parseOneType = ({ context, irSchema, schema, state }) => {
|
|
|
7443
7454
|
schema
|
|
7444
7455
|
});
|
|
7445
7456
|
}
|
|
7446
|
-
}
|
|
7447
|
-
|
|
7457
|
+
}
|
|
7458
|
+
function parseManyTypes({ context, irSchema, schema, state }) {
|
|
7448
7459
|
if (!irSchema) irSchema = initIrSchema({ schema });
|
|
7449
7460
|
const typeIrSchema = {};
|
|
7450
7461
|
parseSchemaMeta({
|
|
@@ -7471,8 +7482,8 @@ const parseManyTypes = ({ context, irSchema, schema, state }) => {
|
|
|
7471
7482
|
schema: irSchema
|
|
7472
7483
|
});
|
|
7473
7484
|
return irSchema;
|
|
7474
|
-
}
|
|
7475
|
-
|
|
7485
|
+
}
|
|
7486
|
+
function parseType({ context, schema, state }) {
|
|
7476
7487
|
const irSchema = initIrSchema({ schema });
|
|
7477
7488
|
parseSchemaMeta({
|
|
7478
7489
|
irSchema,
|
|
@@ -7497,8 +7508,8 @@ const parseType = ({ context, schema, state }) => {
|
|
|
7497
7508
|
},
|
|
7498
7509
|
state
|
|
7499
7510
|
});
|
|
7500
|
-
}
|
|
7501
|
-
|
|
7511
|
+
}
|
|
7512
|
+
function parseUnknown({ irSchema, schema }) {
|
|
7502
7513
|
if (!irSchema) irSchema = initIrSchema({ schema });
|
|
7503
7514
|
irSchema.type = "unknown";
|
|
7504
7515
|
parseSchemaMeta({
|
|
@@ -7506,8 +7517,8 @@ const parseUnknown = ({ irSchema, schema }) => {
|
|
|
7506
7517
|
schema
|
|
7507
7518
|
});
|
|
7508
7519
|
return irSchema;
|
|
7509
|
-
}
|
|
7510
|
-
|
|
7520
|
+
}
|
|
7521
|
+
function schemaToIrSchema({ context, schema, state }) {
|
|
7511
7522
|
if (!state) state = { circularReferenceTracker: /* @__PURE__ */ new Set() };
|
|
7512
7523
|
if (state.$ref) state.circularReferenceTracker.add(state.$ref);
|
|
7513
7524
|
if (schema.$ref) return parseRef({
|
|
@@ -7552,8 +7563,8 @@ const schemaToIrSchema = ({ context, schema, state }) => {
|
|
|
7552
7563
|
context,
|
|
7553
7564
|
schema
|
|
7554
7565
|
});
|
|
7555
|
-
}
|
|
7556
|
-
|
|
7566
|
+
}
|
|
7567
|
+
function parseSchema({ $ref, context, schema }) {
|
|
7557
7568
|
if (!context.ir.components) context.ir.components = {};
|
|
7558
7569
|
if (!context.ir.components.schemas) context.ir.components.schemas = {};
|
|
7559
7570
|
context.ir.components.schemas[refToName($ref)] = schemaToIrSchema({
|
|
@@ -7564,8 +7575,7 @@ const parseSchema = ({ $ref, context, schema }) => {
|
|
|
7564
7575
|
circularReferenceTracker: /* @__PURE__ */ new Set()
|
|
7565
7576
|
}
|
|
7566
7577
|
});
|
|
7567
|
-
}
|
|
7568
|
-
|
|
7578
|
+
}
|
|
7569
7579
|
//#endregion
|
|
7570
7580
|
//#region src/openApi/3.1.x/parser/pagination.ts
|
|
7571
7581
|
const isPaginationType = (schemaTypes) => schemaTypes.includes("boolean") || schemaTypes.includes("integer") || schemaTypes.includes("number") || schemaTypes.includes("string");
|
|
@@ -7617,7 +7627,6 @@ const paginationField = ({ context, name, schema }) => {
|
|
|
7617
7627
|
}
|
|
7618
7628
|
return false;
|
|
7619
7629
|
};
|
|
7620
|
-
|
|
7621
7630
|
//#endregion
|
|
7622
7631
|
//#region src/openApi/3.1.x/parser/operation.ts
|
|
7623
7632
|
const parseOperationJsDoc = ({ irOperation, operation }) => {
|
|
@@ -7754,7 +7763,6 @@ const parseWebhookOperation = ({ context, key, method, ...options }) => {
|
|
|
7754
7763
|
});
|
|
7755
7764
|
context.ir.webhooks[key][method] = parsed;
|
|
7756
7765
|
};
|
|
7757
|
-
|
|
7758
7766
|
//#endregion
|
|
7759
7767
|
//#region src/openApi/3.1.x/parser/parameter.ts
|
|
7760
7768
|
/**
|
|
@@ -7854,7 +7862,6 @@ const parseParameter = ({ $ref, context, parameter }) => {
|
|
|
7854
7862
|
parameter
|
|
7855
7863
|
});
|
|
7856
7864
|
};
|
|
7857
|
-
|
|
7858
7865
|
//#endregion
|
|
7859
7866
|
//#region src/openApi/3.1.x/parser/requestBody.ts
|
|
7860
7867
|
const requestBodyToIrRequestBody = ({ $ref, context, requestBody }) => {
|
|
@@ -7885,7 +7892,6 @@ const parseRequestBody = ({ $ref, context, requestBody }) => {
|
|
|
7885
7892
|
requestBody
|
|
7886
7893
|
});
|
|
7887
7894
|
};
|
|
7888
|
-
|
|
7889
7895
|
//#endregion
|
|
7890
7896
|
//#region src/openApi/3.1.x/parser/server.ts
|
|
7891
7897
|
const parseServers = ({ context }) => {
|
|
@@ -7899,7 +7905,6 @@ const parseServers = ({ context }) => {
|
|
|
7899
7905
|
}
|
|
7900
7906
|
if (!context.ir.servers) context.ir.servers = [{ url: "/" }];
|
|
7901
7907
|
};
|
|
7902
|
-
|
|
7903
7908
|
//#endregion
|
|
7904
7909
|
//#region src/openApi/3.1.x/parser/validate.ts
|
|
7905
7910
|
const validateOpenApiSpec = (spec, logger) => {
|
|
@@ -7968,7 +7973,6 @@ const validateOpenApiSpec = (spec, logger) => {
|
|
|
7968
7973
|
valid: !issues.some((issue) => issue.severity === "error")
|
|
7969
7974
|
};
|
|
7970
7975
|
};
|
|
7971
|
-
|
|
7972
7976
|
//#endregion
|
|
7973
7977
|
//#region src/openApi/3.1.x/parser/webhook.ts
|
|
7974
7978
|
const parseWebhooks = ({ context, securitySchemesMap }) => {
|
|
@@ -8117,7 +8121,6 @@ const parseWebhooks = ({ context, securitySchemesMap }) => {
|
|
|
8117
8121
|
});
|
|
8118
8122
|
}
|
|
8119
8123
|
};
|
|
8120
|
-
|
|
8121
8124
|
//#endregion
|
|
8122
8125
|
//#region src/openApi/3.1.x/parser/index.ts
|
|
8123
8126
|
const parseV3_1_X = (context) => {
|
|
@@ -8327,7 +8330,6 @@ const parseV3_1_X = (context) => {
|
|
|
8327
8330
|
securitySchemesMap
|
|
8328
8331
|
});
|
|
8329
8332
|
};
|
|
8330
|
-
|
|
8331
8333
|
//#endregion
|
|
8332
8334
|
//#region src/openApi/index.ts
|
|
8333
8335
|
/**
|
|
@@ -8350,7 +8352,6 @@ function parseOpenApiSpec(context) {
|
|
|
8350
8352
|
}
|
|
8351
8353
|
throw new Error("Unsupported OpenAPI specification");
|
|
8352
8354
|
}
|
|
8353
|
-
|
|
8354
8355
|
//#endregion
|
|
8355
8356
|
//#region src/openApi/shared/locations/operation.ts
|
|
8356
8357
|
/**
|
|
@@ -8398,7 +8399,6 @@ const OperationPath = {
|
|
|
8398
8399
|
},
|
|
8399
8400
|
id: () => (operation) => [operation.id]
|
|
8400
8401
|
};
|
|
8401
|
-
|
|
8402
8402
|
//#endregion
|
|
8403
8403
|
//#region src/openApi/shared/utils/patch.ts
|
|
8404
8404
|
async function patchOpenApiSpec({ patchOptions, spec: _spec }) {
|
|
@@ -8507,7 +8507,6 @@ async function patchOpenApiSpec({ patchOptions, spec: _spec }) {
|
|
|
8507
8507
|
await patchFn(operation);
|
|
8508
8508
|
}
|
|
8509
8509
|
}
|
|
8510
|
-
|
|
8511
8510
|
//#endregion
|
|
8512
8511
|
//#region src/plugins/shared/utils/config.ts
|
|
8513
8512
|
const definePluginConfig = (defaultConfig) => (userConfig) => ({
|
|
@@ -8525,7 +8524,6 @@ const mappers = {
|
|
|
8525
8524
|
function: (name) => ({ name }),
|
|
8526
8525
|
string: (name) => ({ name })
|
|
8527
8526
|
};
|
|
8528
|
-
|
|
8529
8527
|
//#endregion
|
|
8530
8528
|
//#region src/plugins/symbol.ts
|
|
8531
8529
|
/**
|
|
@@ -8552,7 +8550,6 @@ function buildSymbolIn({ plugin, ...ctx }) {
|
|
|
8552
8550
|
name: ctx.naming ? applyNaming(ctx.name, ctx.naming) : ctx.name
|
|
8553
8551
|
};
|
|
8554
8552
|
}
|
|
8555
|
-
|
|
8556
8553
|
//#endregion
|
|
8557
8554
|
//#region src/plugins/validator.ts
|
|
8558
8555
|
/**
|
|
@@ -8580,13 +8577,11 @@ function resolveValidatorLayer(layers, key, defaultValues) {
|
|
|
8580
8577
|
...override
|
|
8581
8578
|
};
|
|
8582
8579
|
}
|
|
8583
|
-
|
|
8584
8580
|
//#endregion
|
|
8585
8581
|
//#region src/utils/escape.ts
|
|
8586
8582
|
function escapeComment(value) {
|
|
8587
8583
|
return value.replace(/\*\//g, "*").replace(/\/\*/g, "*").replace(/\r?\n(.*)/g, (_l, w) => EOL + w.trim());
|
|
8588
8584
|
}
|
|
8589
|
-
|
|
8590
8585
|
//#endregion
|
|
8591
8586
|
//#region src/utils/exports.ts
|
|
8592
8587
|
/**
|
|
@@ -8598,7 +8593,6 @@ const utils = {
|
|
|
8598
8593
|
},
|
|
8599
8594
|
toCase
|
|
8600
8595
|
};
|
|
8601
|
-
|
|
8602
8596
|
//#endregion
|
|
8603
8597
|
//#region src/utils/header.ts
|
|
8604
8598
|
/**
|
|
@@ -8616,7 +8610,6 @@ function outputHeaderToPrefix(ctx) {
|
|
|
8616
8610
|
const content = lines.join("\n");
|
|
8617
8611
|
return content ? `${content}\n\n` : "";
|
|
8618
8612
|
}
|
|
8619
|
-
|
|
8620
8613
|
//#endregion
|
|
8621
8614
|
//#region src/utils/path.ts
|
|
8622
8615
|
/**
|
|
@@ -8720,7 +8713,7 @@ function pathToName(path, options) {
|
|
|
8720
8713
|
}
|
|
8721
8714
|
return decodeURI(names.join("-"));
|
|
8722
8715
|
}
|
|
8723
|
-
|
|
8724
8716
|
//#endregion
|
|
8725
|
-
export { ConfigError, ConfigValidationError, Context, HeyApiError, IntentContext, JobError, MinHeap, OperationPath, OperationStrategy, PluginInstance, addItemsToSchema, applyNaming, buildGraph, buildSymbolIn, checkNodeVersion, childContext, compileInputPath, createOperationKey, createSchemaProcessor, createSchemaWalker, debugTools, deduplicateSchema, defaultPaginationKeywords, definePluginConfig, dependencyFactory, encodeJsonPointerSegment, ensureDirSync, escapeComment, findPackageJson, findTsConfigPath, getInput, getLogs, getParser, getSpec, hasOperationDataRequired, hasParameterGroupObjectRequired, hasParametersObjectRequired, heyApiRegistryBaseUrl, inputToApiRegistry, isEnvironment, isTopLevelComponent, jsonPointerToPath, loadPackageJson, logCrashReport, logInputPaths, mappers, normalizeJsonPointer, openGitHubIssueWithCrashReport, operationPagination, operationResponsesMap, outputHeaderToPrefix, parameterWithPagination, parseOpenApiSpec, parseUrl, parseV2_0_X, parseV3_0_X, parseV3_1_X, patchOpenApiSpec, pathToJsonPointer, pathToName, postprocessOutput, printCliIntro, printCrashReport, refToName, requestValidatorLayers, resolveNaming, resolveRef, resolveSource, resolveValidatorLayer, satisfies, shouldReportCrash, statusCodeToGroup, toCase, utils, valueToObject };
|
|
8717
|
+
export { ConfigError, ConfigValidationError, Context, HeyApiError, InputError, IntentContext, JobError, MinHeap, OperationPath, OperationStrategy, PluginInstance, addItemsToSchema, applyNaming, buildGraph, buildSymbolIn, checkNodeVersion, childContext, compileInputPath, createOperationKey, createSchemaProcessor, createSchemaWalker, debugTools, deduplicateSchema, defaultPaginationKeywords, definePluginConfig, dependencyFactory, encodeJsonPointerSegment, ensureDirSync, escapeComment, findPackageJson, findTsConfigPath, getInput, getInputError, getLogs, getParser, getSpec, hasOperationDataRequired, hasParameterGroupObjectRequired, hasParametersObjectRequired, heyApiRegistryBaseUrl, inputToApiRegistry, isEnvironment, isTopLevelComponent, jsonPointerToPath, loadPackageJson, logCrashReport, logInputPaths, mappers, normalizeJsonPointer, openGitHubIssueWithCrashReport, operationPagination, operationResponsesMap, outputHeaderToPrefix, parameterWithPagination, parseOpenApiSpec, parseUrl, parseV2_0_X, parseV3_0_X, parseV3_1_X, patchOpenApiSpec, pathToJsonPointer, pathToName, postprocessOutput, printCliIntro, printCrashReport, refToName, requestValidatorLayers, resolveNaming, resolveRef, resolveSource, resolveValidatorLayer, satisfies, shouldReportCrash, statusCodeToGroup, toCase, utils, valueToObject };
|
|
8718
|
+
|
|
8726
8719
|
//# sourceMappingURL=index.mjs.map
|