openapi-ts-generator 5.287.2 → 5.341.4
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.
|
@@ -32,7 +32,7 @@ var BarrelGenerator = /** @class */ (function (_super) {
|
|
|
32
32
|
var _this = this;
|
|
33
33
|
var fileNames = (0, fs_1.readdirSync)(this.generatorOptions.outputPath).map(function (value) { return value.replace(_this.tsRegex, ''); });
|
|
34
34
|
fileNames = fileNames.filter(function (x) { return x !== 'endpoints'; });
|
|
35
|
-
return _super.prototype.generateFile.call(this, "".concat(this.generatorOptions.outputPath, "/index.ts"), { fileNames: fileNames });
|
|
35
|
+
return _super.prototype.generateFile.call(this, "".concat(this.generatorOptions.outputPath, "/index.ts"), fileNames.length ? { fileNames: fileNames } : null);
|
|
36
36
|
};
|
|
37
37
|
return BarrelGenerator;
|
|
38
38
|
}(base_generator_1.BaseGenerator));
|
|
@@ -6,5 +6,5 @@ export declare abstract class BaseGenerator<TContextSchema> {
|
|
|
6
6
|
readonly template?: HandlebarsTemplateDelegate<TContextSchema>;
|
|
7
7
|
readonly emptyArrayRegex: RegExp;
|
|
8
8
|
constructor(generatorOptions: IGeneratorOptions, templateFilePath: string | undefined);
|
|
9
|
-
protected generateFile(outputFilePath: string, context: TContextSchema): string | null;
|
|
9
|
+
protected generateFile(outputFilePath: string, context: TContextSchema | null): string | null;
|
|
10
10
|
}
|
|
@@ -14,25 +14,28 @@ var BaseGenerator = /** @class */ (function () {
|
|
|
14
14
|
}
|
|
15
15
|
}
|
|
16
16
|
BaseGenerator.prototype.generateFile = function (outputFilePath, context) {
|
|
17
|
-
var _a, _b, _c, _d, _e, _f, _g;
|
|
18
|
-
if (this.template) {
|
|
17
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
18
|
+
if (!this.template) {
|
|
19
|
+
(_a = this.generatorOptions.logger) === null || _a === void 0 ? void 0 : _a.warn("Template for ".concat(this.GeneratorName, " has not been specified."));
|
|
20
|
+
}
|
|
21
|
+
else if (!context) {
|
|
22
|
+
(_b = this.generatorOptions.logger) === null || _b === void 0 ? void 0 : _b.warn("Context for ".concat(this.GeneratorName, " has not been provided."));
|
|
23
|
+
}
|
|
24
|
+
else {
|
|
19
25
|
try {
|
|
20
26
|
var content = this.template(context).replace(this.emptyArrayRegex, ']');
|
|
21
27
|
(0, fs_1.writeFileSync)(outputFilePath, content, { encoding: 'utf8' });
|
|
22
28
|
return content;
|
|
23
29
|
}
|
|
24
30
|
catch (err) {
|
|
25
|
-
(
|
|
26
|
-
(
|
|
27
|
-
(
|
|
28
|
-
(
|
|
29
|
-
(
|
|
31
|
+
(_c = this.generatorOptions.logger) === null || _c === void 0 ? void 0 : _c.error("Error executing template: ".concat((_d = this.templateFilePath) !== null && _d !== void 0 ? _d : 'undefined', "."));
|
|
32
|
+
(_e = this.generatorOptions.logger) === null || _e === void 0 ? void 0 : _e.error("This is likely an issue with the template.");
|
|
33
|
+
(_f = this.generatorOptions.logger) === null || _f === void 0 ? void 0 : _f.error("Data: ".concat(JSON.stringify(context)));
|
|
34
|
+
(_g = this.generatorOptions.logger) === null || _g === void 0 ? void 0 : _g.error("Goto: https://github.com/ikemtz/openapi-ts-generator to report an issue if necessary.");
|
|
35
|
+
(_h = this.generatorOptions.logger) === null || _h === void 0 ? void 0 : _h.error(JSON.stringify(err));
|
|
30
36
|
throw err;
|
|
31
37
|
}
|
|
32
38
|
}
|
|
33
|
-
else {
|
|
34
|
-
(_g = this.generatorOptions.logger) === null || _g === void 0 ? void 0 : _g.warn("Template for ".concat(this.GeneratorName, " has not been specified"));
|
|
35
|
-
}
|
|
36
39
|
return null;
|
|
37
40
|
};
|
|
38
41
|
return BaseGenerator;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "openapi-ts-generator",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.341.4",
|
|
4
4
|
"description": "Based on swagger-ts-generator, this is a type script model generator specifically for services with OpenApi spec documentation.",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"types": "index.d.ts",
|
|
@@ -53,7 +53,7 @@
|
|
|
53
53
|
"jest-junit": "^13.2.0",
|
|
54
54
|
"openapi3-ts": "^2.0.2",
|
|
55
55
|
"prettier": "^2.7.1",
|
|
56
|
-
"rxjs": "^7.5.
|
|
56
|
+
"rxjs": "^7.5.7",
|
|
57
57
|
"ts-jest": "^27.1.3",
|
|
58
58
|
"typescript": "^4.6.3"
|
|
59
59
|
},
|