@devlearning/swagger-generator 1.0.5 → 1.0.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@devlearning/swagger-generator",
3
- "version": "1.0.5",
3
+ "version": "1.0.6",
4
4
  "description": "Swagger generator apis and models for Angular and NextJS",
5
5
  "main": "index.js",
6
6
  "type": "module",
package/src/generator.ts CHANGED
@@ -15,6 +15,7 @@ import { ModelNextJsWriter } from './generators-writers/nextjs/model-nextjs-writ
15
15
  import { ModelAngularWriter } from './generators-writers/angular/model-angular-writer.js';
16
16
  import { PropertyDto } from './models/property-dto.js';
17
17
  import { EnumValueDto } from './models/enum-value-dto.js';
18
+ import pkg from '../package.json' assert { type: 'json' };
18
19
 
19
20
  const contentTypeApplicationJson = 'application/json';
20
21
  const contentTypeMultipartFormData = 'multipart/form-data';
@@ -52,6 +53,8 @@ export class Generator {
52
53
  }
53
54
 
54
55
  generate() {
56
+ console.info(`%c[Swagger API Generator] %cVersion ${pkg.version}`, 'color: #4CAF50; font-weight: bold;');
57
+
55
58
  console.info('%c[Swagger API Generator] %cStarting to parse Swagger JSON file...', 'color: #4CAF50; font-weight: bold;', 'color: #2196F3;');
56
59
 
57
60
  this.computeApi();
package/tsconfig.json CHANGED
@@ -4,6 +4,7 @@
4
4
  "module": "NodeNext",
5
5
  "baseUrl": "./src",
6
6
  "moduleResolution": "NodeNext",
7
+ "resolveJsonModule": true,
7
8
  "paths": {
8
9
  "@src/*": [
9
10
  "*"
@@ -1,50 +0,0 @@
1
- import { HttpClient } from '@angular/common/http';
2
- import { Observable, catchError, map } from 'rxjs';
3
- import * as Models from './model.autogenerated';
4
- import { HttpHeaders } from "@angular/common/http";
5
-
6
- export const httpOptions = {
7
- headers: new HttpHeaders({ 'Content-Type': 'application/json' }),
8
- };
9
-
10
- export const httpOptionsMultipart = {};
11
-
12
- export abstract class ApiAutogeneratedService {
13
- constructor(
14
- public _http: HttpClient,
15
- public _baseUrl: string,
16
- ) { }
17
-
18
- protected abstract _momentToString(moment: moment.Moment): string;
19
- protected abstract _handleRequest<T>(request: T): T;
20
- protected abstract _handleMultipart<T>(request: T): FormData;
21
- protected abstract _handleResponse<T>(response: T): T;
22
- protected abstract _handleError(error: any, obs: any): Observable<never>;
23
-
24
-
25
- public catalog_Product_Read(idProduct?: number): Observable<Models.Product> {
26
- let idProductParam: string = idProduct != null && idProduct != undefined ? encodeURIComponent('' + idProduct) : '';
27
- return this._http.get<Models.Product>(`${this._baseUrl}/catalog/Product/Read?idProduct=${idProductParam}`, httpOptions)
28
- .pipe(
29
- map(x => this._handleResponse(x)),
30
- catchError((err, obs) => this._handleError(err, <Observable<any>>obs))
31
- );
32
- }
33
-
34
- public catalog_Product_List(): Observable<Models.Product[]> {
35
- return this._http.get<Models.Product[]>(`${this._baseUrl}/catalog/Product/List`, httpOptions)
36
- .pipe(
37
- map(x => this._handleResponse(x)),
38
- catchError((err, obs) => this._handleError(err, <Observable<any>>obs))
39
- );
40
- }
41
-
42
- public tenant_Tenant(): Observable<string> {
43
- return this._http.get<string>(`${this._baseUrl}/tenant/Tenant`, httpOptions)
44
- .pipe(
45
- map(x => this._handleResponse(x)),
46
- catchError((err, obs) => this._handleError(err, <Observable<any>>obs))
47
- );
48
- }
49
-
50
- }
@@ -1,10 +0,0 @@
1
- import * as moment from 'moment';
2
-
3
-
4
- export class Product {
5
- idProduct?: string;
6
- name?: string;
7
- quantity?: number;
8
- }
9
-
10
-