Make optional properties in models optional parameters (#7859)

* Make optional properties in models optional parameters

Move incorrect location of typescript-node client

* Add typescript node package.json to swagger ignore
This commit is contained in:
Ben Wells 2018-03-31 05:12:06 +01:00 committed by William Cheng
parent f2d56b038b
commit c8650d0e34
5 changed files with 80 additions and 76 deletions

View File

@ -141,7 +141,7 @@ export class {{classname}} {{#parent}}extends {{{parent}}} {{/parent}}{
* {{{description}}} * {{{description}}}
*/ */
{{/description}} {{/description}}
'{{name}}': {{#isEnum}}{{{datatypeWithEnum}}}{{/isEnum}}{{^isEnum}}{{{datatype}}}{{/isEnum}}; '{{name}}'{{^required}}?{{/required}}: {{#isEnum}}{{{datatypeWithEnum}}}{{/isEnum}}{{^isEnum}}{{{datatype}}}{{/isEnum}};
{{/vars}} {{/vars}}
{{#discriminator}} {{#discriminator}}

View File

@ -140,9 +140,9 @@ class ObjectSerializer {
* Describes the result of uploading an image resource * Describes the result of uploading an image resource
*/ */
export class ApiResponse { export class ApiResponse {
'code': number; 'code'?: number;
'type': string; 'type'?: string;
'message': string; 'message'?: string;
static discriminator = undefined; static discriminator = undefined;
@ -172,8 +172,8 @@ export class ApiResponse {
* A category for a pet * A category for a pet
*/ */
export class Category { export class Category {
'id': number; 'id'?: number;
'name': string; 'name'?: string;
static discriminator = undefined; static discriminator = undefined;
@ -198,15 +198,15 @@ export class Category {
* An order for a pets from the pet store * An order for a pets from the pet store
*/ */
export class Order { export class Order {
'id': number; 'id'?: number;
'petId': number; 'petId'?: number;
'quantity': number; 'quantity'?: number;
'shipDate': Date; 'shipDate'?: Date;
/** /**
* Order Status * Order Status
*/ */
'status': Order.StatusEnum; 'status'?: Order.StatusEnum;
'complete': boolean; 'complete'?: boolean;
static discriminator = undefined; static discriminator = undefined;
@ -258,15 +258,15 @@ export namespace Order {
* A pet for sale in the pet store * A pet for sale in the pet store
*/ */
export class Pet { export class Pet {
'id': number; 'id'?: number;
'category': Category; 'category'?: Category;
'name': string; 'name': string;
'photoUrls': Array<string>; 'photoUrls': Array<string>;
'tags': Array<Tag>; 'tags'?: Array<Tag>;
/** /**
* pet status in the store * pet status in the store
*/ */
'status': Pet.StatusEnum; 'status'?: Pet.StatusEnum;
static discriminator = undefined; static discriminator = undefined;
@ -318,8 +318,8 @@ export namespace Pet {
* A tag for a pet * A tag for a pet
*/ */
export class Tag { export class Tag {
'id': number; 'id'?: number;
'name': string; 'name'?: string;
static discriminator = undefined; static discriminator = undefined;
@ -344,17 +344,17 @@ export class Tag {
* A User who is purchasing from the pet store * A User who is purchasing from the pet store
*/ */
export class User { export class User {
'id': number; 'id'?: number;
'username': string; 'username'?: string;
'firstName': string; 'firstName'?: string;
'lastName': string; 'lastName'?: string;
'email': string; 'email'?: string;
'password': string; 'password'?: string;
'phone': string; 'phone'?: string;
/** /**
* User Status * User Status
*/ */
'userStatus': number; 'userStatus'?: number;
static discriminator = undefined; static discriminator = undefined;

View File

@ -0,0 +1,4 @@
# Do not overwrite package.json file when re-generating typescript-node client
# as the package file as been modified to include dependencies required for
# testing the generated client.
package.json

View File

@ -5,9 +5,9 @@ import localVarRequest = require('request');
import http = require('http'); import http = require('http');
import Promise = require('bluebird'); import Promise = require('bluebird');
export declare class ApiResponse { export declare class ApiResponse {
'code': number; 'code'?: number;
'type': string; 'type'?: string;
'message': string; 'message'?: string;
static discriminator: undefined; static discriminator: undefined;
static attributeTypeMap: Array<{ static attributeTypeMap: Array<{
name: string; name: string;
@ -21,8 +21,8 @@ export declare class ApiResponse {
}[]; }[];
} }
export declare class Category { export declare class Category {
'id': number; 'id'?: number;
'name': string; 'name'?: string;
static discriminator: undefined; static discriminator: undefined;
static attributeTypeMap: Array<{ static attributeTypeMap: Array<{
name: string; name: string;
@ -36,12 +36,12 @@ export declare class Category {
}[]; }[];
} }
export declare class Order { export declare class Order {
'id': number; 'id'?: number;
'petId': number; 'petId'?: number;
'quantity': number; 'quantity'?: number;
'shipDate': Date; 'shipDate'?: Date;
'status': Order.StatusEnum; 'status'?: Order.StatusEnum;
'complete': boolean; 'complete'?: boolean;
static discriminator: undefined; static discriminator: undefined;
static attributeTypeMap: Array<{ static attributeTypeMap: Array<{
name: string; name: string;
@ -62,12 +62,12 @@ export declare namespace Order {
} }
} }
export declare class Pet { export declare class Pet {
'id': number; 'id'?: number;
'category': Category; 'category'?: Category;
'name': string; 'name': string;
'photoUrls': Array<string>; 'photoUrls': Array<string>;
'tags': Array<Tag>; 'tags'?: Array<Tag>;
'status': Pet.StatusEnum; 'status'?: Pet.StatusEnum;
static discriminator: undefined; static discriminator: undefined;
static attributeTypeMap: Array<{ static attributeTypeMap: Array<{
name: string; name: string;
@ -88,8 +88,8 @@ export declare namespace Pet {
} }
} }
export declare class Tag { export declare class Tag {
'id': number; 'id'?: number;
'name': string; 'name'?: string;
static discriminator: undefined; static discriminator: undefined;
static attributeTypeMap: Array<{ static attributeTypeMap: Array<{
name: string; name: string;
@ -103,14 +103,14 @@ export declare class Tag {
}[]; }[];
} }
export declare class User { export declare class User {
'id': number; 'id'?: number;
'username': string; 'username'?: string;
'firstName': string; 'firstName'?: string;
'lastName': string; 'lastName'?: string;
'email': string; 'email'?: string;
'password': string; 'password'?: string;
'phone': string; 'phone'?: string;
'userStatus': number; 'userStatus'?: number;
static discriminator: undefined; static discriminator: undefined;
static attributeTypeMap: Array<{ static attributeTypeMap: Array<{
name: string; name: string;

View File

@ -140,9 +140,9 @@ class ObjectSerializer {
* Describes the result of uploading an image resource * Describes the result of uploading an image resource
*/ */
export class ApiResponse { export class ApiResponse {
'code': number; 'code'?: number;
'type': string; 'type'?: string;
'message': string; 'message'?: string;
static discriminator = undefined; static discriminator = undefined;
@ -172,8 +172,8 @@ export class ApiResponse {
* A category for a pet * A category for a pet
*/ */
export class Category { export class Category {
'id': number; 'id'?: number;
'name': string; 'name'?: string;
static discriminator = undefined; static discriminator = undefined;
@ -198,15 +198,15 @@ export class Category {
* An order for a pets from the pet store * An order for a pets from the pet store
*/ */
export class Order { export class Order {
'id': number; 'id'?: number;
'petId': number; 'petId'?: number;
'quantity': number; 'quantity'?: number;
'shipDate': Date; 'shipDate'?: Date;
/** /**
* Order Status * Order Status
*/ */
'status': Order.StatusEnum; 'status'?: Order.StatusEnum;
'complete': boolean; 'complete'?: boolean;
static discriminator = undefined; static discriminator = undefined;
@ -258,15 +258,15 @@ export namespace Order {
* A pet for sale in the pet store * A pet for sale in the pet store
*/ */
export class Pet { export class Pet {
'id': number; 'id'?: number;
'category': Category; 'category'?: Category;
'name': string; 'name': string;
'photoUrls': Array<string>; 'photoUrls': Array<string>;
'tags': Array<Tag>; 'tags'?: Array<Tag>;
/** /**
* pet status in the store * pet status in the store
*/ */
'status': Pet.StatusEnum; 'status'?: Pet.StatusEnum;
static discriminator = undefined; static discriminator = undefined;
@ -318,8 +318,8 @@ export namespace Pet {
* A tag for a pet * A tag for a pet
*/ */
export class Tag { export class Tag {
'id': number; 'id'?: number;
'name': string; 'name'?: string;
static discriminator = undefined; static discriminator = undefined;
@ -344,17 +344,17 @@ export class Tag {
* A User who is purchasing from the pet store * A User who is purchasing from the pet store
*/ */
export class User { export class User {
'id': number; 'id'?: number;
'username': string; 'username'?: string;
'firstName': string; 'firstName'?: string;
'lastName': string; 'lastName'?: string;
'email': string; 'email'?: string;
'password': string; 'password'?: string;
'phone': string; 'phone'?: string;
/** /**
* User Status * User Status
*/ */
'userStatus': number; 'userStatus'?: number;
static discriminator = undefined; static discriminator = undefined;