@devlearning/swagger-generator 1.1.4 → 1.1.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.
@@ -29,7 +29,7 @@ export class ApiAngularWriter {
29
29
  ${queryParametersPreparation}${requestPreparation}return this._http.${method}<${returnTypeString}>(\`\${this._baseUrl}${api.url}${queryParameters}\`${haveRequest ? ', wrappedRequest' : ''}, ${httpOptions})
30
30
  .pipe(
31
31
  map(x => this._handleResponse(x)),
32
- catchError((err, obs) => this._handleError(err, <Observable<any>>obs))
32
+ catchError((err, obs) => this._handleError(err, <Observable<any>>obs, skipErrorHandling))
33
33
  );
34
34
  }
35
35
  `;
@@ -43,6 +43,7 @@ export class ApiAngularWriter {
43
43
  const typeName = parameter.typeName === 'dateTime' ? libraryDate : `${prefixType}${Normalizator.mapTsTypeToAngular(parameter.typeName)}`;
44
44
  parametersString += `${parameter.name}${parameter.nullable ? '?' : ''}: ${typeName}, `;
45
45
  });
46
+ parametersString += 'skipErrorHandling: boolean = false, ';
46
47
  if (api.parameters.length > 0)
47
48
  parametersString = parametersString.substring(0, parametersString.length - 2);
48
49
  return parametersString;
@@ -1,6 +1,6 @@
1
1
  import fs, { writeFileSync } from 'fs';
2
2
  import { Utils } from '../utils.js';
3
- import * as Mustache from 'mustache';
3
+ import Mustache from 'mustache';
4
4
  import { Normalizator } from './normalizator.js';
5
5
  import path from 'path';
6
6
  import { fileURLToPath } from 'url';
@@ -1,5 +1,5 @@
1
1
  import { readFileSync, writeFileSync } from 'fs';
2
- import * as Mustache from 'mustache';
2
+ import Mustache from 'mustache';
3
3
  import { Utils } from '../utils.js';
4
4
  import { Normalizator } from './normalizator.js';
5
5
  import path from 'path';
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@devlearning/swagger-generator",
3
- "version": "1.1.4",
3
+ "version": "1.1.6",
4
4
  "description": "Swagger generator apis and models for Angular and NextJS",
5
5
  "main": "index.js",
6
6
  "type": "module",
@@ -41,7 +41,7 @@ export class ApiAngularWriter {
41
41
  ${queryParametersPreparation}${requestPreparation}return this._http.${method}<${returnTypeString}>(\`\${this._baseUrl}${api.url}${queryParameters}\`${haveRequest ? ', wrappedRequest' : ''}, ${httpOptions})
42
42
  .pipe(
43
43
  map(x => this._handleResponse(x)),
44
- catchError((err, obs) => this._handleError(err, <Observable<any>>obs))
44
+ catchError((err, obs) => this._handleError(err, <Observable<any>>obs, skipErrorHandling))
45
45
  );
46
46
  }
47
47
  `;
@@ -60,6 +60,8 @@ export class ApiAngularWriter {
60
60
  parametersString += `${parameter.name}${parameter.nullable ? '?' : ''}: ${typeName}, `;
61
61
  });
62
62
 
63
+ parametersString += 'skipErrorHandling: boolean = false, ';
64
+
63
65
  if (api.parameters.length > 0)
64
66
  parametersString = parametersString.substring(0, parametersString.length - 2);
65
67
 
@@ -2,7 +2,7 @@ import fs, { writeFileSync } from 'fs';
2
2
  import { ApiDto } from '@src/models/api-dto.js';
3
3
  import { Utils } from '../utils.js';
4
4
  import { ParameterDto } from '@src/models/parameter-dto.js';
5
- import * as Mustache from 'mustache';
5
+ import Mustache from 'mustache';
6
6
  import { CommandLineArgs } from '@src/index.js';
7
7
  import { ModelDto } from '@src/models/model-dto.js';
8
8
  import { TypeDto } from '@src/models/type-dto.js';
@@ -1,6 +1,6 @@
1
1
  import fs, { readFileSync, writeFileSync } from 'fs';
2
2
  import { ModelDto } from '@src/models/model-dto.js';
3
- import * as Mustache from 'mustache';
3
+ import Mustache from 'mustache';
4
4
  import { Utils } from '../utils.js';
5
5
  import { CommandLineArgs } from '@src/index.js';
6
6
  import { ImportDefinitionDart } from './models/import-definition-dart.js';
@@ -1,29 +0,0 @@
1
- import 'package:{{package}}/core/di/injector.dart';
2
- import 'package:dio/dio.dart';
3
- {{#imports}}
4
- {{{.}}}
5
- {{/imports}}
6
-
7
- class {{apiClassName}} {
8
- final Dio _dio;
9
-
10
- {{apiClassName}}() : _dio = getIt<Dio>();
11
-
12
- {{#endpoints}}
13
- Future<{{responseType}}> {{methodName}}({{#haveRequest}}{{requestType}} request{{/haveRequest}}) async {
14
- final response = await _dio.{{httpMethod}}(
15
- '{{{path}}}',
16
- {{#haveRequest}}
17
- {{#isGet}}
18
- queryParameters: request.toJson(),
19
- {{/isGet}}
20
- {{^isGet}}
21
- data: request.toJson(),
22
- {{/isGet}}
23
- {{/haveRequest}}
24
- );
25
- return {{responseType}}.fromJson(response.data);
26
- }
27
-
28
- {{/endpoints}}
29
- }
@@ -1,18 +0,0 @@
1
- import 'package:freezed_annotation/freezed_annotation.dart';
2
- {{#imports}}
3
- {{{.}}}
4
- {{/imports}}
5
-
6
- part '{{filename}}.freezed.dart';
7
- part '{{filename}}.g.dart';
8
-
9
- @freezed
10
- abstract class {{modelName}} with _${{modelName}} {
11
- const factory {{modelName}}({
12
- {{#fields}}
13
- {{required}}{{type}}{{nullable}} {{name}},
14
- {{/fields}}
15
- }) = _{{modelName}};
16
-
17
- factory {{modelName}}.fromJson(Map<String, dynamic> json) => _${{modelName}}FromJson(json);
18
- }