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

Fix typescript-node generation when only models are generated #7127

Merged
merged 13 commits into from
Aug 28, 2020
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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}}
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{{>licenseInfo}}
{{#models}}
{{#model}}
import { RequestFile } from '../api';
import { RequestFile } from './models';
{{#tsImports}}
import { {{classname}} } from '{{filename}}';
{{/tsImports}}
Expand Down Expand Up @@ -78,4 +78,4 @@ export enum {{classname}} {
}
{{/isEnum}}
{{/model}}
{{/models}}
{{/models}}
Original file line number Diff line number Diff line change
@@ -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
sarumont marked this conversation as resolved.
Show resolved Hide resolved
{{#generateApis}}

{{#models}}
{{#model}}
Expand Down Expand Up @@ -235,3 +252,4 @@ export class VoidAuth implements Authentication {
}

export type Interceptor = (requestOptions: localVarRequest.Options) => (Promise<void> | void);
{{/generateApis}}
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@ configuration.ts
encoder.ts
git_push.sh
index.ts
model/./apiResponse.ts
model/./category.ts
model/./order.ts
model/./pet.ts
model/./tag.ts
model/./user.ts
model/apiResponse.ts
model/category.ts
model/order.ts
model/pet.ts
model/tag.ts
model/user.ts
model/models.ts
variables.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@ configuration.ts
encoder.ts
git_push.sh
index.ts
model/./apiResponse.ts
sarumont marked this conversation as resolved.
Show resolved Hide resolved
model/./category.ts
model/./order.ts
model/./pet.ts
model/./tag.ts
model/./user.ts
model/apiResponse.ts
model/category.ts
model/order.ts
model/pet.ts
model/tag.ts
model/user.ts
model/models.ts
ng-package.json
package.json
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@ configuration.ts
encoder.ts
git_push.sh
index.ts
model/./apiResponse.ts
model/./category.ts
model/./order.ts
model/./pet.ts
model/./tag.ts
model/./user.ts
model/apiResponse.ts
model/category.ts
model/order.ts
model/pet.ts
model/tag.ts
model/user.ts
model/models.ts
variables.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@ configuration.ts
encoder.ts
git_push.sh
index.ts
model/./apiResponse.ts
model/./category.ts
model/./order.ts
model/./pet.ts
model/./tag.ts
model/./user.ts
model/apiResponse.ts
model/category.ts
model/order.ts
model/pet.ts
model/tag.ts
model/user.ts
model/models.ts
ng-package.json
package.json
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@ configuration.ts
encoder.ts
git_push.sh
index.ts
model/./apiResponse.ts
model/./category.ts
model/./order.ts
model/./pet.ts
model/./tag.ts
model/./user.ts
model/apiResponse.ts
model/category.ts
model/order.ts
model/pet.ts
model/tag.ts
model/user.ts
model/models.ts
variables.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@ configuration.ts
encoder.ts
git_push.sh
index.ts
model/./apiResponse.ts
model/./category.ts
model/./order.ts
model/./pet.ts
model/./tag.ts
model/./user.ts
model/apiResponse.ts
model/category.ts
model/order.ts
model/pet.ts
model/tag.ts
model/user.ts
model/models.ts
ng-package.json
package.json
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@ configuration.ts
encoder.ts
git_push.sh
index.ts
model/./apiResponse.ts
model/./category.ts
model/./order.ts
model/./pet.ts
model/./tag.ts
model/./user.ts
model/apiResponse.ts
model/category.ts
model/order.ts
model/pet.ts
model/tag.ts
model/user.ts
model/models.ts
variables.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@ configuration.ts
encoder.ts
git_push.sh
index.ts
model/./apiResponse.ts
model/./category.ts
model/./order.ts
model/./pet.ts
model/./tag.ts
model/./user.ts
model/apiResponse.ts
model/category.ts
model/order.ts
model/pet.ts
model/tag.ts
model/user.ts
model/models.ts
ng-package.json
package.json
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@ configuration.ts
encoder.ts
git_push.sh
index.ts
model/./apiResponse.ts
model/./category.ts
model/./order.ts
model/./pet.ts
model/./tag.ts
model/./user.ts
model/apiResponse.ts
model/category.ts
model/order.ts
model/pet.ts
model/tag.ts
model/user.ts
model/models.ts
variables.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@ configuration.ts
encoder.ts
git_push.sh
index.ts
model/./apiResponse.ts
model/./category.ts
model/./order.ts
model/./pet.ts
model/./tag.ts
model/./user.ts
model/apiResponse.ts
model/category.ts
model/order.ts
model/pet.ts
model/tag.ts
model/user.ts
model/models.ts
ng-package.json
package.json
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@ configuration.ts
encoder.ts
git_push.sh
index.ts
model/./apiResponse.ts
model/./category.ts
model/./order.ts
model/./pet.ts
model/./tag.ts
model/./user.ts
model/apiResponse.ts
model/category.ts
model/order.ts
model/pet.ts
model/tag.ts
model/user.ts
model/models.ts
ng-package.json
package.json
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@ configuration.ts
encoder.ts
git_push.sh
index.ts
model/./apiResponse.ts
model/./category.ts
model/./order.ts
model/./pet.ts
model/./tag.ts
model/./user.ts
model/apiResponse.ts
model/category.ts
model/order.ts
model/pet.ts
model/tag.ts
model/user.ts
model/models.ts
ng-package.json
package.json
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@ configuration.ts
encoder.ts
git_push.sh
index.ts
model/./apiResponse.ts
model/./category.ts
model/./order.ts
model/./pet.ts
model/./tag.ts
model/./user.ts
model/apiResponse.ts
model/category.ts
model/order.ts
model/pet.ts
model/tag.ts
model/user.ts
model/models.ts
ng-package.json
package.json
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@ configuration.ts
encoder.ts
git_push.sh
index.ts
model/./apiResponse.ts
model/./category.ts
model/./order.ts
model/./pet.ts
model/./tag.ts
model/./user.ts
model/apiResponse.ts
model/category.ts
model/order.ts
model/pet.ts
model/tag.ts
model/user.ts
model/models.ts
variables.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@ configuration.ts
encoder.ts
git_push.sh
index.ts
model/./apiResponse.ts
model/./category.ts
model/./order.ts
model/./pet.ts
model/./tag.ts
model/./user.ts
model/apiResponse.ts
model/category.ts
model/order.ts
model/pet.ts
model/tag.ts
model/user.ts
model/models.ts
ng-package.json
package.json
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ api/petApi.ts
api/storeApi.ts
api/userApi.ts
git_push.sh
model/./apiResponse.ts
model/./category.ts
model/./order.ts
model/./pet.ts
model/./tag.ts
model/./user.ts
model/apiResponse.ts
model/category.ts
model/order.ts
model/pet.ts
model/tag.ts
model/user.ts
model/models.ts
11 changes: 1 addition & 10 deletions samples/client/petstore/typescript-node/default/api/apis.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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];
Loading