swagger-typescript-api 11.0.0--alpha-5 → 11.0.0--alpha-6

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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/src/templates.js +20 -17
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "swagger-typescript-api",
3
- "version": "11.0.0--alpha-5",
3
+ "version": "11.0.0--alpha-6",
4
4
  "description": "Generate typescript/javascript api from swagger schema",
5
5
  "scripts": {
6
6
  "cli:json": "node index.js -r -d -p ./swagger-test-cli.json -n swagger-test-cli.ts",
package/src/templates.js CHANGED
@@ -81,23 +81,26 @@ class Templates {
81
81
  const customFullPath = this.getTemplateFullPath(templatePaths.custom, fileName);
82
82
  let fileContent = customFullPath && this.fileSystem.getFileContent(customFullPath);
83
83
 
84
- if (!fileContent) {
85
- const baseFullPath = this.getTemplateFullPath(templatePaths.base, fileName);
86
-
87
- if (baseFullPath) {
88
- fileContent = this.fileSystem.getFileContent(baseFullPath);
89
- } else {
90
- this.logger.warn(
91
- `${_.lowerCase(name)} template not found in ${customFullPath}`,
92
- `\nCode generator will use the default template`,
93
- );
94
- }
95
-
96
- const originalFullPath = this.getTemplateFullPath(templatePaths.original, fileName);
97
-
98
- if (originalFullPath) {
99
- fileContent = this.fileSystem.getFileContent(originalFullPath);
100
- }
84
+ if (fileContent) {
85
+ this.logger.log(`"${_.lowerCase(name)}" template found in "${templatePaths.custom}"`);
86
+ return fileContent;
87
+ }
88
+
89
+ const baseFullPath = this.getTemplateFullPath(templatePaths.base, fileName);
90
+
91
+ if (baseFullPath) {
92
+ fileContent = this.fileSystem.getFileContent(baseFullPath);
93
+ } else {
94
+ this.logger.warn(
95
+ `"${_.lowerCase(name)}" template not found in "${templatePaths.custom}"`,
96
+ `\nCode generator will use the default template`,
97
+ );
98
+ }
99
+
100
+ const originalFullPath = this.getTemplateFullPath(templatePaths.original, fileName);
101
+
102
+ if (originalFullPath) {
103
+ fileContent = this.fileSystem.getFileContent(originalFullPath);
101
104
  }
102
105
 
103
106
  return fileContent;