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

* add model/index.ts

- move export of all models to model/index.ts
- move RequestFile definition to model/index.ts

This fixes #7126

* update samples

* Back out models/index.ts

Make this backwards-compatible:

- move `RequestFile` definition to `model/models.ts`
- remove `model/index.ts`
- re-export `RequestFile` from `api/apis.ts`
- make generation of `ObjectSerializer` conditional

* for some reason, Symfony isn't up to date

* reverts changes to php-symfony sample

* moves comment to mustache comment rather than TS comment

Co-authored-by: Esteban Gehring <esteban.gehring@gmail.com>

* removes stale files from samples (no longer generated)

* updates samples

Co-authored-by: Esteban Gehring <esteban.gehring@gmail.com>
This commit is contained in:
Richard Kolkovich 2020-08-28 09:19:53 -06:00 committed by GitHub
parent 1f95199f82
commit f681016ffd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
19 changed files with 64 additions and 47 deletions

View File

@ -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}}

View File

@ -1,7 +1,7 @@
{{>licenseInfo}}
{{#models}}
{{#model}}
import { RequestFile } from '../api';
import { RequestFile } from './models';
{{#tsImports}}
import { {{classname}} } from '{{filename}}';
{{/tsImports}}

View File

@ -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> | void);
{{/generateApis}}

View File

@ -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];

View File

@ -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

View File

@ -10,7 +10,7 @@
* Do not edit the class manually.
*/
import { RequestFile } from '../api';
import { RequestFile } from './models';
/**
* A category for a pet

View File

@ -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';

View File

@ -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

View File

@ -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';

View File

@ -10,7 +10,7 @@
* Do not edit the class manually.
*/
import { RequestFile } from '../api';
import { RequestFile } from './models';
/**
* A tag for a pet

View File

@ -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

View File

@ -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];

View File

@ -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

View File

@ -10,7 +10,7 @@
* Do not edit the class manually.
*/
import { RequestFile } from '../api';
import { RequestFile } from './models';
/**
* A category for a pet

View File

@ -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';

View File

@ -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

View File

@ -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';

View File

@ -10,7 +10,7 @@
* Do not edit the class manually.
*/
import { RequestFile } from '../api';
import { RequestFile } from './models';
/**
* A tag for a pet

View File

@ -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