@devlearning/swagger-generator 1.0.18 → 1.0.19

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.
@@ -14,6 +14,10 @@ export class ApiDartWriter {
14
14
  const __dirname = path.dirname(__filename);
15
15
  const templatePath = path.join(__dirname, 'templates', 'api.mustache');
16
16
  const template = fs.readFileSync(templatePath, 'utf-8');
17
+ let importDirectory = this._commandLineArgs.outputDirectory;
18
+ if (importDirectory.startsWith('lib/')) {
19
+ importDirectory = importDirectory.slice('lib/'.length);
20
+ }
17
21
  const grouped = this._groupByTag(apis);
18
22
  for (const [tag, apis] of Object.entries(grouped)) {
19
23
  console.log(`Api: ${tag}`);
@@ -61,7 +65,7 @@ export class ApiDartWriter {
61
65
  const normalizedInfo = Normalizator.getNormalizedInfo(model);
62
66
  imports.push({
63
67
  type: api.parameters[0],
64
- import: `import 'package:${this._commandLineArgs.package}/${this._commandLineArgs.outputDirectory}/${normalizedInfo.subPath}/${normalizedInfo.filename}.dart';`
68
+ import: `import 'package:${this._commandLineArgs.package}/${importDirectory}/${normalizedInfo.subPath}/${normalizedInfo.filename}.dart';`
65
69
  });
66
70
  }
67
71
  });
@@ -74,7 +78,7 @@ export class ApiDartWriter {
74
78
  const normalizedInfo = Normalizator.getNormalizedInfo(model);
75
79
  imports.push({
76
80
  type: api.returnType,
77
- import: `import 'package:${this._commandLineArgs.package}/${this._commandLineArgs.outputDirectory}/${normalizedInfo.subPath}/${normalizedInfo.filename}.dart';`
81
+ import: `import 'package:${this._commandLineArgs.package}/${importDirectory}/${normalizedInfo.subPath}/${normalizedInfo.filename}.dart';`
78
82
  });
79
83
  }
80
84
  });
@@ -14,6 +14,10 @@ export class ModelDartWriter {
14
14
  const __dirname = path.dirname(__filename);
15
15
  const templatePath = path.join(__dirname, 'templates', 'model.mustache');
16
16
  const template = readFileSync(templatePath, 'utf-8');
17
+ let importDirectory = this._commandLineArgs.outputDirectory;
18
+ if (importDirectory.startsWith('lib/')) {
19
+ importDirectory = importDirectory.slice('lib/'.length);
20
+ }
17
21
  models.forEach(model => {
18
22
  const normalizedInfo = Normalizator.getNormalizedInfo(model);
19
23
  const dartModel = {
@@ -37,7 +41,7 @@ export class ModelDartWriter {
37
41
  const normalizedInfo = Normalizator.getNormalizedInfo(currModel);
38
42
  imports.push({
39
43
  type: property,
40
- import: `import 'package:${this._commandLineArgs.package}/${this._commandLineArgs.outputDirectory}/${normalizedInfo.subPath}/${normalizedInfo.filename}.dart';`
44
+ import: `import 'package:${this._commandLineArgs.package}/${importDirectory}/${normalizedInfo.subPath}/${normalizedInfo.filename}.dart';`
41
45
  });
42
46
  }
43
47
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@devlearning/swagger-generator",
3
- "version": "1.0.18",
3
+ "version": "1.0.19",
4
4
  "description": "Swagger generator apis and models for Angular and NextJS",
5
5
  "main": "index.js",
6
6
  "type": "module",
@@ -45,6 +45,10 @@ export class ApiDartWriter {
45
45
  const __dirname = path.dirname(__filename);
46
46
  const templatePath = path.join(__dirname, 'templates', 'api.mustache');
47
47
  const template = fs.readFileSync(templatePath, 'utf-8');
48
+ let importDirectory = this._commandLineArgs.outputDirectory;
49
+ if(importDirectory.startsWith('lib/')) {
50
+ importDirectory = importDirectory.slice('lib/'.length);
51
+ }
48
52
 
49
53
  const grouped = this._groupByTag(apis);
50
54
 
@@ -103,7 +107,7 @@ export class ApiDartWriter {
103
107
  const normalizedInfo = Normalizator.getNormalizedInfo(model);
104
108
  imports.push({
105
109
  type: api.parameters[0],
106
- import: `import 'package:${this._commandLineArgs.package}/${this._commandLineArgs.outputDirectory}/${normalizedInfo.subPath}/${normalizedInfo.filename}.dart';`
110
+ import: `import 'package:${this._commandLineArgs.package}/${importDirectory}/${normalizedInfo.subPath}/${normalizedInfo.filename}.dart';`
107
111
  });
108
112
  }
109
113
  });
@@ -117,7 +121,7 @@ export class ApiDartWriter {
117
121
  const normalizedInfo = Normalizator.getNormalizedInfo(model);
118
122
  imports.push({
119
123
  type: api.returnType!,
120
- import: `import 'package:${this._commandLineArgs.package}/${this._commandLineArgs.outputDirectory}/${normalizedInfo.subPath}/${normalizedInfo.filename}.dart';`
124
+ import: `import 'package:${this._commandLineArgs.package}/${importDirectory}/${normalizedInfo.subPath}/${normalizedInfo.filename}.dart';`
121
125
  });
122
126
  }
123
127
  });
@@ -42,6 +42,10 @@ export class ModelDartWriter {
42
42
  const __dirname = path.dirname(__filename);
43
43
  const templatePath = path.join(__dirname, 'templates', 'model.mustache');
44
44
  const template = readFileSync(templatePath, 'utf-8');
45
+ let importDirectory = this._commandLineArgs.outputDirectory;
46
+ if (importDirectory.startsWith('lib/')) {
47
+ importDirectory = importDirectory.slice('lib/'.length);
48
+ }
45
49
 
46
50
  models.forEach(model => {
47
51
  const normalizedInfo = Normalizator.getNormalizedInfo(model);
@@ -71,7 +75,7 @@ export class ModelDartWriter {
71
75
  const normalizedInfo = Normalizator.getNormalizedInfo(currModel);
72
76
  imports.push({
73
77
  type: property,
74
- import: `import 'package:${this._commandLineArgs.package}/${this._commandLineArgs.outputDirectory}/${normalizedInfo.subPath}/${normalizedInfo.filename}.dart';`
78
+ import: `import 'package:${this._commandLineArgs.package}/${importDirectory}/${normalizedInfo.subPath}/${normalizedInfo.filename}.dart';`
75
79
  });
76
80
  }
77
81
  });