Skip to content

[TypeScript] double quote model property name #1979

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

Merged
merged 1 commit into from
Jan 27, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ namespace {{package}} {
* {{{description}}}
*/
{{/description}}
{{name}}{{^required}}?{{/required}}: {{#isEnum}}{{classname}}.{{{datatypeWithEnum}}}{{/isEnum}}{{^isEnum}}{{{datatype}}}{{/isEnum}};
"{{name}}"{{^required}}?{{/required}}: {{#isEnum}}{{classname}}.{{{datatypeWithEnum}}}{{/isEnum}}{{^isEnum}}{{{datatype}}}{{/isEnum}};
{{/vars}}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ export class {{classname}} {{#parent}}extends {{{parent}}} {{/parent}}{
* {{{description}}}
*/
{{/description}}
{{name}}: {{#isEnum}}{{classname}}.{{{datatypeWithEnum}}}{{/isEnum}}{{^isEnum}}{{{datatype}}}{{/isEnum}};
"{{name}}": {{#isEnum}}{{classname}}.{{{datatypeWithEnum}}}{{/isEnum}}{{^isEnum}}{{{datatype}}}{{/isEnum}};
{{/vars}}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ namespace API.Client {

export interface Category {

id?: number;
"id"?: number;

name?: string;
"name"?: string;
}

}
12 changes: 6 additions & 6 deletions samples/client/petstore/typescript-angular/API/Client/Order.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,20 +5,20 @@ namespace API.Client {

export interface Order {

id?: number;
"id"?: number;

petId?: number;
"petId"?: number;

quantity?: number;
"quantity"?: number;

shipDate?: Date;
"shipDate"?: Date;

/**
* Order Status
*/
status?: Order.StatusEnum;
"status"?: Order.StatusEnum;

complete?: boolean;
"complete"?: boolean;
}

export namespace Order {
Expand Down
12 changes: 6 additions & 6 deletions samples/client/petstore/typescript-angular/API/Client/Pet.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,20 +5,20 @@ namespace API.Client {

export interface 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
*/
status?: Pet.StatusEnum;
"status"?: Pet.StatusEnum;
}

export namespace Pet {
Expand Down
58 changes: 58 additions & 0 deletions samples/client/petstore/typescript-angular/API/Client/PetApi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -287,6 +287,64 @@ namespace API.Client {
httpRequestParams = this.extendObj(httpRequestParams, extraHttpRequestParams);
}

return this.$http(httpRequestParams);
}
/**
* Fake endpoint to test byte array return by &#39;Find pet by ID&#39;
* Returns a pet when ID &lt; 10. ID &gt; 10 or nonintegers will simulate API error conditions
* @param petId ID of pet that needs to be fetched
*/
public getPetByIdWithByteArray (petId: number, extraHttpRequestParams?: any ) : ng.IHttpPromise<string> {
const path = this.basePath + '/pet/{petId}?testing_byte_array=true'
.replace('{' + 'petId' + '}', String(petId));

let queryParameters: any = {};
let headerParams: any = this.extendObj({}, this.defaultHeaders);
// verify required parameter 'petId' is set
if (!petId) {
throw new Error('Missing required parameter petId when calling getPetByIdWithByteArray');
}
let httpRequestParams: any = {
method: 'GET',
url: path,
json: true,


params: queryParameters,
headers: headerParams
};

if (extraHttpRequestParams) {
httpRequestParams = this.extendObj(httpRequestParams, extraHttpRequestParams);
}

return this.$http(httpRequestParams);
}
/**
* Fake endpoint to test byte array in body parameter for adding a new pet to the store
*
* @param body Pet object in the form of byte array
*/
public addPetUsingByteArray (body?: string, extraHttpRequestParams?: any ) : ng.IHttpPromise<{}> {
const path = this.basePath + '/pet?testing_byte_array=true';

let queryParameters: any = {};
let headerParams: any = this.extendObj({}, this.defaultHeaders);
let httpRequestParams: any = {
method: 'POST',
url: path,
json: true,
data: body,


params: queryParameters,
headers: headerParams
};

if (extraHttpRequestParams) {
httpRequestParams = this.extendObj(httpRequestParams, extraHttpRequestParams);
}

return this.$http(httpRequestParams);
}
}
Expand Down
4 changes: 2 additions & 2 deletions samples/client/petstore/typescript-angular/API/Client/Tag.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ namespace API.Client {

export interface Tag {

id?: number;
"id"?: number;

name?: string;
"name"?: string;
}

}
16 changes: 8 additions & 8 deletions samples/client/petstore/typescript-angular/API/Client/User.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,24 +5,24 @@ namespace API.Client {

export interface 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
*/
userStatus?: number;
"userStatus"?: number;
}

}
2 changes: 1 addition & 1 deletion samples/client/petstore/typescript-angular/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,4 @@ npm run clean

## Author

[email protected]
[email protected], Swagger-Codegen community
2 changes: 1 addition & 1 deletion samples/client/petstore/typescript-node/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,4 @@ npm run clean

## Author

[email protected]
[email protected], Swagger-Codegen community
Loading