docusaurus-plugin-openapi-docs 0.0.0-1130 → 0.0.0-1151
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.
|
@@ -104,7 +104,7 @@ async function resolveJsonRefs(specUrlOrObject) {
|
|
|
104
104
|
}
|
|
105
105
|
}
|
|
106
106
|
async function loadAndResolveSpec(specUrlOrObject) {
|
|
107
|
-
const config =
|
|
107
|
+
const config = await (0, openapi_core_1.createConfig)({});
|
|
108
108
|
const bundleOpts = {
|
|
109
109
|
config,
|
|
110
110
|
base: process.cwd(),
|
|
@@ -121,9 +121,10 @@ async function loadAndResolveSpec(specUrlOrObject) {
|
|
|
121
121
|
// Force dereference ?
|
|
122
122
|
// bundleOpts["dereference"] = true;
|
|
123
123
|
const { bundle: { parsed }, } = await (0, openapi_core_1.bundle)(bundleOpts);
|
|
124
|
+
const parsedSpec = parsed;
|
|
124
125
|
//Pre-processing before resolving JSON refs
|
|
125
|
-
if (
|
|
126
|
-
for (let [component, type] of Object.entries(
|
|
126
|
+
if (parsedSpec.components) {
|
|
127
|
+
for (let [component, type] of Object.entries(parsedSpec.components)) {
|
|
127
128
|
if (component === "schemas") {
|
|
128
129
|
for (let [schemaKey, schemaValue] of Object.entries(type)) {
|
|
129
130
|
const title = schemaValue["title"];
|
|
@@ -134,7 +135,7 @@ async function loadAndResolveSpec(specUrlOrObject) {
|
|
|
134
135
|
}
|
|
135
136
|
}
|
|
136
137
|
}
|
|
137
|
-
const resolved = await resolveJsonRefs(
|
|
138
|
+
const resolved = await resolveJsonRefs(parsedSpec);
|
|
138
139
|
// Force serialization and replace circular $ref pointers
|
|
139
140
|
// @ts-ignore
|
|
140
141
|
const serialized = JSON.stringify(resolved, serializer());
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "docusaurus-plugin-openapi-docs",
|
|
3
3
|
"description": "OpenAPI plugin for Docusaurus.",
|
|
4
|
-
"version": "0.0.0-
|
|
4
|
+
"version": "0.0.0-1151",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"keywords": [
|
|
7
7
|
"openapi",
|
|
@@ -40,10 +40,10 @@
|
|
|
40
40
|
"eslint-plugin-prettier": "^5.5.1"
|
|
41
41
|
},
|
|
42
42
|
"dependencies": {
|
|
43
|
-
"@apidevtools/json-schema-ref-parser": "^
|
|
44
|
-
"@redocly/openapi-core": "^
|
|
43
|
+
"@apidevtools/json-schema-ref-parser": "^15.3.3",
|
|
44
|
+
"@redocly/openapi-core": "^2.25.2",
|
|
45
45
|
"allof-merge": "^0.6.6",
|
|
46
|
-
"chalk": "^
|
|
46
|
+
"chalk": "^5.6.2",
|
|
47
47
|
"clsx": "^2.1.1",
|
|
48
48
|
"fs-extra": "^11.3.0",
|
|
49
49
|
"json-pointer": "^0.6.2",
|
|
@@ -65,5 +65,5 @@
|
|
|
65
65
|
"engines": {
|
|
66
66
|
"node": ">=14"
|
|
67
67
|
},
|
|
68
|
-
"gitHead": "
|
|
68
|
+
"gitHead": "ce9f21391974edb2ad7a1a7c2e39700a27bc5123"
|
|
69
69
|
}
|
|
@@ -6,9 +6,8 @@
|
|
|
6
6
|
* ========================================================================== */
|
|
7
7
|
|
|
8
8
|
import $RefParser from "@apidevtools/json-schema-ref-parser";
|
|
9
|
-
import { bundle,
|
|
9
|
+
import { bundle, createConfig } from "@redocly/openapi-core";
|
|
10
10
|
import type { Source, Document } from "@redocly/openapi-core";
|
|
11
|
-
import { ResolvedConfig } from "@redocly/openapi-core/lib/config";
|
|
12
11
|
import chalk from "chalk";
|
|
13
12
|
// @ts-ignore
|
|
14
13
|
import { convertObj } from "swagger2openapi";
|
|
@@ -116,7 +115,7 @@ async function resolveJsonRefs(specUrlOrObject: object | string) {
|
|
|
116
115
|
}
|
|
117
116
|
|
|
118
117
|
export async function loadAndResolveSpec(specUrlOrObject: object | string) {
|
|
119
|
-
const config =
|
|
118
|
+
const config = await createConfig({});
|
|
120
119
|
const bundleOpts = {
|
|
121
120
|
config,
|
|
122
121
|
base: process.cwd(),
|
|
@@ -137,10 +136,13 @@ export async function loadAndResolveSpec(specUrlOrObject: object | string) {
|
|
|
137
136
|
const {
|
|
138
137
|
bundle: { parsed },
|
|
139
138
|
} = await bundle(bundleOpts);
|
|
139
|
+
const parsedSpec = parsed as any;
|
|
140
140
|
|
|
141
141
|
//Pre-processing before resolving JSON refs
|
|
142
|
-
if (
|
|
143
|
-
for (let [component, type] of Object.entries(
|
|
142
|
+
if (parsedSpec.components) {
|
|
143
|
+
for (let [component, type] of Object.entries(
|
|
144
|
+
parsedSpec.components
|
|
145
|
+
) as any) {
|
|
144
146
|
if (component === "schemas") {
|
|
145
147
|
for (let [schemaKey, schemaValue] of Object.entries(type) as any) {
|
|
146
148
|
const title: string | undefined = schemaValue["title"];
|
|
@@ -152,7 +154,7 @@ export async function loadAndResolveSpec(specUrlOrObject: object | string) {
|
|
|
152
154
|
}
|
|
153
155
|
}
|
|
154
156
|
|
|
155
|
-
const resolved = await resolveJsonRefs(
|
|
157
|
+
const resolved = await resolveJsonRefs(parsedSpec);
|
|
156
158
|
|
|
157
159
|
// Force serialization and replace circular $ref pointers
|
|
158
160
|
// @ts-ignore
|