@devlearning/swagger-generator 1.1.5 → 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.
- package/dist/generators-writers/angular/api-angular-writer.js +2 -1
- package/dist/models/swagger-component-property.js +1 -0
- package/dist/models/swagger-component.js +1 -0
- package/dist/models/swagger-content.js +1 -0
- package/dist/models/swagger-info.js +1 -0
- package/dist/models/swagger-method.js +1 -0
- package/dist/models/swagger-schema.js +1 -0
- package/dist/models/swagger.js +1 -0
- package/package.json +1 -1
- package/src/generators-writers/angular/api-angular-writer.ts +3 -1
- package/dist/templates/api.mustache +0 -29
- package/dist/templates/model.mustache +0 -18
|
@@ -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;
|
|
@@ -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
|
@@ -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
|
|
|
@@ -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
|
-
}
|