Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[TS][Inversify] Rename map to GlobalImportOperators #3020

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,6 @@ public TypeScriptInversifyClientCodegen() {
apiPackage = "api";
modelPackage = "model";

this.reservedWords.add("map");

this.cliOptions.add(new CliOption(NPM_REPOSITORY,
"Use this property to set an url your private npmRepo in the package.json"));
this.cliOptions.add(new CliOption(WITH_INTERFACES,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { Observable } from "rxjs/Observable";
import { Observable } from "rxjs";
{{/useRxJS6}}

import { map } from "rxjs/operators";
import { GlobalImportOperators } from "rxjs/operators";
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"rxjs/operators" does not export a GlobalImportOperators symbol

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah I got it....

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

so we need something like

import * as GlobalImportOperators from "rxjs/operators";

and then call it by

GlobalImportOperators.map

(or something like that) ?

import IHttpClient from "../IHttpClient";
import { inject, injectable } from "inversify";
import { IAPIConfiguration } from "../IAPIConfiguration";
Expand Down Expand Up @@ -177,7 +177,7 @@ export class {{classname}} {
const response: Observable<HttpResponse<{{#returnType}}{{{returnType}}}{{#isResponseTypeFile}}|undefined{{/isResponseTypeFile}}{{/returnType}}{{^returnType}}any{{/returnType}}>> = this.httpClient.{{httpMethod}}(`${this.basePath}{{{path}}}{{#hasQueryParams}}?${queryParameters.join('&')}{{/hasQueryParams}}`{{#bodyParam}}, {{paramName}} {{/bodyParam}}{{#hasFormParams}}, body{{/hasFormParams}}, headers);
if (observe == 'body') {
return response.pipe(
map(httpResponse => <{{#returnType}}{{{returnType}}}{{#isResponseTypeFile}}|undefined{{/isResponseTypeFile}}{{/returnType}}{{^returnType}}any{{/returnType}}>(httpResponse.response))
GlobalImportOperators(httpResponse => <{{#returnType}}{{{returnType}}}{{#isResponseTypeFile}}|undefined{{/isResponseTypeFile}}{{/returnType}}{{^returnType}}any{{/returnType}}>(httpResponse.response))
){{#usePromise}}.toPromise(){{/usePromise}};
}
return response{{#usePromise}}.toPromise(){{/usePromise}};
Expand Down
18 changes: 9 additions & 9 deletions samples/client/petstore/typescript-inversify/api/pet.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

import { Observable } from "rxjs/Observable";

import { map } from "rxjs/operators";
import { GlobalImportOperators } from "rxjs/operators";
import IHttpClient from "../IHttpClient";
import { inject, injectable } from "inversify";
import { IAPIConfiguration } from "../IAPIConfiguration";
Expand Down Expand Up @@ -63,7 +63,7 @@ export class PetService {
const response: Observable<HttpResponse<any>> = this.httpClient.post(`${this.basePath}/pet`, body , headers);
if (observe == 'body') {
return response.pipe(
map(httpResponse => <any>(httpResponse.response))
GlobalImportOperators(httpResponse => <any>(httpResponse.response))
);
}
return response;
Expand Down Expand Up @@ -100,7 +100,7 @@ export class PetService {
const response: Observable<HttpResponse<any>> = this.httpClient.delete(`${this.basePath}/pet/${encodeURIComponent(String(petId))}`, headers);
if (observe == 'body') {
return response.pipe(
map(httpResponse => <any>(httpResponse.response))
GlobalImportOperators(httpResponse => <any>(httpResponse.response))
);
}
return response;
Expand Down Expand Up @@ -137,7 +137,7 @@ export class PetService {
const response: Observable<HttpResponse<Array<Pet>>> = this.httpClient.get(`${this.basePath}/pet/findByStatus?${queryParameters.join('&')}`, headers);
if (observe == 'body') {
return response.pipe(
map(httpResponse => <Array<Pet>>(httpResponse.response))
GlobalImportOperators(httpResponse => <Array<Pet>>(httpResponse.response))
);
}
return response;
Expand Down Expand Up @@ -174,7 +174,7 @@ export class PetService {
const response: Observable<HttpResponse<Array<Pet>>> = this.httpClient.get(`${this.basePath}/pet/findByTags?${queryParameters.join('&')}`, headers);
if (observe == 'body') {
return response.pipe(
map(httpResponse => <Array<Pet>>(httpResponse.response))
GlobalImportOperators(httpResponse => <Array<Pet>>(httpResponse.response))
);
}
return response;
Expand Down Expand Up @@ -203,7 +203,7 @@ export class PetService {
const response: Observable<HttpResponse<Pet>> = this.httpClient.get(`${this.basePath}/pet/${encodeURIComponent(String(petId))}`, headers);
if (observe == 'body') {
return response.pipe(
map(httpResponse => <Pet>(httpResponse.response))
GlobalImportOperators(httpResponse => <Pet>(httpResponse.response))
);
}
return response;
Expand Down Expand Up @@ -236,7 +236,7 @@ export class PetService {
const response: Observable<HttpResponse<any>> = this.httpClient.put(`${this.basePath}/pet`, body , headers);
if (observe == 'body') {
return response.pipe(
map(httpResponse => <any>(httpResponse.response))
GlobalImportOperators(httpResponse => <any>(httpResponse.response))
);
}
return response;
Expand Down Expand Up @@ -279,7 +279,7 @@ export class PetService {
const response: Observable<HttpResponse<any>> = this.httpClient.post(`${this.basePath}/pet/${encodeURIComponent(String(petId))}`, body, headers);
if (observe == 'body') {
return response.pipe(
map(httpResponse => <any>(httpResponse.response))
GlobalImportOperators(httpResponse => <any>(httpResponse.response))
);
}
return response;
Expand Down Expand Up @@ -322,7 +322,7 @@ export class PetService {
const response: Observable<HttpResponse<ApiResponse>> = this.httpClient.post(`${this.basePath}/pet/${encodeURIComponent(String(petId))}/uploadImage`, body, headers);
if (observe == 'body') {
return response.pipe(
map(httpResponse => <ApiResponse>(httpResponse.response))
GlobalImportOperators(httpResponse => <ApiResponse>(httpResponse.response))
);
}
return response;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

import { Observable } from "rxjs/Observable";

import { map } from "rxjs/operators";
import { GlobalImportOperators } from "rxjs/operators";
import IHttpClient from "../IHttpClient";
import { inject, injectable } from "inversify";
import { IAPIConfiguration } from "../IAPIConfiguration";
Expand Down Expand Up @@ -54,7 +54,7 @@ export class StoreService {
const response: Observable<HttpResponse<any>> = this.httpClient.delete(`${this.basePath}/store/order/${encodeURIComponent(String(orderId))}`, headers);
if (observe == 'body') {
return response.pipe(
map(httpResponse => <any>(httpResponse.response))
GlobalImportOperators(httpResponse => <any>(httpResponse.response))
);
}
return response;
Expand All @@ -78,7 +78,7 @@ export class StoreService {
const response: Observable<HttpResponse<{ [key: string]: number; }>> = this.httpClient.get(`${this.basePath}/store/inventory`, headers);
if (observe == 'body') {
return response.pipe(
map(httpResponse => <{ [key: string]: number; }>(httpResponse.response))
GlobalImportOperators(httpResponse => <{ [key: string]: number; }>(httpResponse.response))
);
}
return response;
Expand All @@ -103,7 +103,7 @@ export class StoreService {
const response: Observable<HttpResponse<Order>> = this.httpClient.get(`${this.basePath}/store/order/${encodeURIComponent(String(orderId))}`, headers);
if (observe == 'body') {
return response.pipe(
map(httpResponse => <Order>(httpResponse.response))
GlobalImportOperators(httpResponse => <Order>(httpResponse.response))
);
}
return response;
Expand All @@ -129,7 +129,7 @@ export class StoreService {
const response: Observable<HttpResponse<Order>> = this.httpClient.post(`${this.basePath}/store/order`, body , headers);
if (observe == 'body') {
return response.pipe(
map(httpResponse => <Order>(httpResponse.response))
GlobalImportOperators(httpResponse => <Order>(httpResponse.response))
);
}
return response;
Expand Down
18 changes: 9 additions & 9 deletions samples/client/petstore/typescript-inversify/api/user.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

import { Observable } from "rxjs/Observable";

import { map } from "rxjs/operators";
import { GlobalImportOperators } from "rxjs/operators";
import IHttpClient from "../IHttpClient";
import { inject, injectable } from "inversify";
import { IAPIConfiguration } from "../IAPIConfiguration";
Expand Down Expand Up @@ -55,7 +55,7 @@ export class UserService {
const response: Observable<HttpResponse<any>> = this.httpClient.post(`${this.basePath}/user`, body , headers);
if (observe == 'body') {
return response.pipe(
map(httpResponse => <any>(httpResponse.response))
GlobalImportOperators(httpResponse => <any>(httpResponse.response))
);
}
return response;
Expand All @@ -81,7 +81,7 @@ export class UserService {
const response: Observable<HttpResponse<any>> = this.httpClient.post(`${this.basePath}/user/createWithArray`, body , headers);
if (observe == 'body') {
return response.pipe(
map(httpResponse => <any>(httpResponse.response))
GlobalImportOperators(httpResponse => <any>(httpResponse.response))
);
}
return response;
Expand All @@ -107,7 +107,7 @@ export class UserService {
const response: Observable<HttpResponse<any>> = this.httpClient.post(`${this.basePath}/user/createWithList`, body , headers);
if (observe == 'body') {
return response.pipe(
map(httpResponse => <any>(httpResponse.response))
GlobalImportOperators(httpResponse => <any>(httpResponse.response))
);
}
return response;
Expand All @@ -132,7 +132,7 @@ export class UserService {
const response: Observable<HttpResponse<any>> = this.httpClient.delete(`${this.basePath}/user/${encodeURIComponent(String(username))}`, headers);
if (observe == 'body') {
return response.pipe(
map(httpResponse => <any>(httpResponse.response))
GlobalImportOperators(httpResponse => <any>(httpResponse.response))
);
}
return response;
Expand All @@ -157,7 +157,7 @@ export class UserService {
const response: Observable<HttpResponse<User>> = this.httpClient.get(`${this.basePath}/user/${encodeURIComponent(String(username))}`, headers);
if (observe == 'body') {
return response.pipe(
map(httpResponse => <User>(httpResponse.response))
GlobalImportOperators(httpResponse => <User>(httpResponse.response))
);
}
return response;
Expand Down Expand Up @@ -195,7 +195,7 @@ export class UserService {
const response: Observable<HttpResponse<string>> = this.httpClient.get(`${this.basePath}/user/login?${queryParameters.join('&')}`, headers);
if (observe == 'body') {
return response.pipe(
map(httpResponse => <string>(httpResponse.response))
GlobalImportOperators(httpResponse => <string>(httpResponse.response))
);
}
return response;
Expand All @@ -215,7 +215,7 @@ export class UserService {
const response: Observable<HttpResponse<any>> = this.httpClient.get(`${this.basePath}/user/logout`, headers);
if (observe == 'body') {
return response.pipe(
map(httpResponse => <any>(httpResponse.response))
GlobalImportOperators(httpResponse => <any>(httpResponse.response))
);
}
return response;
Expand Down Expand Up @@ -246,7 +246,7 @@ export class UserService {
const response: Observable<HttpResponse<any>> = this.httpClient.put(`${this.basePath}/user/${encodeURIComponent(String(username))}`, body , headers);
if (observe == 'body') {
return response.pipe(
map(httpResponse => <any>(httpResponse.response))
GlobalImportOperators(httpResponse => <any>(httpResponse.response))
);
}
return response;
Expand Down