forked from loafle/openapi-generator-original
typescript-nestjs: removed unused basePath from api.service template (#8811)
* (nestjs) removed unused basePath from api.service template 8810 * Update modules/openapi-generator/src/main/resources/typescript-nestjs/api.service.mustache Co-authored-by: Esteban Gehring <esteban.gehring@gmail.com> * added missing parenthesis on Global() decorator Co-authored-by: Esteban Gehring <esteban.gehring@gmail.com>
This commit is contained in:
parent
df1ae03960
commit
34c77c2807
@ -7,7 +7,7 @@ import { {{classname}} } from './{{importPath}}';
|
||||
{{/apis}}
|
||||
{{/apiInfo}}
|
||||
|
||||
@Global
|
||||
@Global()
|
||||
@Module({
|
||||
imports: [ HttpModule ],
|
||||
exports: [
|
||||
|
@ -1,16 +1,15 @@
|
||||
{{>licenseInfo}}
|
||||
/* tslint:disable:no-unused-variable member-ordering */
|
||||
|
||||
import { HttpService, Inject, Injectable } from '@nestjs/common';
|
||||
import { HttpService, Inject, Injectable, Optional } from '@nestjs/common';
|
||||
import { AxiosResponse } from 'axios';
|
||||
import { Observable } from 'rxjs';
|
||||
import { Observable } from 'rxjs';
|
||||
{{#imports}}
|
||||
import { {{classname}} } from '../{{filename}}';
|
||||
{{/imports}}
|
||||
import { Configuration } from '../configuration';
|
||||
import { COLLECTION_FORMATS } from '../variables';
|
||||
import { Configuration } from '../configuration';
|
||||
{{#withInterfaces}}
|
||||
import { {{classname}}Interface } from './{{classFilename}}Interface';
|
||||
import { {{classname}}Interface } from './{{classFilename}}Interface';
|
||||
{{/withInterfaces}}
|
||||
|
||||
{{#operations}}
|
||||
@ -32,9 +31,9 @@ export class {{classname}} {
|
||||
public defaultHeaders = new Map()
|
||||
public configuration = new Configuration();
|
||||
|
||||
constructor(protected httpClient: HttpService, configuration: Configuration) {
|
||||
this.configuration = configuration;
|
||||
this.basePath = basePath || configuration.basePath || this.basePath;
|
||||
constructor(protected httpClient: HttpService, @Optional() configuration: Configuration) {
|
||||
this.configuration = configuration || this.configuration;
|
||||
this.basePath = configuration?.basePath || this.basePath;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -5,7 +5,7 @@ import { PetService } from './api/pet.service';
|
||||
import { StoreService } from './api/store.service';
|
||||
import { UserService } from './api/user.service';
|
||||
|
||||
@Global
|
||||
@Global()
|
||||
@Module({
|
||||
imports: [ HttpModule ],
|
||||
exports: [
|
||||
|
@ -11,13 +11,12 @@
|
||||
*/
|
||||
/* tslint:disable:no-unused-variable member-ordering */
|
||||
|
||||
import { HttpService, Inject, Injectable } from '@nestjs/common';
|
||||
import { HttpService, Inject, Injectable, Optional } from '@nestjs/common';
|
||||
import { AxiosResponse } from 'axios';
|
||||
import { Observable } from 'rxjs';
|
||||
import { Observable } from 'rxjs';
|
||||
import { ApiResponse } from '../model/apiResponse';
|
||||
import { Pet } from '../model/pet';
|
||||
import { Configuration } from '../configuration';
|
||||
import { COLLECTION_FORMATS } from '../variables';
|
||||
import { Configuration } from '../configuration';
|
||||
|
||||
|
||||
@Injectable()
|
||||
@ -27,9 +26,9 @@ export class PetService {
|
||||
public defaultHeaders = new Map()
|
||||
public configuration = new Configuration();
|
||||
|
||||
constructor(protected httpClient: HttpService, configuration: Configuration) {
|
||||
this.configuration = configuration;
|
||||
this.basePath = basePath || configuration.basePath || this.basePath;
|
||||
constructor(protected httpClient: HttpService, @Optional() configuration: Configuration) {
|
||||
this.configuration = configuration || this.configuration;
|
||||
this.basePath = configuration?.basePath || this.basePath;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -11,12 +11,11 @@
|
||||
*/
|
||||
/* tslint:disable:no-unused-variable member-ordering */
|
||||
|
||||
import { HttpService, Inject, Injectable } from '@nestjs/common';
|
||||
import { HttpService, Inject, Injectable, Optional } from '@nestjs/common';
|
||||
import { AxiosResponse } from 'axios';
|
||||
import { Observable } from 'rxjs';
|
||||
import { Observable } from 'rxjs';
|
||||
import { Order } from '../model/order';
|
||||
import { Configuration } from '../configuration';
|
||||
import { COLLECTION_FORMATS } from '../variables';
|
||||
import { Configuration } from '../configuration';
|
||||
|
||||
|
||||
@Injectable()
|
||||
@ -26,9 +25,9 @@ export class StoreService {
|
||||
public defaultHeaders = new Map()
|
||||
public configuration = new Configuration();
|
||||
|
||||
constructor(protected httpClient: HttpService, configuration: Configuration) {
|
||||
this.configuration = configuration;
|
||||
this.basePath = basePath || configuration.basePath || this.basePath;
|
||||
constructor(protected httpClient: HttpService, @Optional() configuration: Configuration) {
|
||||
this.configuration = configuration || this.configuration;
|
||||
this.basePath = configuration?.basePath || this.basePath;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -11,12 +11,11 @@
|
||||
*/
|
||||
/* tslint:disable:no-unused-variable member-ordering */
|
||||
|
||||
import { HttpService, Inject, Injectable } from '@nestjs/common';
|
||||
import { HttpService, Inject, Injectable, Optional } from '@nestjs/common';
|
||||
import { AxiosResponse } from 'axios';
|
||||
import { Observable } from 'rxjs';
|
||||
import { Observable } from 'rxjs';
|
||||
import { User } from '../model/user';
|
||||
import { Configuration } from '../configuration';
|
||||
import { COLLECTION_FORMATS } from '../variables';
|
||||
import { Configuration } from '../configuration';
|
||||
|
||||
|
||||
@Injectable()
|
||||
@ -26,9 +25,9 @@ export class UserService {
|
||||
public defaultHeaders = new Map()
|
||||
public configuration = new Configuration();
|
||||
|
||||
constructor(protected httpClient: HttpService, configuration: Configuration) {
|
||||
this.configuration = configuration;
|
||||
this.basePath = basePath || configuration.basePath || this.basePath;
|
||||
constructor(protected httpClient: HttpService, @Optional() configuration: Configuration) {
|
||||
this.configuration = configuration || this.configuration;
|
||||
this.basePath = configuration?.basePath || this.basePath;
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
x
Reference in New Issue
Block a user