serverless-openapi-documenter 0.0.80 → 0.0.81
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/package.json +6 -6
- package/src/schemaHandler.js +21 -11
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "serverless-openapi-documenter",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.81",
|
|
4
4
|
"description": "Generate OpenAPI v3 documentation and Postman Collections from your Serverless Config",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"keywords": [
|
|
@@ -40,10 +40,10 @@
|
|
|
40
40
|
"@apidevtools/json-schema-ref-parser": "^9.1.0",
|
|
41
41
|
"chalk": "^4.1.2",
|
|
42
42
|
"js-yaml": "^4.1.0",
|
|
43
|
-
"json-schema-for-openapi": "^0.
|
|
43
|
+
"json-schema-for-openapi": "^0.4.1",
|
|
44
44
|
"lodash.isequal": "^4.5.0",
|
|
45
45
|
"oas-validator": "^5.0.8",
|
|
46
|
-
"openapi-to-postmanv2": "^4.
|
|
46
|
+
"openapi-to-postmanv2": "^4.17.0",
|
|
47
47
|
"swagger2openapi": "^7.0.8",
|
|
48
48
|
"uuid": "^9.0.0"
|
|
49
49
|
},
|
|
@@ -51,9 +51,9 @@
|
|
|
51
51
|
"node": ">=14"
|
|
52
52
|
},
|
|
53
53
|
"devDependencies": {
|
|
54
|
-
"chai": "^4.3.
|
|
54
|
+
"chai": "^4.3.8",
|
|
55
55
|
"mocha": "^10.2.0",
|
|
56
|
-
"nock": "^13.3.
|
|
57
|
-
"sinon": "^
|
|
56
|
+
"nock": "^13.3.3",
|
|
57
|
+
"sinon": "^16.0.0"
|
|
58
58
|
}
|
|
59
59
|
}
|
package/src/schemaHandler.js
CHANGED
|
@@ -68,17 +68,10 @@ class SchemaHandler {
|
|
|
68
68
|
).catch((err) => {
|
|
69
69
|
if (err.errors) {
|
|
70
70
|
for (const error of err?.errors) {
|
|
71
|
-
|
|
72
|
-
// throw err;
|
|
73
|
-
throw new Error(
|
|
74
|
-
`There was an error dereferencing ${
|
|
75
|
-
model.name
|
|
76
|
-
} schema. \n\n dereferencing message: ${
|
|
77
|
-
error.message
|
|
78
|
-
} \n\n Model received: ${JSON.stringify(model)}`
|
|
79
|
-
);
|
|
80
|
-
}
|
|
71
|
+
this.__HTTPError(error);
|
|
81
72
|
}
|
|
73
|
+
} else {
|
|
74
|
+
this.__HTTPError(err);
|
|
82
75
|
}
|
|
83
76
|
return modelSchema;
|
|
84
77
|
});
|
|
@@ -108,7 +101,11 @@ class SchemaHandler {
|
|
|
108
101
|
throw new Error(
|
|
109
102
|
`There was an error converting the ${
|
|
110
103
|
model.name
|
|
111
|
-
} schema. Model received looks like: \n\n${JSON.stringify(
|
|
104
|
+
} schema. Model received looks like: \n\n${JSON.stringify(
|
|
105
|
+
model
|
|
106
|
+
)}. The convereted schema looks like \n\n${JSON.stringify(
|
|
107
|
+
convertedSchemas
|
|
108
|
+
)}`
|
|
112
109
|
);
|
|
113
110
|
}
|
|
114
111
|
}
|
|
@@ -230,6 +227,19 @@ class SchemaHandler {
|
|
|
230
227
|
Object.assign(this.openAPI, components);
|
|
231
228
|
}
|
|
232
229
|
}
|
|
230
|
+
|
|
231
|
+
__HTTPError(error) {
|
|
232
|
+
if (error.message.includes("HTTP ERROR")) {
|
|
233
|
+
// throw err;
|
|
234
|
+
throw new Error(
|
|
235
|
+
`There was an error dereferencing ${
|
|
236
|
+
model.name
|
|
237
|
+
} schema. \n\n dereferencing message: ${
|
|
238
|
+
error.message
|
|
239
|
+
} \n\n Model received: ${JSON.stringify(model)}`
|
|
240
|
+
);
|
|
241
|
+
}
|
|
242
|
+
}
|
|
233
243
|
}
|
|
234
244
|
|
|
235
245
|
module.exports = SchemaHandler;
|