@depup/openapi-typescript 7.13.0-depup.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/CHANGELOG.md +1162 -0
- package/CONTRIBUTING.md +149 -0
- package/LICENSE +21 -0
- package/README.md +32 -0
- package/bin/cli.js +297 -0
- package/changes.json +14 -0
- package/dist/index.cjs +152 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +517 -0
- package/dist/index.d.mts +515 -0
- package/dist/index.d.ts +517 -0
- package/dist/index.mjs +85 -0
- package/dist/index.mjs.map +1 -0
- package/dist/lib/redoc.cjs +129 -0
- package/dist/lib/redoc.cjs.map +1 -0
- package/dist/lib/redoc.mjs +122 -0
- package/dist/lib/redoc.mjs.map +1 -0
- package/dist/lib/ts.cjs +470 -0
- package/dist/lib/ts.cjs.map +1 -0
- package/dist/lib/ts.mjs +431 -0
- package/dist/lib/ts.mjs.map +1 -0
- package/dist/lib/utils.cjs +295 -0
- package/dist/lib/utils.cjs.map +1 -0
- package/dist/lib/utils.mjs +278 -0
- package/dist/lib/utils.mjs.map +1 -0
- package/dist/transform/components-object.cjs +150 -0
- package/dist/transform/components-object.cjs.map +1 -0
- package/dist/transform/components-object.mjs +127 -0
- package/dist/transform/components-object.mjs.map +1 -0
- package/dist/transform/header-object.cjs +48 -0
- package/dist/transform/header-object.cjs.map +1 -0
- package/dist/transform/header-object.mjs +42 -0
- package/dist/transform/header-object.mjs.map +1 -0
- package/dist/transform/index.cjs +124 -0
- package/dist/transform/index.cjs.map +1 -0
- package/dist/transform/index.mjs +118 -0
- package/dist/transform/index.mjs.map +1 -0
- package/dist/transform/media-type-object.cjs +14 -0
- package/dist/transform/media-type-object.cjs.map +1 -0
- package/dist/transform/media-type-object.mjs +12 -0
- package/dist/transform/media-type-object.mjs.map +1 -0
- package/dist/transform/operation-object.cjs +105 -0
- package/dist/transform/operation-object.cjs.map +1 -0
- package/dist/transform/operation-object.mjs +96 -0
- package/dist/transform/operation-object.mjs.map +1 -0
- package/dist/transform/parameter-object.cjs +11 -0
- package/dist/transform/parameter-object.cjs.map +1 -0
- package/dist/transform/parameter-object.mjs +9 -0
- package/dist/transform/parameter-object.mjs.map +1 -0
- package/dist/transform/parameters-array.cjs +120 -0
- package/dist/transform/parameters-array.cjs.map +1 -0
- package/dist/transform/parameters-array.mjs +114 -0
- package/dist/transform/parameters-array.mjs.map +1 -0
- package/dist/transform/path-item-object.cjs +84 -0
- package/dist/transform/path-item-object.cjs.map +1 -0
- package/dist/transform/path-item-object.mjs +78 -0
- package/dist/transform/path-item-object.mjs.map +1 -0
- package/dist/transform/paths-enum.cjs +35 -0
- package/dist/transform/paths-enum.cjs.map +1 -0
- package/dist/transform/paths-enum.mjs +33 -0
- package/dist/transform/paths-enum.mjs.map +1 -0
- package/dist/transform/paths-object.cjs +134 -0
- package/dist/transform/paths-object.cjs.map +1 -0
- package/dist/transform/paths-object.mjs +128 -0
- package/dist/transform/paths-object.mjs.map +1 -0
- package/dist/transform/request-body-object.cjs +68 -0
- package/dist/transform/request-body-object.cjs.map +1 -0
- package/dist/transform/request-body-object.mjs +62 -0
- package/dist/transform/request-body-object.mjs.map +1 -0
- package/dist/transform/response-object.cjs +123 -0
- package/dist/transform/response-object.cjs.map +1 -0
- package/dist/transform/response-object.mjs +117 -0
- package/dist/transform/response-object.mjs.map +1 -0
- package/dist/transform/responses-object.cjs +36 -0
- package/dist/transform/responses-object.cjs.map +1 -0
- package/dist/transform/responses-object.mjs +30 -0
- package/dist/transform/responses-object.mjs.map +1 -0
- package/dist/transform/schema-object.cjs +502 -0
- package/dist/transform/schema-object.cjs.map +1 -0
- package/dist/transform/schema-object.mjs +493 -0
- package/dist/transform/schema-object.mjs.map +1 -0
- package/dist/transform/webhooks-object.cjs +37 -0
- package/dist/transform/webhooks-object.cjs.map +1 -0
- package/dist/transform/webhooks-object.mjs +31 -0
- package/dist/transform/webhooks-object.mjs.map +1 -0
- package/package.json +102 -0
- package/src/index.ts +108 -0
- package/src/lib/redoc.ts +164 -0
- package/src/lib/ts.ts +616 -0
- package/src/lib/utils.ts +394 -0
- package/src/transform/components-object.ts +161 -0
- package/src/transform/header-object.ts +45 -0
- package/src/transform/index.ts +116 -0
- package/src/transform/media-type-object.ts +18 -0
- package/src/transform/operation-object.ts +104 -0
- package/src/transform/parameter-object.ts +15 -0
- package/src/transform/parameters-array.ts +129 -0
- package/src/transform/path-item-object.ts +102 -0
- package/src/transform/paths-enum.ts +43 -0
- package/src/transform/paths-object.ts +134 -0
- package/src/transform/request-body-object.ts +59 -0
- package/src/transform/response-object.ts +112 -0
- package/src/transform/responses-object.ts +36 -0
- package/src/transform/schema-object.ts +737 -0
- package/src/transform/webhooks-object.ts +27 -0
- package/src/types.ts +735 -0
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const node_perf_hooks = require('node:perf_hooks');
|
|
4
|
+
const node_stream = require('node:stream');
|
|
5
|
+
const node_url = require('node:url');
|
|
6
|
+
const openapiCore = require('@redocly/openapi-core');
|
|
7
|
+
const parseJson = require('parse-json');
|
|
8
|
+
const utils = require('./utils.cjs');
|
|
9
|
+
|
|
10
|
+
function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e.default : e; }
|
|
11
|
+
|
|
12
|
+
const parseJson__default = /*#__PURE__*/_interopDefaultCompat(parseJson);
|
|
13
|
+
|
|
14
|
+
async function parseSchema(schema, { absoluteRef, resolver }) {
|
|
15
|
+
if (!schema) {
|
|
16
|
+
throw new Error("Can\u2019t parse empty schema");
|
|
17
|
+
}
|
|
18
|
+
if (schema instanceof URL) {
|
|
19
|
+
const result = await resolver.resolveDocument(null, absoluteRef, true);
|
|
20
|
+
if ("parsed" in result) {
|
|
21
|
+
return result;
|
|
22
|
+
}
|
|
23
|
+
throw result.originalError;
|
|
24
|
+
}
|
|
25
|
+
if (schema instanceof node_stream.Readable) {
|
|
26
|
+
const contents = await new Promise((resolve) => {
|
|
27
|
+
schema.resume();
|
|
28
|
+
schema.setEncoding("utf8");
|
|
29
|
+
let content = "";
|
|
30
|
+
schema.on("data", (chunk) => {
|
|
31
|
+
content += chunk;
|
|
32
|
+
});
|
|
33
|
+
schema.on("end", () => {
|
|
34
|
+
resolve(content.trim());
|
|
35
|
+
});
|
|
36
|
+
});
|
|
37
|
+
return parseSchema(contents, { absoluteRef, resolver });
|
|
38
|
+
}
|
|
39
|
+
if (schema instanceof Buffer) {
|
|
40
|
+
return parseSchema(schema.toString("utf8"), { absoluteRef, resolver });
|
|
41
|
+
}
|
|
42
|
+
if (typeof schema === "string") {
|
|
43
|
+
if (schema.startsWith("http://") || schema.startsWith("https://") || schema.startsWith("file://")) {
|
|
44
|
+
const url = new URL(schema);
|
|
45
|
+
return parseSchema(url, {
|
|
46
|
+
absoluteRef: url.protocol === "file:" ? node_url.fileURLToPath(url) : url.href,
|
|
47
|
+
resolver
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
if (schema[0] === "{") {
|
|
51
|
+
return {
|
|
52
|
+
source: new openapiCore.Source(absoluteRef, schema, "application/json"),
|
|
53
|
+
parsed: parseJson__default(schema)
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
return openapiCore.makeDocumentFromString(schema, absoluteRef);
|
|
57
|
+
}
|
|
58
|
+
if (typeof schema === "object" && !Array.isArray(schema)) {
|
|
59
|
+
return {
|
|
60
|
+
source: new openapiCore.Source(absoluteRef, JSON.stringify(schema), "application/json"),
|
|
61
|
+
parsed: schema
|
|
62
|
+
};
|
|
63
|
+
}
|
|
64
|
+
throw new Error(`Expected string, object, or Buffer. Got ${Array.isArray(schema) ? "Array" : typeof schema}`);
|
|
65
|
+
}
|
|
66
|
+
function _processProblems(problems, options) {
|
|
67
|
+
if (problems.length) {
|
|
68
|
+
let errorMessage;
|
|
69
|
+
for (const problem of problems) {
|
|
70
|
+
const problemLocation = problem.location?.[0].pointer;
|
|
71
|
+
const problemMessage = problemLocation ? `${problem.message} at ${problemLocation}` : problem.message;
|
|
72
|
+
if (problem.severity === "error") {
|
|
73
|
+
errorMessage = problemMessage;
|
|
74
|
+
utils.error(problemMessage);
|
|
75
|
+
} else {
|
|
76
|
+
utils.warn(problemMessage, options.silent);
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
if (errorMessage) {
|
|
80
|
+
throw new Error(errorMessage);
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
async function validateAndBundle(source, options) {
|
|
85
|
+
const redocConfigT = node_perf_hooks.performance.now();
|
|
86
|
+
utils.debug("Loaded Redoc config", "redoc", node_perf_hooks.performance.now() - redocConfigT);
|
|
87
|
+
const redocParseT = node_perf_hooks.performance.now();
|
|
88
|
+
let absoluteRef = node_url.fileURLToPath(new URL(options?.cwd ?? `file://${process.cwd()}/`));
|
|
89
|
+
if (source instanceof URL) {
|
|
90
|
+
absoluteRef = source.protocol === "file:" ? node_url.fileURLToPath(source) : source.href;
|
|
91
|
+
}
|
|
92
|
+
const resolver = new openapiCore.BaseResolver(options.redoc.resolve);
|
|
93
|
+
const document = await parseSchema(source, {
|
|
94
|
+
absoluteRef,
|
|
95
|
+
resolver
|
|
96
|
+
});
|
|
97
|
+
utils.debug("Parsed schema", "redoc", node_perf_hooks.performance.now() - redocParseT);
|
|
98
|
+
const openapiVersion = Number.parseFloat(document.parsed.openapi);
|
|
99
|
+
if (document.parsed.swagger || !document.parsed.openapi || Number.isNaN(openapiVersion) || openapiVersion < 3 || openapiVersion >= 4) {
|
|
100
|
+
if (document.parsed.swagger) {
|
|
101
|
+
throw new Error("Unsupported Swagger version: 2.x. Use OpenAPI 3.x instead.");
|
|
102
|
+
}
|
|
103
|
+
if (document.parsed.openapi || openapiVersion < 3 || openapiVersion >= 4) {
|
|
104
|
+
throw new Error(`Unsupported OpenAPI version: ${document.parsed.openapi}`);
|
|
105
|
+
}
|
|
106
|
+
throw new Error("Unsupported schema format, expected `openapi: 3.x`");
|
|
107
|
+
}
|
|
108
|
+
const redocLintT = node_perf_hooks.performance.now();
|
|
109
|
+
const problems = await openapiCore.lintDocument({
|
|
110
|
+
document,
|
|
111
|
+
config: options.redoc.styleguide,
|
|
112
|
+
externalRefResolver: resolver
|
|
113
|
+
});
|
|
114
|
+
_processProblems(problems, options);
|
|
115
|
+
utils.debug("Linted schema", "lint", node_perf_hooks.performance.now() - redocLintT);
|
|
116
|
+
const redocBundleT = node_perf_hooks.performance.now();
|
|
117
|
+
const bundled = await openapiCore.bundle({
|
|
118
|
+
config: options.redoc,
|
|
119
|
+
dereference: false,
|
|
120
|
+
doc: document
|
|
121
|
+
});
|
|
122
|
+
_processProblems(bundled.problems, options);
|
|
123
|
+
utils.debug("Bundled schema", "bundle", node_perf_hooks.performance.now() - redocBundleT);
|
|
124
|
+
return bundled.bundle.parsed;
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
exports.parseSchema = parseSchema;
|
|
128
|
+
exports.validateAndBundle = validateAndBundle;
|
|
129
|
+
//# sourceMappingURL=redoc.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"redoc.cjs","sources":["../../src/lib/redoc.ts"],"sourcesContent":["import { performance } from \"node:perf_hooks\";\nimport { Readable } from \"node:stream\";\nimport { fileURLToPath } from \"node:url\";\nimport {\n BaseResolver,\n bundle,\n type Document,\n lintDocument,\n makeDocumentFromString,\n type NormalizedProblem,\n type Config as RedoclyConfig,\n Source,\n} from \"@redocly/openapi-core\";\nimport parseJson from \"parse-json\";\nimport type { OpenAPI3 } from \"../types.js\";\nimport { debug, error, warn } from \"./utils.js\";\n\nexport interface ValidateAndBundleOptions {\n redoc: RedoclyConfig;\n silent: boolean;\n cwd?: URL;\n}\n\ninterface ParseSchemaOptions {\n absoluteRef: string;\n resolver: BaseResolver;\n}\n\nexport async function parseSchema(schema: unknown, { absoluteRef, resolver }: ParseSchemaOptions): Promise<Document> {\n if (!schema) {\n throw new Error(\"Can’t parse empty schema\");\n }\n if (schema instanceof URL) {\n const result = await resolver.resolveDocument(null, absoluteRef, true);\n if (\"parsed\" in result) {\n return result;\n }\n throw result.originalError;\n }\n if (schema instanceof Readable) {\n const contents = await new Promise<string>((resolve) => {\n schema.resume();\n schema.setEncoding(\"utf8\");\n let content = \"\";\n schema.on(\"data\", (chunk: string) => {\n content += chunk;\n });\n schema.on(\"end\", () => {\n resolve(content.trim());\n });\n });\n return parseSchema(contents, { absoluteRef, resolver });\n }\n if (schema instanceof Buffer) {\n return parseSchema(schema.toString(\"utf8\"), { absoluteRef, resolver });\n }\n if (typeof schema === \"string\") {\n // URL\n if (schema.startsWith(\"http://\") || schema.startsWith(\"https://\") || schema.startsWith(\"file://\")) {\n const url = new URL(schema);\n return parseSchema(url, {\n absoluteRef: url.protocol === \"file:\" ? fileURLToPath(url) : url.href,\n resolver,\n });\n }\n // JSON\n if (schema[0] === \"{\") {\n return {\n source: new Source(absoluteRef, schema, \"application/json\"),\n parsed: parseJson(schema),\n };\n }\n // YAML\n return makeDocumentFromString(schema, absoluteRef);\n }\n if (typeof schema === \"object\" && !Array.isArray(schema)) {\n return {\n source: new Source(absoluteRef, JSON.stringify(schema), \"application/json\"),\n parsed: schema,\n };\n }\n throw new Error(`Expected string, object, or Buffer. Got ${Array.isArray(schema) ? \"Array\" : typeof schema}`);\n}\n\nfunction _processProblems(problems: NormalizedProblem[], options: { silent: boolean }) {\n if (problems.length) {\n let errorMessage: string | undefined;\n for (const problem of problems) {\n const problemLocation = problem.location?.[0].pointer;\n const problemMessage = problemLocation ? `${problem.message} at ${problemLocation}` : problem.message;\n if (problem.severity === \"error\") {\n errorMessage = problemMessage;\n error(problemMessage);\n } else {\n warn(problemMessage, options.silent);\n }\n }\n if (errorMessage) {\n throw new Error(errorMessage);\n }\n }\n}\n\n/**\n * Validate an OpenAPI schema and flatten into a single schema using Redocly CLI\n */\nexport async function validateAndBundle(\n source: string | URL | OpenAPI3 | Readable | Buffer,\n options: ValidateAndBundleOptions,\n) {\n const redocConfigT = performance.now();\n debug(\"Loaded Redoc config\", \"redoc\", performance.now() - redocConfigT);\n const redocParseT = performance.now();\n let absoluteRef = fileURLToPath(new URL(options?.cwd ?? `file://${process.cwd()}/`));\n if (source instanceof URL) {\n absoluteRef = source.protocol === \"file:\" ? fileURLToPath(source) : source.href;\n }\n const resolver = new BaseResolver(options.redoc.resolve);\n const document = await parseSchema(source, {\n absoluteRef,\n resolver,\n });\n debug(\"Parsed schema\", \"redoc\", performance.now() - redocParseT);\n\n // 1. check for OpenAPI 3 or greater\n const openapiVersion = Number.parseFloat(document.parsed.openapi);\n if (\n document.parsed.swagger ||\n !document.parsed.openapi ||\n Number.isNaN(openapiVersion) ||\n openapiVersion < 3 ||\n openapiVersion >= 4\n ) {\n if (document.parsed.swagger) {\n throw new Error(\"Unsupported Swagger version: 2.x. Use OpenAPI 3.x instead.\");\n }\n if (document.parsed.openapi || openapiVersion < 3 || openapiVersion >= 4) {\n throw new Error(`Unsupported OpenAPI version: ${document.parsed.openapi}`);\n }\n throw new Error(\"Unsupported schema format, expected `openapi: 3.x`\");\n }\n\n // 2. lint\n const redocLintT = performance.now();\n const problems = await lintDocument({\n document,\n config: options.redoc.styleguide,\n externalRefResolver: resolver,\n });\n _processProblems(problems, options);\n debug(\"Linted schema\", \"lint\", performance.now() - redocLintT);\n\n // 3. bundle\n const redocBundleT = performance.now();\n const bundled = await bundle({\n config: options.redoc,\n dereference: false,\n doc: document,\n });\n _processProblems(bundled.problems, options);\n debug(\"Bundled schema\", \"bundle\", performance.now() - redocBundleT);\n\n return bundled.bundle.parsed;\n}\n"],"names":["Readable","fileURLToPath","Source","parseJson","makeDocumentFromString","error","warn","performance","debug","BaseResolver","lintDocument","bundle"],"mappings":";;;;;;;;;;;;;AA4BA,eAAsB,WAAA,CAAY,MAAA,EAAiB,EAAE,WAAA,EAAa,UAAS,EAA0C;AACnH,EAAA,IAAI,CAAC,MAAA,EAAQ;AACX,IAAA,MAAM,IAAI,MAAM,+BAA0B,CAAA;AA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A,OAAO,QAAQ,MAAA,CAAO,MAAA;AACxB;;;;;"}
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
import { performance } from 'node:perf_hooks';
|
|
2
|
+
import { Readable } from 'node:stream';
|
|
3
|
+
import { fileURLToPath } from 'node:url';
|
|
4
|
+
import { BaseResolver, lintDocument, bundle, Source, makeDocumentFromString } from '@redocly/openapi-core';
|
|
5
|
+
import parseJson from 'parse-json';
|
|
6
|
+
import { debug, error, warn } from './utils.mjs';
|
|
7
|
+
|
|
8
|
+
async function parseSchema(schema, { absoluteRef, resolver }) {
|
|
9
|
+
if (!schema) {
|
|
10
|
+
throw new Error("Can\u2019t parse empty schema");
|
|
11
|
+
}
|
|
12
|
+
if (schema instanceof URL) {
|
|
13
|
+
const result = await resolver.resolveDocument(null, absoluteRef, true);
|
|
14
|
+
if ("parsed" in result) {
|
|
15
|
+
return result;
|
|
16
|
+
}
|
|
17
|
+
throw result.originalError;
|
|
18
|
+
}
|
|
19
|
+
if (schema instanceof Readable) {
|
|
20
|
+
const contents = await new Promise((resolve) => {
|
|
21
|
+
schema.resume();
|
|
22
|
+
schema.setEncoding("utf8");
|
|
23
|
+
let content = "";
|
|
24
|
+
schema.on("data", (chunk) => {
|
|
25
|
+
content += chunk;
|
|
26
|
+
});
|
|
27
|
+
schema.on("end", () => {
|
|
28
|
+
resolve(content.trim());
|
|
29
|
+
});
|
|
30
|
+
});
|
|
31
|
+
return parseSchema(contents, { absoluteRef, resolver });
|
|
32
|
+
}
|
|
33
|
+
if (schema instanceof Buffer) {
|
|
34
|
+
return parseSchema(schema.toString("utf8"), { absoluteRef, resolver });
|
|
35
|
+
}
|
|
36
|
+
if (typeof schema === "string") {
|
|
37
|
+
if (schema.startsWith("http://") || schema.startsWith("https://") || schema.startsWith("file://")) {
|
|
38
|
+
const url = new URL(schema);
|
|
39
|
+
return parseSchema(url, {
|
|
40
|
+
absoluteRef: url.protocol === "file:" ? fileURLToPath(url) : url.href,
|
|
41
|
+
resolver
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
if (schema[0] === "{") {
|
|
45
|
+
return {
|
|
46
|
+
source: new Source(absoluteRef, schema, "application/json"),
|
|
47
|
+
parsed: parseJson(schema)
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
return makeDocumentFromString(schema, absoluteRef);
|
|
51
|
+
}
|
|
52
|
+
if (typeof schema === "object" && !Array.isArray(schema)) {
|
|
53
|
+
return {
|
|
54
|
+
source: new Source(absoluteRef, JSON.stringify(schema), "application/json"),
|
|
55
|
+
parsed: schema
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
throw new Error(`Expected string, object, or Buffer. Got ${Array.isArray(schema) ? "Array" : typeof schema}`);
|
|
59
|
+
}
|
|
60
|
+
function _processProblems(problems, options) {
|
|
61
|
+
if (problems.length) {
|
|
62
|
+
let errorMessage;
|
|
63
|
+
for (const problem of problems) {
|
|
64
|
+
const problemLocation = problem.location?.[0].pointer;
|
|
65
|
+
const problemMessage = problemLocation ? `${problem.message} at ${problemLocation}` : problem.message;
|
|
66
|
+
if (problem.severity === "error") {
|
|
67
|
+
errorMessage = problemMessage;
|
|
68
|
+
error(problemMessage);
|
|
69
|
+
} else {
|
|
70
|
+
warn(problemMessage, options.silent);
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
if (errorMessage) {
|
|
74
|
+
throw new Error(errorMessage);
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
async function validateAndBundle(source, options) {
|
|
79
|
+
const redocConfigT = performance.now();
|
|
80
|
+
debug("Loaded Redoc config", "redoc", performance.now() - redocConfigT);
|
|
81
|
+
const redocParseT = performance.now();
|
|
82
|
+
let absoluteRef = fileURLToPath(new URL(options?.cwd ?? `file://${process.cwd()}/`));
|
|
83
|
+
if (source instanceof URL) {
|
|
84
|
+
absoluteRef = source.protocol === "file:" ? fileURLToPath(source) : source.href;
|
|
85
|
+
}
|
|
86
|
+
const resolver = new BaseResolver(options.redoc.resolve);
|
|
87
|
+
const document = await parseSchema(source, {
|
|
88
|
+
absoluteRef,
|
|
89
|
+
resolver
|
|
90
|
+
});
|
|
91
|
+
debug("Parsed schema", "redoc", performance.now() - redocParseT);
|
|
92
|
+
const openapiVersion = Number.parseFloat(document.parsed.openapi);
|
|
93
|
+
if (document.parsed.swagger || !document.parsed.openapi || Number.isNaN(openapiVersion) || openapiVersion < 3 || openapiVersion >= 4) {
|
|
94
|
+
if (document.parsed.swagger) {
|
|
95
|
+
throw new Error("Unsupported Swagger version: 2.x. Use OpenAPI 3.x instead.");
|
|
96
|
+
}
|
|
97
|
+
if (document.parsed.openapi || openapiVersion < 3 || openapiVersion >= 4) {
|
|
98
|
+
throw new Error(`Unsupported OpenAPI version: ${document.parsed.openapi}`);
|
|
99
|
+
}
|
|
100
|
+
throw new Error("Unsupported schema format, expected `openapi: 3.x`");
|
|
101
|
+
}
|
|
102
|
+
const redocLintT = performance.now();
|
|
103
|
+
const problems = await lintDocument({
|
|
104
|
+
document,
|
|
105
|
+
config: options.redoc.styleguide,
|
|
106
|
+
externalRefResolver: resolver
|
|
107
|
+
});
|
|
108
|
+
_processProblems(problems, options);
|
|
109
|
+
debug("Linted schema", "lint", performance.now() - redocLintT);
|
|
110
|
+
const redocBundleT = performance.now();
|
|
111
|
+
const bundled = await bundle({
|
|
112
|
+
config: options.redoc,
|
|
113
|
+
dereference: false,
|
|
114
|
+
doc: document
|
|
115
|
+
});
|
|
116
|
+
_processProblems(bundled.problems, options);
|
|
117
|
+
debug("Bundled schema", "bundle", performance.now() - redocBundleT);
|
|
118
|
+
return bundled.bundle.parsed;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
export { parseSchema, validateAndBundle };
|
|
122
|
+
//# sourceMappingURL=redoc.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"redoc.mjs","sources":["../../src/lib/redoc.ts"],"sourcesContent":["import { performance } from \"node:perf_hooks\";\nimport { Readable } from \"node:stream\";\nimport { fileURLToPath } from \"node:url\";\nimport {\n BaseResolver,\n bundle,\n type Document,\n lintDocument,\n makeDocumentFromString,\n type NormalizedProblem,\n type Config as RedoclyConfig,\n Source,\n} from \"@redocly/openapi-core\";\nimport parseJson from \"parse-json\";\nimport type { OpenAPI3 } from \"../types.js\";\nimport { debug, error, warn } from \"./utils.js\";\n\nexport interface ValidateAndBundleOptions {\n redoc: RedoclyConfig;\n silent: boolean;\n cwd?: URL;\n}\n\ninterface ParseSchemaOptions {\n absoluteRef: string;\n resolver: BaseResolver;\n}\n\nexport async function parseSchema(schema: unknown, { absoluteRef, resolver }: ParseSchemaOptions): Promise<Document> {\n if (!schema) {\n throw new Error(\"Can’t parse empty schema\");\n }\n if (schema instanceof URL) {\n const result = await resolver.resolveDocument(null, absoluteRef, true);\n if (\"parsed\" in result) {\n return result;\n }\n throw result.originalError;\n }\n if (schema instanceof Readable) {\n const contents = await new Promise<string>((resolve) => {\n schema.resume();\n schema.setEncoding(\"utf8\");\n let content = \"\";\n schema.on(\"data\", (chunk: string) => {\n content += chunk;\n });\n schema.on(\"end\", () => {\n resolve(content.trim());\n });\n });\n return parseSchema(contents, { absoluteRef, resolver });\n }\n if (schema instanceof Buffer) {\n return parseSchema(schema.toString(\"utf8\"), { absoluteRef, resolver });\n }\n if (typeof schema === \"string\") {\n // URL\n if (schema.startsWith(\"http://\") || schema.startsWith(\"https://\") || schema.startsWith(\"file://\")) {\n const url = new URL(schema);\n return parseSchema(url, {\n absoluteRef: url.protocol === \"file:\" ? fileURLToPath(url) : url.href,\n resolver,\n });\n }\n // JSON\n if (schema[0] === \"{\") {\n return {\n source: new Source(absoluteRef, schema, \"application/json\"),\n parsed: parseJson(schema),\n };\n }\n // YAML\n return makeDocumentFromString(schema, absoluteRef);\n }\n if (typeof schema === \"object\" && !Array.isArray(schema)) {\n return {\n source: new Source(absoluteRef, JSON.stringify(schema), \"application/json\"),\n parsed: schema,\n };\n }\n throw new Error(`Expected string, object, or Buffer. Got ${Array.isArray(schema) ? \"Array\" : typeof schema}`);\n}\n\nfunction _processProblems(problems: NormalizedProblem[], options: { silent: boolean }) {\n if (problems.length) {\n let errorMessage: string | undefined;\n for (const problem of problems) {\n const problemLocation = problem.location?.[0].pointer;\n const problemMessage = problemLocation ? `${problem.message} at ${problemLocation}` : problem.message;\n if (problem.severity === \"error\") {\n errorMessage = problemMessage;\n error(problemMessage);\n } else {\n warn(problemMessage, options.silent);\n }\n }\n if (errorMessage) {\n throw new Error(errorMessage);\n }\n }\n}\n\n/**\n * Validate an OpenAPI schema and flatten into a single schema using Redocly CLI\n */\nexport async function validateAndBundle(\n source: string | URL | OpenAPI3 | Readable | Buffer,\n options: ValidateAndBundleOptions,\n) {\n const redocConfigT = performance.now();\n debug(\"Loaded Redoc config\", \"redoc\", performance.now() - redocConfigT);\n const redocParseT = performance.now();\n let absoluteRef = fileURLToPath(new URL(options?.cwd ?? `file://${process.cwd()}/`));\n if (source instanceof URL) {\n absoluteRef = source.protocol === \"file:\" ? fileURLToPath(source) : source.href;\n }\n const resolver = new BaseResolver(options.redoc.resolve);\n const document = await parseSchema(source, {\n absoluteRef,\n resolver,\n });\n debug(\"Parsed schema\", \"redoc\", performance.now() - redocParseT);\n\n // 1. check for OpenAPI 3 or greater\n const openapiVersion = Number.parseFloat(document.parsed.openapi);\n if (\n document.parsed.swagger ||\n !document.parsed.openapi ||\n Number.isNaN(openapiVersion) ||\n openapiVersion < 3 ||\n openapiVersion >= 4\n ) {\n if (document.parsed.swagger) {\n throw new Error(\"Unsupported Swagger version: 2.x. Use OpenAPI 3.x instead.\");\n }\n if (document.parsed.openapi || openapiVersion < 3 || openapiVersion >= 4) {\n throw new Error(`Unsupported OpenAPI version: ${document.parsed.openapi}`);\n }\n throw new Error(\"Unsupported schema format, expected `openapi: 3.x`\");\n }\n\n // 2. lint\n const redocLintT = performance.now();\n const problems = await lintDocument({\n document,\n config: options.redoc.styleguide,\n externalRefResolver: resolver,\n });\n _processProblems(problems, options);\n debug(\"Linted schema\", \"lint\", performance.now() - redocLintT);\n\n // 3. bundle\n const redocBundleT = performance.now();\n const bundled = await bundle({\n config: options.redoc,\n dereference: false,\n doc: document,\n });\n _processProblems(bundled.problems, options);\n debug(\"Bundled schema\", \"bundle\", performance.now() - redocBundleT);\n\n return bundled.bundle.parsed;\n}\n"],"names":[],"mappings":";;;;;;;AA4BA,eAAsB,WAAA,CAAY,MAAA,EAAiB,EAAE,WAAA,EAAa,UAAS,EAA0C;AACnH,EAAA,IAAI,CAAC,MAAA,EAAQ;AACX,IAAA,MAAM,IAAI,MAAM,+BAA0B,CAAA;AAAA,EAC5C;AACA,EAAA,IAAI,kBAAkB,GAAA,EAAK;AACzB,IAAA,MAAM,SAAS,MAAM,QAAA,CAAS,eAAA,CAAgB,IAAA,EAAM,aAAa,IAAI,CAAA;AACrE,IAAA,IAAI,YAAY,MAAA,EAAQ;AACtB,MAAA,OAAO,MAAA;AAAA,IACT;AACA,IAAA,MAAM,MAAA,CAAO,aAAA;AAAA,EACf;AACA,EAAA,IAAI,kBAAkB,QAAA,EAAU;AAC9B,IAAA,MAAM,QAAA,GAAW,MAAM,IAAI,OAAA,CAAgB,CAAC,OAAA,KAAY;AACtD,MAAA,MAAA,CAAO,MAAA,EAAO;AACd,MAAA,MAAA,CAAO,YAAY,MAAM,CAAA;AACzB,MAAA,IAAI,OAAA,GAAU,EAAA;AACd,MAAA,MAAA,CAAO,EAAA,CAAG,MAAA,EAAQ,CAAC,KAAA,KAAkB;AACnC,QAAA,OAAA,IAAW,KAAA;AAAA,MACb,CAAC,CAAA;AACD,MAAA,MAAA,CAAO,EAAA,CAAG,OAAO,MAAM;AACrB,QAAA,OAAA,CAAQ,OAAA,CAAQ,MAAM,CAAA;AAAA,MACxB,CAAC,CAAA;AAAA,IACH,CAAC,CAAA;AACD,IAAA,OAAO,WAAA,CAAY,QAAA,EAAU,EAAE,WAAA,EAAa,UAAU,CAAA;AAAA,EACxD;AACA,EAAA,IAAI,kBAAkB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