serverless-openapi-documenter 0.0.92 → 0.0.93
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 +1 -1
- package/src/definitionGenerator.js +27 -4
package/package.json
CHANGED
|
@@ -154,10 +154,16 @@ class DefinitionGenerator {
|
|
|
154
154
|
Object.assign(info, { license: licenseObj });
|
|
155
155
|
}
|
|
156
156
|
|
|
157
|
-
for (const key of Object.keys(documentation)) {
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
157
|
+
// for (const key of Object.keys(documentation)) {
|
|
158
|
+
// if (/^[x\-]/i.test(key)) {
|
|
159
|
+
// Object.assign(info, { [key]: documentation[key] });
|
|
160
|
+
// }
|
|
161
|
+
// }
|
|
162
|
+
|
|
163
|
+
const extendedSpec = this.extendSpecification(documentation);
|
|
164
|
+
|
|
165
|
+
if (Object.keys(extendedSpec).length) {
|
|
166
|
+
Object.assign(info, extendedSpec);
|
|
161
167
|
}
|
|
162
168
|
|
|
163
169
|
Object.assign(this.openAPI, { info });
|
|
@@ -419,6 +425,12 @@ class DefinitionGenerator {
|
|
|
419
425
|
obj.servers = servers;
|
|
420
426
|
}
|
|
421
427
|
|
|
428
|
+
const extendedSpec = this.extendSpecification(documentation);
|
|
429
|
+
|
|
430
|
+
if (Object.keys(extendedSpec).length) {
|
|
431
|
+
Object.assign(obj, extendedSpec);
|
|
432
|
+
}
|
|
433
|
+
|
|
422
434
|
return { [method.toLowerCase()]: obj };
|
|
423
435
|
}
|
|
424
436
|
|
|
@@ -937,6 +949,17 @@ class DefinitionGenerator {
|
|
|
937
949
|
}
|
|
938
950
|
}
|
|
939
951
|
|
|
952
|
+
extendSpecification(spec) {
|
|
953
|
+
const obj = {};
|
|
954
|
+
for (const key of Object.keys(spec)) {
|
|
955
|
+
if (/^[x\-]/i.test(key)) {
|
|
956
|
+
Object.assign(obj, { [key]: spec[key] });
|
|
957
|
+
}
|
|
958
|
+
}
|
|
959
|
+
|
|
960
|
+
return obj;
|
|
961
|
+
}
|
|
962
|
+
|
|
940
963
|
getHTTPFunctions() {
|
|
941
964
|
const isHttpFunction = (funcType) => {
|
|
942
965
|
const keys = Object.keys(funcType);
|