docusaurus-plugin-openapi-docs 0.0.0-1047 → 0.0.0-1050
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/lib/openapi/openapi.js +7 -2
- package/package.json +2 -2
- package/src/openapi/openapi.ts +8 -2
package/lib/openapi/openapi.js
CHANGED
|
@@ -65,11 +65,16 @@ const loadAndResolveSpec_1 = require("./utils/loadAndResolveSpec");
|
|
|
65
65
|
*/
|
|
66
66
|
function jsonToCollection(data) {
|
|
67
67
|
return new Promise((resolve, reject) => {
|
|
68
|
+
var _a, _b;
|
|
68
69
|
let schemaPack = new openapi_to_postmanv2_1.default.SchemaPack({ type: "json", data }, { schemaFaker: false });
|
|
69
70
|
schemaPack.computedOptions.schemaFaker = false;
|
|
71
|
+
// Make sure the schema was properly validated or reject with error
|
|
72
|
+
if (!((_a = schemaPack.validationResult) === null || _a === void 0 ? void 0 : _a.result)) {
|
|
73
|
+
return reject((_b = schemaPack.validationResult) === null || _b === void 0 ? void 0 : _b.reason);
|
|
74
|
+
}
|
|
70
75
|
schemaPack.convert((_err, conversionResult) => {
|
|
71
|
-
if (!conversionResult.result) {
|
|
72
|
-
return reject(conversionResult.reason);
|
|
76
|
+
if (_err || !conversionResult.result) {
|
|
77
|
+
return reject(_err || conversionResult.reason);
|
|
73
78
|
}
|
|
74
79
|
return resolve(new sdk.Collection(conversionResult.output[0].data));
|
|
75
80
|
});
|
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-1050",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"keywords": [
|
|
7
7
|
"openapi",
|
|
@@ -65,5 +65,5 @@
|
|
|
65
65
|
"engines": {
|
|
66
66
|
"node": ">=14"
|
|
67
67
|
},
|
|
68
|
-
"gitHead": "
|
|
68
|
+
"gitHead": "33f10237ae33c3b720cc8003de8502d48cbdb2fb"
|
|
69
69
|
}
|
package/src/openapi/openapi.ts
CHANGED
|
@@ -43,9 +43,15 @@ function jsonToCollection(data: OpenApiObject): Promise<Collection> {
|
|
|
43
43
|
{ schemaFaker: false }
|
|
44
44
|
);
|
|
45
45
|
schemaPack.computedOptions.schemaFaker = false;
|
|
46
|
+
|
|
47
|
+
// Make sure the schema was properly validated or reject with error
|
|
48
|
+
if (!schemaPack.validationResult?.result) {
|
|
49
|
+
return reject(schemaPack.validationResult?.reason);
|
|
50
|
+
}
|
|
51
|
+
|
|
46
52
|
schemaPack.convert((_err: any, conversionResult: any) => {
|
|
47
|
-
if (!conversionResult.result) {
|
|
48
|
-
return reject(conversionResult.reason);
|
|
53
|
+
if (_err || !conversionResult.result) {
|
|
54
|
+
return reject(_err || conversionResult.reason);
|
|
49
55
|
}
|
|
50
56
|
return resolve(new sdk.Collection(conversionResult.output[0].data));
|
|
51
57
|
});
|