diff --git a/modules/openapi-generator/src/main/resources/typescript/http/http.mustache b/modules/openapi-generator/src/main/resources/typescript/http/http.mustache index 440022a3e668..12f3471ed7a5 100644 --- a/modules/openapi-generator/src/main/resources/typescript/http/http.mustache +++ b/modules/openapi-generator/src/main/resources/typescript/http/http.mustache @@ -216,6 +216,11 @@ export class RequestContext { export interface ResponseBody { text(): Promise; binary(): Promise<{{{fileContentDataType}}}>; + {{#platforms}} + {{#node}} + stream(): ReadableStream | null; + {{/node}} + {{/platforms}} } /** @@ -253,6 +258,14 @@ export class SelfDecodingBody implements ResponseBody { {{/deno}} {{/platforms}} } + + {{#platforms}} + {{#node}} + stream(): ReadableStream | null { + return null; + } + {{/node}} + {{/platforms}} } export class ResponseContext { diff --git a/modules/openapi-generator/src/main/resources/typescript/http/isomorphic-fetch.mustache b/modules/openapi-generator/src/main/resources/typescript/http/isomorphic-fetch.mustache index a4f779b937c4..f9e38334e3e9 100644 --- a/modules/openapi-generator/src/main/resources/typescript/http/isomorphic-fetch.mustache +++ b/modules/openapi-generator/src/main/resources/typescript/http/isomorphic-fetch.mustache @@ -38,7 +38,8 @@ export class IsomorphicFetchHttpLibrary implements HttpLibrary { {{#node}} const body = { text: () => resp.text(), - binary: () => resp.buffer() + binary: () => resp.buffer(), + stream: () => resp.body }; {{/node}} {{^node}} diff --git a/samples/client/echo_api/typescript/build/http/http.ts b/samples/client/echo_api/typescript/build/http/http.ts index 68974f3164cf..79bdf44c9afe 100644 --- a/samples/client/echo_api/typescript/build/http/http.ts +++ b/samples/client/echo_api/typescript/build/http/http.ts @@ -162,6 +162,7 @@ export class RequestContext { export interface ResponseBody { text(): Promise; binary(): Promise; + stream(): ReadableStream | null; } /** @@ -178,6 +179,10 @@ export class SelfDecodingBody implements ResponseBody { const data: Buffer = await this.dataSource; return data.toString(); } + + stream(): ReadableStream | null { + return null; + } } export class ResponseContext { diff --git a/samples/client/echo_api/typescript/build/http/isomorphic-fetch.ts b/samples/client/echo_api/typescript/build/http/isomorphic-fetch.ts index 23cfa867b046..fd0627960b43 100644 --- a/samples/client/echo_api/typescript/build/http/isomorphic-fetch.ts +++ b/samples/client/echo_api/typescript/build/http/isomorphic-fetch.ts @@ -22,7 +22,8 @@ export class IsomorphicFetchHttpLibrary implements HttpLibrary { const body = { text: () => resp.text(), - binary: () => resp.buffer() + binary: () => resp.buffer(), + stream: () => resp.body }; return new ResponseContext(resp.status, headers, body); }); diff --git a/samples/client/others/typescript/builds/array-of-lists/http/http.ts b/samples/client/others/typescript/builds/array-of-lists/http/http.ts index 6ac932c7c23a..3a83e7519fbe 100644 --- a/samples/client/others/typescript/builds/array-of-lists/http/http.ts +++ b/samples/client/others/typescript/builds/array-of-lists/http/http.ts @@ -174,6 +174,7 @@ export class SelfDecodingBody implements ResponseBody { reader.readAsText(data); }); } + } export class ResponseContext { diff --git a/samples/client/others/typescript/builds/enum-single-value/http/http.ts b/samples/client/others/typescript/builds/enum-single-value/http/http.ts index 6ac932c7c23a..3a83e7519fbe 100644 --- a/samples/client/others/typescript/builds/enum-single-value/http/http.ts +++ b/samples/client/others/typescript/builds/enum-single-value/http/http.ts @@ -174,6 +174,7 @@ export class SelfDecodingBody implements ResponseBody { reader.readAsText(data); }); } + } export class ResponseContext { diff --git a/samples/client/others/typescript/builds/null-types-simple/http/http.ts b/samples/client/others/typescript/builds/null-types-simple/http/http.ts index 6ac932c7c23a..3a83e7519fbe 100644 --- a/samples/client/others/typescript/builds/null-types-simple/http/http.ts +++ b/samples/client/others/typescript/builds/null-types-simple/http/http.ts @@ -174,6 +174,7 @@ export class SelfDecodingBody implements ResponseBody { reader.readAsText(data); }); } + } export class ResponseContext { diff --git a/samples/client/others/typescript/builds/with-unique-items/http/http.ts b/samples/client/others/typescript/builds/with-unique-items/http/http.ts index 6ac932c7c23a..3a83e7519fbe 100644 --- a/samples/client/others/typescript/builds/with-unique-items/http/http.ts +++ b/samples/client/others/typescript/builds/with-unique-items/http/http.ts @@ -174,6 +174,7 @@ export class SelfDecodingBody implements ResponseBody { reader.readAsText(data); }); } + } export class ResponseContext { diff --git a/samples/client/others/typescript/encode-decode/build/http/http.ts b/samples/client/others/typescript/encode-decode/build/http/http.ts index 68974f3164cf..79bdf44c9afe 100644 --- a/samples/client/others/typescript/encode-decode/build/http/http.ts +++ b/samples/client/others/typescript/encode-decode/build/http/http.ts @@ -162,6 +162,7 @@ export class RequestContext { export interface ResponseBody { text(): Promise; binary(): Promise; + stream(): ReadableStream | null; } /** @@ -178,6 +179,10 @@ export class SelfDecodingBody implements ResponseBody { const data: Buffer = await this.dataSource; return data.toString(); } + + stream(): ReadableStream | null { + return null; + } } export class ResponseContext { diff --git a/samples/client/others/typescript/encode-decode/build/http/isomorphic-fetch.ts b/samples/client/others/typescript/encode-decode/build/http/isomorphic-fetch.ts index 23cfa867b046..fd0627960b43 100644 --- a/samples/client/others/typescript/encode-decode/build/http/isomorphic-fetch.ts +++ b/samples/client/others/typescript/encode-decode/build/http/isomorphic-fetch.ts @@ -22,7 +22,8 @@ export class IsomorphicFetchHttpLibrary implements HttpLibrary { const body = { text: () => resp.text(), - binary: () => resp.buffer() + binary: () => resp.buffer(), + stream: () => resp.body }; return new ResponseContext(resp.status, headers, body); }); diff --git a/samples/client/others/typescript/encode-decode/test/test/server.ts b/samples/client/others/typescript/encode-decode/test/test/server.ts index a32330da9c19..a6747fc6cd08 100644 --- a/samples/client/others/typescript/encode-decode/test/test/server.ts +++ b/samples/client/others/typescript/encode-decode/test/test/server.ts @@ -26,6 +26,7 @@ class TestServerStub implements PromiseHttpLibrary { const body: ResponseBody = { binary: async () => { throw new Error('not implemented') }, text: async () => JSON.stringify(value), + stream: () => null, }; const headers = { 'content-type': 'application/json' }; return new ResponseContext(200, headers, body); @@ -35,6 +36,7 @@ class TestServerStub implements PromiseHttpLibrary { const body: ResponseBody = { binary: async () => { throw new Error('not implemented') }, text: async () => "", + stream: () => null, }; return new ResponseContext(200, {}, body); } else { diff --git a/samples/openapi3/client/petstore/typescript/builds/browser/http/http.ts b/samples/openapi3/client/petstore/typescript/builds/browser/http/http.ts index 6ac932c7c23a..3a83e7519fbe 100644 --- a/samples/openapi3/client/petstore/typescript/builds/browser/http/http.ts +++ b/samples/openapi3/client/petstore/typescript/builds/browser/http/http.ts @@ -174,6 +174,7 @@ export class SelfDecodingBody implements ResponseBody { reader.readAsText(data); }); } + } export class ResponseContext { diff --git a/samples/openapi3/client/petstore/typescript/builds/composed-schemas/http/http.ts b/samples/openapi3/client/petstore/typescript/builds/composed-schemas/http/http.ts index 6ac932c7c23a..3a83e7519fbe 100644 --- a/samples/openapi3/client/petstore/typescript/builds/composed-schemas/http/http.ts +++ b/samples/openapi3/client/petstore/typescript/builds/composed-schemas/http/http.ts @@ -174,6 +174,7 @@ export class SelfDecodingBody implements ResponseBody { reader.readAsText(data); }); } + } export class ResponseContext { diff --git a/samples/openapi3/client/petstore/typescript/builds/default/http/http.ts b/samples/openapi3/client/petstore/typescript/builds/default/http/http.ts index 68974f3164cf..79bdf44c9afe 100644 --- a/samples/openapi3/client/petstore/typescript/builds/default/http/http.ts +++ b/samples/openapi3/client/petstore/typescript/builds/default/http/http.ts @@ -162,6 +162,7 @@ export class RequestContext { export interface ResponseBody { text(): Promise; binary(): Promise; + stream(): ReadableStream | null; } /** @@ -178,6 +179,10 @@ export class SelfDecodingBody implements ResponseBody { const data: Buffer = await this.dataSource; return data.toString(); } + + stream(): ReadableStream | null { + return null; + } } export class ResponseContext { diff --git a/samples/openapi3/client/petstore/typescript/builds/default/http/isomorphic-fetch.ts b/samples/openapi3/client/petstore/typescript/builds/default/http/isomorphic-fetch.ts index 23cfa867b046..fd0627960b43 100644 --- a/samples/openapi3/client/petstore/typescript/builds/default/http/isomorphic-fetch.ts +++ b/samples/openapi3/client/petstore/typescript/builds/default/http/isomorphic-fetch.ts @@ -22,7 +22,8 @@ export class IsomorphicFetchHttpLibrary implements HttpLibrary { const body = { text: () => resp.text(), - binary: () => resp.buffer() + binary: () => resp.buffer(), + stream: () => resp.body }; return new ResponseContext(resp.status, headers, body); }); diff --git a/samples/openapi3/client/petstore/typescript/builds/deno/http/http.ts b/samples/openapi3/client/petstore/typescript/builds/deno/http/http.ts index c71b19bf2895..91bd0b2c2c37 100644 --- a/samples/openapi3/client/petstore/typescript/builds/deno/http/http.ts +++ b/samples/openapi3/client/petstore/typescript/builds/deno/http/http.ts @@ -162,6 +162,7 @@ export class SelfDecodingBody implements ResponseBody { const data: Blob = await this.dataSource; return data.text(); } + } export class ResponseContext { diff --git a/samples/openapi3/client/petstore/typescript/builds/deno_object_params/http/http.ts b/samples/openapi3/client/petstore/typescript/builds/deno_object_params/http/http.ts index c71b19bf2895..91bd0b2c2c37 100644 --- a/samples/openapi3/client/petstore/typescript/builds/deno_object_params/http/http.ts +++ b/samples/openapi3/client/petstore/typescript/builds/deno_object_params/http/http.ts @@ -162,6 +162,7 @@ export class SelfDecodingBody implements ResponseBody { const data: Blob = await this.dataSource; return data.text(); } + } export class ResponseContext { diff --git a/samples/openapi3/client/petstore/typescript/builds/explode-query/http/http.ts b/samples/openapi3/client/petstore/typescript/builds/explode-query/http/http.ts index 68974f3164cf..79bdf44c9afe 100644 --- a/samples/openapi3/client/petstore/typescript/builds/explode-query/http/http.ts +++ b/samples/openapi3/client/petstore/typescript/builds/explode-query/http/http.ts @@ -162,6 +162,7 @@ export class RequestContext { export interface ResponseBody { text(): Promise; binary(): Promise; + stream(): ReadableStream | null; } /** @@ -178,6 +179,10 @@ export class SelfDecodingBody implements ResponseBody { const data: Buffer = await this.dataSource; return data.toString(); } + + stream(): ReadableStream | null { + return null; + } } export class ResponseContext { diff --git a/samples/openapi3/client/petstore/typescript/builds/explode-query/http/isomorphic-fetch.ts b/samples/openapi3/client/petstore/typescript/builds/explode-query/http/isomorphic-fetch.ts index 23cfa867b046..fd0627960b43 100644 --- a/samples/openapi3/client/petstore/typescript/builds/explode-query/http/isomorphic-fetch.ts +++ b/samples/openapi3/client/petstore/typescript/builds/explode-query/http/isomorphic-fetch.ts @@ -22,7 +22,8 @@ export class IsomorphicFetchHttpLibrary implements HttpLibrary { const body = { text: () => resp.text(), - binary: () => resp.buffer() + binary: () => resp.buffer(), + stream: () => resp.body }; return new ResponseContext(resp.status, headers, body); }); diff --git a/samples/openapi3/client/petstore/typescript/builds/inversify/http/http.ts b/samples/openapi3/client/petstore/typescript/builds/inversify/http/http.ts index 39da9e077230..1626038a1bcf 100644 --- a/samples/openapi3/client/petstore/typescript/builds/inversify/http/http.ts +++ b/samples/openapi3/client/petstore/typescript/builds/inversify/http/http.ts @@ -162,6 +162,7 @@ export class RequestContext { export interface ResponseBody { text(): Promise; binary(): Promise; + stream(): ReadableStream | null; } /** @@ -178,6 +179,10 @@ export class SelfDecodingBody implements ResponseBody { const data: Buffer = await this.dataSource; return data.toString(); } + + stream(): ReadableStream | null { + return null; + } } export class ResponseContext { diff --git a/samples/openapi3/client/petstore/typescript/builds/inversify/http/isomorphic-fetch.ts b/samples/openapi3/client/petstore/typescript/builds/inversify/http/isomorphic-fetch.ts index 23cfa867b046..fd0627960b43 100644 --- a/samples/openapi3/client/petstore/typescript/builds/inversify/http/isomorphic-fetch.ts +++ b/samples/openapi3/client/petstore/typescript/builds/inversify/http/isomorphic-fetch.ts @@ -22,7 +22,8 @@ export class IsomorphicFetchHttpLibrary implements HttpLibrary { const body = { text: () => resp.text(), - binary: () => resp.buffer() + binary: () => resp.buffer(), + stream: () => resp.body }; return new ResponseContext(resp.status, headers, body); }); diff --git a/samples/openapi3/client/petstore/typescript/builds/jquery/http/http.ts b/samples/openapi3/client/petstore/typescript/builds/jquery/http/http.ts index db24c4927063..a4ca7586e06b 100644 --- a/samples/openapi3/client/petstore/typescript/builds/jquery/http/http.ts +++ b/samples/openapi3/client/petstore/typescript/builds/jquery/http/http.ts @@ -174,6 +174,7 @@ export class SelfDecodingBody implements ResponseBody { reader.readAsText(data); }); } + } export class ResponseContext { diff --git a/samples/openapi3/client/petstore/typescript/builds/nullable-enum/http/http.ts b/samples/openapi3/client/petstore/typescript/builds/nullable-enum/http/http.ts index 6ac932c7c23a..3a83e7519fbe 100644 --- a/samples/openapi3/client/petstore/typescript/builds/nullable-enum/http/http.ts +++ b/samples/openapi3/client/petstore/typescript/builds/nullable-enum/http/http.ts @@ -174,6 +174,7 @@ export class SelfDecodingBody implements ResponseBody { reader.readAsText(data); }); } + } export class ResponseContext { diff --git a/samples/openapi3/client/petstore/typescript/builds/object_params/http/http.ts b/samples/openapi3/client/petstore/typescript/builds/object_params/http/http.ts index 68974f3164cf..79bdf44c9afe 100644 --- a/samples/openapi3/client/petstore/typescript/builds/object_params/http/http.ts +++ b/samples/openapi3/client/petstore/typescript/builds/object_params/http/http.ts @@ -162,6 +162,7 @@ export class RequestContext { export interface ResponseBody { text(): Promise; binary(): Promise; + stream(): ReadableStream | null; } /** @@ -178,6 +179,10 @@ export class SelfDecodingBody implements ResponseBody { const data: Buffer = await this.dataSource; return data.toString(); } + + stream(): ReadableStream | null { + return null; + } } export class ResponseContext { diff --git a/samples/openapi3/client/petstore/typescript/builds/object_params/http/isomorphic-fetch.ts b/samples/openapi3/client/petstore/typescript/builds/object_params/http/isomorphic-fetch.ts index 23cfa867b046..fd0627960b43 100644 --- a/samples/openapi3/client/petstore/typescript/builds/object_params/http/isomorphic-fetch.ts +++ b/samples/openapi3/client/petstore/typescript/builds/object_params/http/isomorphic-fetch.ts @@ -22,7 +22,8 @@ export class IsomorphicFetchHttpLibrary implements HttpLibrary { const body = { text: () => resp.text(), - binary: () => resp.buffer() + binary: () => resp.buffer(), + stream: () => resp.body }; return new ResponseContext(resp.status, headers, body); });