diff --git a/modules/openapi-generator/src/main/resources/typescript-node/api-all.mustache b/modules/openapi-generator/src/main/resources/typescript-node/api-all.mustache index 0f63a320cd1d..16b585d9e4e7 100644 --- a/modules/openapi-generator/src/main/resources/typescript-node/api-all.mustache +++ b/modules/openapi-generator/src/main/resources/typescript-node/api-all.mustache @@ -8,7 +8,6 @@ import { {{ classname }} } from './{{ classFilename }}'; export * from './{{ classFilename }}Interface' {{/withInterfaces}} {{/apis}} -import * as fs from 'fs'; import * as http from 'http'; export class HttpError extends Error { @@ -18,15 +17,7 @@ export class HttpError extends Error { } } -export interface RequestDetailedFile { - value: Buffer; - options?: { - filename?: string; - contentType?: string; - } -} - -export type RequestFile = string | Buffer | fs.ReadStream | RequestDetailedFile; +export { RequestFile } from '../model/models'; export const APIS = [{{#apis}}{{#operations}}{{ classname }}{{/operations}}{{^-last}}, {{/-last}}{{/apis}}]; {{/apiInfo}} diff --git a/modules/openapi-generator/src/main/resources/typescript-node/model.mustache b/modules/openapi-generator/src/main/resources/typescript-node/model.mustache index 521bce34d767..e728b68ac4c0 100644 --- a/modules/openapi-generator/src/main/resources/typescript-node/model.mustache +++ b/modules/openapi-generator/src/main/resources/typescript-node/model.mustache @@ -1,7 +1,7 @@ {{>licenseInfo}} {{#models}} {{#model}} -import { RequestFile } from '../api'; +import { RequestFile } from './models'; {{#tsImports}} import { {{classname}} } from '{{filename}}'; {{/tsImports}} @@ -78,4 +78,4 @@ export enum {{classname}} { } {{/isEnum}} {{/model}} -{{/models}} \ No newline at end of file +{{/models}} diff --git a/modules/openapi-generator/src/main/resources/typescript-node/models.mustache b/modules/openapi-generator/src/main/resources/typescript-node/models.mustache index 41bf1422eab8..93f3790d667d 100644 --- a/modules/openapi-generator/src/main/resources/typescript-node/models.mustache +++ b/modules/openapi-generator/src/main/resources/typescript-node/models.mustache @@ -1,10 +1,27 @@ +{{#generateApis}} +import localVarRequest from 'request'; +{{/generateApis}} + {{#models}} {{#model}} export * from '{{{ classFilename }}}'; {{/model}} {{/models}} -import localVarRequest from 'request'; +import * as fs from 'fs'; + +export interface RequestDetailedFile { + value: Buffer; + options?: { + filename?: string; + contentType?: string; + } +} + +export type RequestFile = string | Buffer | fs.ReadStream | RequestDetailedFile; + +{{! Object serialization only relevant if generating APIs, too }} +{{#generateApis}} {{#models}} {{#model}} @@ -235,3 +252,4 @@ export class VoidAuth implements Authentication { } export type Interceptor = (requestOptions: localVarRequest.Options) => (Promise | void); +{{/generateApis}} diff --git a/samples/client/petstore/typescript-node/default/api/apis.ts b/samples/client/petstore/typescript-node/default/api/apis.ts index eef2cffcc297..3faa8c47b335 100644 --- a/samples/client/petstore/typescript-node/default/api/apis.ts +++ b/samples/client/petstore/typescript-node/default/api/apis.ts @@ -4,7 +4,6 @@ export * from './storeApi'; import { StoreApi } from './storeApi'; export * from './userApi'; import { UserApi } from './userApi'; -import * as fs from 'fs'; import * as http from 'http'; export class HttpError extends Error { @@ -14,14 +13,6 @@ export class HttpError extends Error { } } -export interface RequestDetailedFile { - value: Buffer; - options?: { - filename?: string; - contentType?: string; - } -} - -export type RequestFile = string | Buffer | fs.ReadStream | RequestDetailedFile; +export { RequestFile } from '../model/models'; export const APIS = [PetApi, StoreApi, UserApi]; diff --git a/samples/client/petstore/typescript-node/default/model/apiResponse.ts b/samples/client/petstore/typescript-node/default/model/apiResponse.ts index ae84669a8422..aa4047061f9c 100644 --- a/samples/client/petstore/typescript-node/default/model/apiResponse.ts +++ b/samples/client/petstore/typescript-node/default/model/apiResponse.ts @@ -10,7 +10,7 @@ * Do not edit the class manually. */ -import { RequestFile } from '../api'; +import { RequestFile } from './models'; /** * Describes the result of uploading an image resource diff --git a/samples/client/petstore/typescript-node/default/model/category.ts b/samples/client/petstore/typescript-node/default/model/category.ts index 1babd0fd22e3..facdc9d479f6 100644 --- a/samples/client/petstore/typescript-node/default/model/category.ts +++ b/samples/client/petstore/typescript-node/default/model/category.ts @@ -10,7 +10,7 @@ * Do not edit the class manually. */ -import { RequestFile } from '../api'; +import { RequestFile } from './models'; /** * A category for a pet diff --git a/samples/client/petstore/typescript-node/default/model/models.ts b/samples/client/petstore/typescript-node/default/model/models.ts index 1da13addd120..ba05217de7e8 100644 --- a/samples/client/petstore/typescript-node/default/model/models.ts +++ b/samples/client/petstore/typescript-node/default/model/models.ts @@ -1,3 +1,5 @@ +import localVarRequest from 'request'; + export * from './apiResponse'; export * from './category'; export * from './order'; @@ -5,7 +7,18 @@ export * from './pet'; export * from './tag'; export * from './user'; -import localVarRequest from 'request'; +import * as fs from 'fs'; + +export interface RequestDetailedFile { + value: Buffer; + options?: { + filename?: string; + contentType?: string; + } +} + +export type RequestFile = string | Buffer | fs.ReadStream | RequestDetailedFile; + import { ApiResponse } from './apiResponse'; import { Category } from './category'; diff --git a/samples/client/petstore/typescript-node/default/model/order.ts b/samples/client/petstore/typescript-node/default/model/order.ts index 1ee3ea280c61..18d5a8f2e861 100644 --- a/samples/client/petstore/typescript-node/default/model/order.ts +++ b/samples/client/petstore/typescript-node/default/model/order.ts @@ -10,7 +10,7 @@ * Do not edit the class manually. */ -import { RequestFile } from '../api'; +import { RequestFile } from './models'; /** * An order for a pets from the pet store diff --git a/samples/client/petstore/typescript-node/default/model/pet.ts b/samples/client/petstore/typescript-node/default/model/pet.ts index 141c4ebc17c9..10fd0c33207b 100644 --- a/samples/client/petstore/typescript-node/default/model/pet.ts +++ b/samples/client/petstore/typescript-node/default/model/pet.ts @@ -10,7 +10,7 @@ * Do not edit the class manually. */ -import { RequestFile } from '../api'; +import { RequestFile } from './models'; import { Category } from './category'; import { Tag } from './tag'; diff --git a/samples/client/petstore/typescript-node/default/model/tag.ts b/samples/client/petstore/typescript-node/default/model/tag.ts index 96e644974ef1..6b0f9752ee90 100644 --- a/samples/client/petstore/typescript-node/default/model/tag.ts +++ b/samples/client/petstore/typescript-node/default/model/tag.ts @@ -10,7 +10,7 @@ * Do not edit the class manually. */ -import { RequestFile } from '../api'; +import { RequestFile } from './models'; /** * A tag for a pet diff --git a/samples/client/petstore/typescript-node/default/model/user.ts b/samples/client/petstore/typescript-node/default/model/user.ts index 62b0b6436898..0b1401384c07 100644 --- a/samples/client/petstore/typescript-node/default/model/user.ts +++ b/samples/client/petstore/typescript-node/default/model/user.ts @@ -10,7 +10,7 @@ * Do not edit the class manually. */ -import { RequestFile } from '../api'; +import { RequestFile } from './models'; /** * A User who is purchasing from the pet store diff --git a/samples/client/petstore/typescript-node/npm/api/apis.ts b/samples/client/petstore/typescript-node/npm/api/apis.ts index eef2cffcc297..3faa8c47b335 100644 --- a/samples/client/petstore/typescript-node/npm/api/apis.ts +++ b/samples/client/petstore/typescript-node/npm/api/apis.ts @@ -4,7 +4,6 @@ export * from './storeApi'; import { StoreApi } from './storeApi'; export * from './userApi'; import { UserApi } from './userApi'; -import * as fs from 'fs'; import * as http from 'http'; export class HttpError extends Error { @@ -14,14 +13,6 @@ export class HttpError extends Error { } } -export interface RequestDetailedFile { - value: Buffer; - options?: { - filename?: string; - contentType?: string; - } -} - -export type RequestFile = string | Buffer | fs.ReadStream | RequestDetailedFile; +export { RequestFile } from '../model/models'; export const APIS = [PetApi, StoreApi, UserApi]; diff --git a/samples/client/petstore/typescript-node/npm/model/apiResponse.ts b/samples/client/petstore/typescript-node/npm/model/apiResponse.ts index ae84669a8422..aa4047061f9c 100644 --- a/samples/client/petstore/typescript-node/npm/model/apiResponse.ts +++ b/samples/client/petstore/typescript-node/npm/model/apiResponse.ts @@ -10,7 +10,7 @@ * Do not edit the class manually. */ -import { RequestFile } from '../api'; +import { RequestFile } from './models'; /** * Describes the result of uploading an image resource diff --git a/samples/client/petstore/typescript-node/npm/model/category.ts b/samples/client/petstore/typescript-node/npm/model/category.ts index 1babd0fd22e3..facdc9d479f6 100644 --- a/samples/client/petstore/typescript-node/npm/model/category.ts +++ b/samples/client/petstore/typescript-node/npm/model/category.ts @@ -10,7 +10,7 @@ * Do not edit the class manually. */ -import { RequestFile } from '../api'; +import { RequestFile } from './models'; /** * A category for a pet diff --git a/samples/client/petstore/typescript-node/npm/model/models.ts b/samples/client/petstore/typescript-node/npm/model/models.ts index 1da13addd120..ba05217de7e8 100644 --- a/samples/client/petstore/typescript-node/npm/model/models.ts +++ b/samples/client/petstore/typescript-node/npm/model/models.ts @@ -1,3 +1,5 @@ +import localVarRequest from 'request'; + export * from './apiResponse'; export * from './category'; export * from './order'; @@ -5,7 +7,18 @@ export * from './pet'; export * from './tag'; export * from './user'; -import localVarRequest from 'request'; +import * as fs from 'fs'; + +export interface RequestDetailedFile { + value: Buffer; + options?: { + filename?: string; + contentType?: string; + } +} + +export type RequestFile = string | Buffer | fs.ReadStream | RequestDetailedFile; + import { ApiResponse } from './apiResponse'; import { Category } from './category'; diff --git a/samples/client/petstore/typescript-node/npm/model/order.ts b/samples/client/petstore/typescript-node/npm/model/order.ts index 1ee3ea280c61..18d5a8f2e861 100644 --- a/samples/client/petstore/typescript-node/npm/model/order.ts +++ b/samples/client/petstore/typescript-node/npm/model/order.ts @@ -10,7 +10,7 @@ * Do not edit the class manually. */ -import { RequestFile } from '../api'; +import { RequestFile } from './models'; /** * An order for a pets from the pet store diff --git a/samples/client/petstore/typescript-node/npm/model/pet.ts b/samples/client/petstore/typescript-node/npm/model/pet.ts index 141c4ebc17c9..10fd0c33207b 100644 --- a/samples/client/petstore/typescript-node/npm/model/pet.ts +++ b/samples/client/petstore/typescript-node/npm/model/pet.ts @@ -10,7 +10,7 @@ * Do not edit the class manually. */ -import { RequestFile } from '../api'; +import { RequestFile } from './models'; import { Category } from './category'; import { Tag } from './tag'; diff --git a/samples/client/petstore/typescript-node/npm/model/tag.ts b/samples/client/petstore/typescript-node/npm/model/tag.ts index 96e644974ef1..6b0f9752ee90 100644 --- a/samples/client/petstore/typescript-node/npm/model/tag.ts +++ b/samples/client/petstore/typescript-node/npm/model/tag.ts @@ -10,7 +10,7 @@ * Do not edit the class manually. */ -import { RequestFile } from '../api'; +import { RequestFile } from './models'; /** * A tag for a pet diff --git a/samples/client/petstore/typescript-node/npm/model/user.ts b/samples/client/petstore/typescript-node/npm/model/user.ts index 62b0b6436898..0b1401384c07 100644 --- a/samples/client/petstore/typescript-node/npm/model/user.ts +++ b/samples/client/petstore/typescript-node/npm/model/user.ts @@ -10,7 +10,7 @@ * Do not edit the class manually. */ -import { RequestFile } from '../api'; +import { RequestFile } from './models'; /** * A User who is purchasing from the pet store