From da44e458e0f05f76c66a670279deb61ed9ce286c Mon Sep 17 00:00:00 2001 From: Sami Jaber Date: Fri, 6 Dec 2019 14:17:46 +0100 Subject: [PATCH] typescript-fetch: Fix compatibility with noImplicitAny TS rule (#4711) * Fix compatibility with noImplicitAny TS rule (required with CRNA app) * new file added with bin/typescript-fetch-petstore.sh * missing files with bin/typescript-fetch-petstore-all.sh * Update modules/openapi-generator/src/main/resources/typescript-fetch/runtime.mustache Co-Authored-By: Esteban Gehring * Update modules/openapi-generator/src/main/resources/typescript-fetch/runtime.mustache Co-Authored-By: Esteban Gehring * Update modules/openapi-generator/src/main/resources/typescript-fetch/runtime.mustache Co-Authored-By: Esteban Gehring * Update modules/openapi-generator/src/main/resources/typescript-fetch/runtime.mustache Co-Authored-By: Esteban Gehring * changed files after bin/typescript-fetch-petstore-all.sh * re-generate samples, fix windows typescript fetch script --- ...escript-fetch-petstore-prefix-parameter-interfaces.bat | 2 +- .../src/main/resources/typescript-fetch/runtime.mustache | 8 ++++---- .../petstore/typescript-fetch/builds/default/runtime.ts | 8 ++++---- .../typescript-fetch/builds/es6-target/src/runtime.ts | 8 ++++---- .../builds/multiple-parameters/runtime.ts | 8 ++++---- .../builds/prefix-parameter-interfaces/src/runtime.ts | 8 ++++---- .../builds/typescript-three-plus/src/runtime.ts | 8 ++++---- .../typescript-fetch/builds/with-interfaces/runtime.ts | 8 ++++---- .../builds/with-npm-version/src/runtime.ts | 8 ++++---- 9 files changed, 33 insertions(+), 33 deletions(-) diff --git a/bin/windows/typescript-fetch-petstore-prefix-parameter-interfaces.bat b/bin/windows/typescript-fetch-petstore-prefix-parameter-interfaces.bat index 2b271e1a2a5..f96184e5d22 100644 --- a/bin/windows/typescript-fetch-petstore-prefix-parameter-interfaces.bat +++ b/bin/windows/typescript-fetch-petstore-prefix-parameter-interfaces.bat @@ -7,6 +7,6 @@ If Not Exist %executable% ( ) REM set JAVA_OPTS=%JAVA_OPTS% -Xmx1024M -set ags=generate -i modules\openapi-generator\src\test\resources\2_0\petstore.yaml -g typescript-fetch -o samples\client\petstore\typescript-fetch\builds\prefix-parameter-interfaces --additional-properties prefixParameterInterfaces=true +set ags=generate -i modules\openapi-generator\src\test\resources\2_0\petstore.yaml -g typescript-fetch -c bin\typescript-fetch-petstore-prefix-parameter-interfaces.json -o samples\client\petstore\typescript-fetch\builds\prefix-parameter-interfaces java %JAVA_OPTS% -jar %executable% %ags% diff --git a/modules/openapi-generator/src/main/resources/typescript-fetch/runtime.mustache b/modules/openapi-generator/src/main/resources/typescript-fetch/runtime.mustache index 03e1f986f12..29957247033 100644 --- a/modules/openapi-generator/src/main/resources/typescript-fetch/runtime.mustache +++ b/modules/openapi-generator/src/main/resources/typescript-fetch/runtime.mustache @@ -275,7 +275,7 @@ export interface ResponseTransformer { export class JSONApiResponse { constructor(public raw: Response, private transformer: ResponseTransformer = (jsonValue: any) => jsonValue) {} - async value() { + async value(): Promise { return this.transformer(await this.raw.json()); } } @@ -283,7 +283,7 @@ export class JSONApiResponse { export class VoidApiResponse { constructor(public raw: Response) {} - async value() { + async value(): Promise { return undefined; } } @@ -291,7 +291,7 @@ export class VoidApiResponse { export class BlobApiResponse { constructor(public raw: Response) {} - async value() { + async value(): Promise { return await this.raw.blob(); }; } @@ -299,7 +299,7 @@ export class BlobApiResponse { export class TextApiResponse { constructor(public raw: Response) {} - async value() { + async value(): Promise { return await this.raw.text(); }; } diff --git a/samples/client/petstore/typescript-fetch/builds/default/runtime.ts b/samples/client/petstore/typescript-fetch/builds/default/runtime.ts index f6718ebc236..dcd64eefb95 100644 --- a/samples/client/petstore/typescript-fetch/builds/default/runtime.ts +++ b/samples/client/petstore/typescript-fetch/builds/default/runtime.ts @@ -286,7 +286,7 @@ export interface ResponseTransformer { export class JSONApiResponse { constructor(public raw: Response, private transformer: ResponseTransformer = (jsonValue: any) => jsonValue) {} - async value() { + async value(): Promise { return this.transformer(await this.raw.json()); } } @@ -294,7 +294,7 @@ export class JSONApiResponse { export class VoidApiResponse { constructor(public raw: Response) {} - async value() { + async value(): Promise { return undefined; } } @@ -302,7 +302,7 @@ export class VoidApiResponse { export class BlobApiResponse { constructor(public raw: Response) {} - async value() { + async value(): Promise { return await this.raw.blob(); }; } @@ -310,7 +310,7 @@ export class BlobApiResponse { export class TextApiResponse { constructor(public raw: Response) {} - async value() { + async value(): Promise { return await this.raw.text(); }; } diff --git a/samples/client/petstore/typescript-fetch/builds/es6-target/src/runtime.ts b/samples/client/petstore/typescript-fetch/builds/es6-target/src/runtime.ts index f6718ebc236..dcd64eefb95 100644 --- a/samples/client/petstore/typescript-fetch/builds/es6-target/src/runtime.ts +++ b/samples/client/petstore/typescript-fetch/builds/es6-target/src/runtime.ts @@ -286,7 +286,7 @@ export interface ResponseTransformer { export class JSONApiResponse { constructor(public raw: Response, private transformer: ResponseTransformer = (jsonValue: any) => jsonValue) {} - async value() { + async value(): Promise { return this.transformer(await this.raw.json()); } } @@ -294,7 +294,7 @@ export class JSONApiResponse { export class VoidApiResponse { constructor(public raw: Response) {} - async value() { + async value(): Promise { return undefined; } } @@ -302,7 +302,7 @@ export class VoidApiResponse { export class BlobApiResponse { constructor(public raw: Response) {} - async value() { + async value(): Promise { return await this.raw.blob(); }; } @@ -310,7 +310,7 @@ export class BlobApiResponse { export class TextApiResponse { constructor(public raw: Response) {} - async value() { + async value(): Promise { return await this.raw.text(); }; } diff --git a/samples/client/petstore/typescript-fetch/builds/multiple-parameters/runtime.ts b/samples/client/petstore/typescript-fetch/builds/multiple-parameters/runtime.ts index f6718ebc236..dcd64eefb95 100644 --- a/samples/client/petstore/typescript-fetch/builds/multiple-parameters/runtime.ts +++ b/samples/client/petstore/typescript-fetch/builds/multiple-parameters/runtime.ts @@ -286,7 +286,7 @@ export interface ResponseTransformer { export class JSONApiResponse { constructor(public raw: Response, private transformer: ResponseTransformer = (jsonValue: any) => jsonValue) {} - async value() { + async value(): Promise { return this.transformer(await this.raw.json()); } } @@ -294,7 +294,7 @@ export class JSONApiResponse { export class VoidApiResponse { constructor(public raw: Response) {} - async value() { + async value(): Promise { return undefined; } } @@ -302,7 +302,7 @@ export class VoidApiResponse { export class BlobApiResponse { constructor(public raw: Response) {} - async value() { + async value(): Promise { return await this.raw.blob(); }; } @@ -310,7 +310,7 @@ export class BlobApiResponse { export class TextApiResponse { constructor(public raw: Response) {} - async value() { + async value(): Promise { return await this.raw.text(); }; } diff --git a/samples/client/petstore/typescript-fetch/builds/prefix-parameter-interfaces/src/runtime.ts b/samples/client/petstore/typescript-fetch/builds/prefix-parameter-interfaces/src/runtime.ts index f6718ebc236..dcd64eefb95 100644 --- a/samples/client/petstore/typescript-fetch/builds/prefix-parameter-interfaces/src/runtime.ts +++ b/samples/client/petstore/typescript-fetch/builds/prefix-parameter-interfaces/src/runtime.ts @@ -286,7 +286,7 @@ export interface ResponseTransformer { export class JSONApiResponse { constructor(public raw: Response, private transformer: ResponseTransformer = (jsonValue: any) => jsonValue) {} - async value() { + async value(): Promise { return this.transformer(await this.raw.json()); } } @@ -294,7 +294,7 @@ export class JSONApiResponse { export class VoidApiResponse { constructor(public raw: Response) {} - async value() { + async value(): Promise { return undefined; } } @@ -302,7 +302,7 @@ export class VoidApiResponse { export class BlobApiResponse { constructor(public raw: Response) {} - async value() { + async value(): Promise { return await this.raw.blob(); }; } @@ -310,7 +310,7 @@ export class BlobApiResponse { export class TextApiResponse { constructor(public raw: Response) {} - async value() { + async value(): Promise { return await this.raw.text(); }; } diff --git a/samples/client/petstore/typescript-fetch/builds/typescript-three-plus/src/runtime.ts b/samples/client/petstore/typescript-fetch/builds/typescript-three-plus/src/runtime.ts index a21e1e1ed99..22aa191ef5f 100644 --- a/samples/client/petstore/typescript-fetch/builds/typescript-three-plus/src/runtime.ts +++ b/samples/client/petstore/typescript-fetch/builds/typescript-three-plus/src/runtime.ts @@ -286,7 +286,7 @@ export interface ResponseTransformer { export class JSONApiResponse { constructor(public raw: Response, private transformer: ResponseTransformer = (jsonValue: any) => jsonValue) {} - async value() { + async value(): Promise { return this.transformer(await this.raw.json()); } } @@ -294,7 +294,7 @@ export class JSONApiResponse { export class VoidApiResponse { constructor(public raw: Response) {} - async value() { + async value(): Promise { return undefined; } } @@ -302,7 +302,7 @@ export class VoidApiResponse { export class BlobApiResponse { constructor(public raw: Response) {} - async value() { + async value(): Promise { return await this.raw.blob(); }; } @@ -310,7 +310,7 @@ export class BlobApiResponse { export class TextApiResponse { constructor(public raw: Response) {} - async value() { + async value(): Promise { return await this.raw.text(); }; } diff --git a/samples/client/petstore/typescript-fetch/builds/with-interfaces/runtime.ts b/samples/client/petstore/typescript-fetch/builds/with-interfaces/runtime.ts index f6718ebc236..dcd64eefb95 100644 --- a/samples/client/petstore/typescript-fetch/builds/with-interfaces/runtime.ts +++ b/samples/client/petstore/typescript-fetch/builds/with-interfaces/runtime.ts @@ -286,7 +286,7 @@ export interface ResponseTransformer { export class JSONApiResponse { constructor(public raw: Response, private transformer: ResponseTransformer = (jsonValue: any) => jsonValue) {} - async value() { + async value(): Promise { return this.transformer(await this.raw.json()); } } @@ -294,7 +294,7 @@ export class JSONApiResponse { export class VoidApiResponse { constructor(public raw: Response) {} - async value() { + async value(): Promise { return undefined; } } @@ -302,7 +302,7 @@ export class VoidApiResponse { export class BlobApiResponse { constructor(public raw: Response) {} - async value() { + async value(): Promise { return await this.raw.blob(); }; } @@ -310,7 +310,7 @@ export class BlobApiResponse { export class TextApiResponse { constructor(public raw: Response) {} - async value() { + async value(): Promise { return await this.raw.text(); }; } diff --git a/samples/client/petstore/typescript-fetch/builds/with-npm-version/src/runtime.ts b/samples/client/petstore/typescript-fetch/builds/with-npm-version/src/runtime.ts index f6718ebc236..dcd64eefb95 100644 --- a/samples/client/petstore/typescript-fetch/builds/with-npm-version/src/runtime.ts +++ b/samples/client/petstore/typescript-fetch/builds/with-npm-version/src/runtime.ts @@ -286,7 +286,7 @@ export interface ResponseTransformer { export class JSONApiResponse { constructor(public raw: Response, private transformer: ResponseTransformer = (jsonValue: any) => jsonValue) {} - async value() { + async value(): Promise { return this.transformer(await this.raw.json()); } } @@ -294,7 +294,7 @@ export class JSONApiResponse { export class VoidApiResponse { constructor(public raw: Response) {} - async value() { + async value(): Promise { return undefined; } } @@ -302,7 +302,7 @@ export class VoidApiResponse { export class BlobApiResponse { constructor(public raw: Response) {} - async value() { + async value(): Promise { return await this.raw.blob(); }; } @@ -310,7 +310,7 @@ export class BlobApiResponse { export class TextApiResponse { constructor(public raw: Response) {} - async value() { + async value(): Promise { return await this.raw.text(); }; }