spice-js 2.7.34 → 2.7.35
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/build/docs/generator.js
CHANGED
|
@@ -222,11 +222,16 @@ function _getModels() {
|
|
|
222
222
|
var models = {};
|
|
223
223
|
require("fs").readdirSync(paths).forEach(function (file) {
|
|
224
224
|
var model = require(_path2.default.join(paths, file));
|
|
225
|
-
//
|
|
226
|
-
|
|
227
|
-
|
|
225
|
+
// `props` is a named export; the default export is the SpiceModel class,
|
|
226
|
+
// which does not carry it. Unwrapping to the default export first drops
|
|
227
|
+
// the schema off every model and leaves Swagger with empty definitions,
|
|
228
|
+
// so read the named export and only fall back to the default export for
|
|
229
|
+
// models that attach props there instead.
|
|
230
|
+
var props = model.props;
|
|
231
|
+
if (props == undefined && model.default != undefined) {
|
|
232
|
+
props = model.default.props;
|
|
228
233
|
}
|
|
229
|
-
models[file.split(".")[0]] =
|
|
234
|
+
models[file.split(".")[0]] = props;
|
|
230
235
|
});
|
|
231
236
|
return models;
|
|
232
237
|
});
|
|
@@ -36,7 +36,9 @@ class RestHelper {
|
|
|
36
36
|
ctx.status = 200;
|
|
37
37
|
ctx.body = response;
|
|
38
38
|
} catch (e) {
|
|
39
|
-
console.
|
|
39
|
+
console.error("Error at response: ", e, e == null ? void 0 : e.stack);
|
|
40
|
+
ctx.status = 500;
|
|
41
|
+
ctx.body = RestHelper.prepare_response(RestHelper.FAILURE, (e == null ? void 0 : e.message) || e);
|
|
40
42
|
}
|
|
41
43
|
})();
|
|
42
44
|
}
|
package/package.json
CHANGED
package/src/docs/generator.js
CHANGED
|
@@ -244,11 +244,16 @@ async function getModels() {
|
|
|
244
244
|
.readdirSync(paths)
|
|
245
245
|
.forEach(function (file) {
|
|
246
246
|
let model = require(path.join(paths, file));
|
|
247
|
-
//
|
|
248
|
-
|
|
249
|
-
|
|
247
|
+
// `props` is a named export; the default export is the SpiceModel class,
|
|
248
|
+
// which does not carry it. Unwrapping to the default export first drops
|
|
249
|
+
// the schema off every model and leaves Swagger with empty definitions,
|
|
250
|
+
// so read the named export and only fall back to the default export for
|
|
251
|
+
// models that attach props there instead.
|
|
252
|
+
let props = model.props;
|
|
253
|
+
if (props == undefined && model.default != undefined) {
|
|
254
|
+
props = model.default.props;
|
|
250
255
|
}
|
|
251
|
-
models[file.split(".")[0]] =
|
|
256
|
+
models[file.split(".")[0]] = props;
|
|
252
257
|
});
|
|
253
258
|
return models;
|
|
254
259
|
}
|
|
@@ -30,7 +30,12 @@ export default class RestHelper {
|
|
|
30
30
|
ctx.status = 200;
|
|
31
31
|
ctx.body = response;
|
|
32
32
|
} catch (e) {
|
|
33
|
-
console.
|
|
33
|
+
console.error("Error at response: ", e, e?.stack);
|
|
34
|
+
ctx.status = 500;
|
|
35
|
+
ctx.body = RestHelper.prepare_response(
|
|
36
|
+
RestHelper.FAILURE,
|
|
37
|
+
e?.message || e,
|
|
38
|
+
);
|
|
34
39
|
}
|
|
35
40
|
}
|
|
36
41
|
|