#2147: fix compiler error in angular typescript codegen (#2149)

* #2147: fix compiler error in angular typescript codegen

* #2147: generate samples
This commit is contained in:
Esteban Marin 2019-02-14 09:39:08 +01:00 committed by William Cheng
parent 804b589f5f
commit e01a786bc9
11 changed files with 40 additions and 42 deletions

View File

@ -296,17 +296,17 @@ export class {{classname}} {
if ({{paramName}}) {
{{#isCollectionFormatMulti}}
{{paramName}}.forEach((element) => {
{{#useHttpClient}}formParams = {{/useHttpClient}}formParams.append('{{baseName}}', <any>element){{#useHttpClient}} || formParams{{/useHttpClient}};
{{#useHttpClient}}formParams = {{/useHttpClient}}formParams.append('{{baseName}}', <any>element){{#useHttpClient}} as any || formParams{{/useHttpClient}};
})
{{/isCollectionFormatMulti}}
{{^isCollectionFormatMulti}}
{{#useHttpClient}}formParams = {{/useHttpClient}}formParams.append('{{baseName}}', {{paramName}}.join(COLLECTION_FORMATS['{{collectionFormat}}'])){{#useHttpClient}} || formParams{{/useHttpClient}};
{{#useHttpClient}}formParams = {{/useHttpClient}}formParams.append('{{baseName}}', {{paramName}}.join(COLLECTION_FORMATS['{{collectionFormat}}'])){{#useHttpClient}} as any || formParams{{/useHttpClient}};
{{/isCollectionFormatMulti}}
}
{{/isListContainer}}
{{^isListContainer}}
if ({{paramName}} !== undefined) {
{{#useHttpClient}}formParams = {{/useHttpClient}}formParams.append('{{baseName}}', <any>{{paramName}}){{#useHttpClient}} || formParams{{/useHttpClient}};
{{#useHttpClient}}formParams = {{/useHttpClient}}formParams.append('{{baseName}}', <any>{{paramName}}){{#useHttpClient}} as any || formParams{{/useHttpClient}};
}
{{/isListContainer}}
{{/formParams}}

View File

@ -8,9 +8,7 @@
export class CustomQueryEncoderHelper extends QueryEncoder {
encodeKey(k: string): string {
k = super.encodeKey(k);
return k.replace(/\+/gi, '%2B')
.replace(/%5B/, "[").replace(/%5D/, "]")
;
return k.replace(/\+/gi, '%2B');
}
encodeValue(v: string): string {
v = super.encodeValue(v);

View File

@ -425,10 +425,10 @@ export class PetService {
}
if (name !== undefined) {
formParams = formParams.append('name', <any>name) || formParams;
formParams = formParams.append('name', <any>name) as any || formParams;
}
if (status !== undefined) {
formParams = formParams.append('status', <any>status) || formParams;
formParams = formParams.append('status', <any>status) as any || formParams;
}
return this.httpClient.post<any>(`${this.configuration.basePath}/pet/${encodeURIComponent(String(petId))}`,
@ -498,10 +498,10 @@ export class PetService {
}
if (additionalMetadata !== undefined) {
formParams = formParams.append('additionalMetadata', <any>additionalMetadata) || formParams;
formParams = formParams.append('additionalMetadata', <any>additionalMetadata) as any || formParams;
}
if (file !== undefined) {
formParams = formParams.append('file', <any>file) || formParams;
formParams = formParams.append('file', <any>file) as any || formParams;
}
return this.httpClient.post<ApiResponse>(`${this.configuration.basePath}/pet/${encodeURIComponent(String(petId))}/uploadImage`,

View File

@ -425,10 +425,10 @@ export class PetService {
}
if (name !== undefined) {
formParams = formParams.append('name', <any>name) || formParams;
formParams = formParams.append('name', <any>name) as any || formParams;
}
if (status !== undefined) {
formParams = formParams.append('status', <any>status) || formParams;
formParams = formParams.append('status', <any>status) as any || formParams;
}
return this.httpClient.post<any>(`${this.configuration.basePath}/pet/${encodeURIComponent(String(petId))}`,
@ -498,10 +498,10 @@ export class PetService {
}
if (additionalMetadata !== undefined) {
formParams = formParams.append('additionalMetadata', <any>additionalMetadata) || formParams;
formParams = formParams.append('additionalMetadata', <any>additionalMetadata) as any || formParams;
}
if (file !== undefined) {
formParams = formParams.append('file', <any>file) || formParams;
formParams = formParams.append('file', <any>file) as any || formParams;
}
return this.httpClient.post<ApiResponse>(`${this.configuration.basePath}/pet/${encodeURIComponent(String(petId))}/uploadImage`,

View File

@ -425,10 +425,10 @@ export class PetService {
}
if (name !== undefined) {
formParams = formParams.append('name', <any>name) || formParams;
formParams = formParams.append('name', <any>name) as any || formParams;
}
if (status !== undefined) {
formParams = formParams.append('status', <any>status) || formParams;
formParams = formParams.append('status', <any>status) as any || formParams;
}
return this.httpClient.post<any>(`${this.configuration.basePath}/pet/${encodeURIComponent(String(petId))}`,
@ -498,10 +498,10 @@ export class PetService {
}
if (additionalMetadata !== undefined) {
formParams = formParams.append('additionalMetadata', <any>additionalMetadata) || formParams;
formParams = formParams.append('additionalMetadata', <any>additionalMetadata) as any || formParams;
}
if (file !== undefined) {
formParams = formParams.append('file', <any>file) || formParams;
formParams = formParams.append('file', <any>file) as any || formParams;
}
return this.httpClient.post<ApiResponse>(`${this.configuration.basePath}/pet/${encodeURIComponent(String(petId))}/uploadImage`,

View File

@ -427,10 +427,10 @@ export class PetService {
}
if (name !== undefined) {
formParams = formParams.append('name', <any>name) || formParams;
formParams = formParams.append('name', <any>name) as any || formParams;
}
if (status !== undefined) {
formParams = formParams.append('status', <any>status) || formParams;
formParams = formParams.append('status', <any>status) as any || formParams;
}
return this.httpClient.post<any>(`${this.configuration.basePath}/pet/${encodeURIComponent(String(petId))}`,
@ -500,10 +500,10 @@ export class PetService {
}
if (additionalMetadata !== undefined) {
formParams = formParams.append('additionalMetadata', <any>additionalMetadata) || formParams;
formParams = formParams.append('additionalMetadata', <any>additionalMetadata) as any || formParams;
}
if (file !== undefined) {
formParams = formParams.append('file', <any>file) || formParams;
formParams = formParams.append('file', <any>file) as any || formParams;
}
return this.httpClient.post<ApiResponse>(`${this.configuration.basePath}/pet/${encodeURIComponent(String(petId))}/uploadImage`,

View File

@ -427,10 +427,10 @@ export class PetService {
}
if (name !== undefined) {
formParams = formParams.append('name', <any>name) || formParams;
formParams = formParams.append('name', <any>name) as any || formParams;
}
if (status !== undefined) {
formParams = formParams.append('status', <any>status) || formParams;
formParams = formParams.append('status', <any>status) as any || formParams;
}
return this.httpClient.post<any>(`${this.configuration.basePath}/pet/${encodeURIComponent(String(petId))}`,
@ -500,10 +500,10 @@ export class PetService {
}
if (additionalMetadata !== undefined) {
formParams = formParams.append('additionalMetadata', <any>additionalMetadata) || formParams;
formParams = formParams.append('additionalMetadata', <any>additionalMetadata) as any || formParams;
}
if (file !== undefined) {
formParams = formParams.append('file', <any>file) || formParams;
formParams = formParams.append('file', <any>file) as any || formParams;
}
return this.httpClient.post<ApiResponse>(`${this.configuration.basePath}/pet/${encodeURIComponent(String(petId))}/uploadImage`,

View File

@ -425,10 +425,10 @@ export class PetService {
}
if (name !== undefined) {
formParams = formParams.append('name', <any>name) || formParams;
formParams = formParams.append('name', <any>name) as any || formParams;
}
if (status !== undefined) {
formParams = formParams.append('status', <any>status) || formParams;
formParams = formParams.append('status', <any>status) as any || formParams;
}
return this.httpClient.post<any>(`${this.configuration.basePath}/pet/${encodeURIComponent(String(petId))}`,
@ -498,10 +498,10 @@ export class PetService {
}
if (additionalMetadata !== undefined) {
formParams = formParams.append('additionalMetadata', <any>additionalMetadata) || formParams;
formParams = formParams.append('additionalMetadata', <any>additionalMetadata) as any || formParams;
}
if (file !== undefined) {
formParams = formParams.append('file', <any>file) || formParams;
formParams = formParams.append('file', <any>file) as any || formParams;
}
return this.httpClient.post<ApiResponse>(`${this.configuration.basePath}/pet/${encodeURIComponent(String(petId))}/uploadImage`,

View File

@ -425,10 +425,10 @@ export class PetService {
}
if (name !== undefined) {
formParams = formParams.append('name', <any>name) || formParams;
formParams = formParams.append('name', <any>name) as any || formParams;
}
if (status !== undefined) {
formParams = formParams.append('status', <any>status) || formParams;
formParams = formParams.append('status', <any>status) as any || formParams;
}
return this.httpClient.post<any>(`${this.configuration.basePath}/pet/${encodeURIComponent(String(petId))}`,
@ -498,10 +498,10 @@ export class PetService {
}
if (additionalMetadata !== undefined) {
formParams = formParams.append('additionalMetadata', <any>additionalMetadata) || formParams;
formParams = formParams.append('additionalMetadata', <any>additionalMetadata) as any || formParams;
}
if (file !== undefined) {
formParams = formParams.append('file', <any>file) || formParams;
formParams = formParams.append('file', <any>file) as any || formParams;
}
return this.httpClient.post<ApiResponse>(`${this.configuration.basePath}/pet/${encodeURIComponent(String(petId))}/uploadImage`,

View File

@ -427,10 +427,10 @@ export class PetService {
}
if (name !== undefined) {
formParams = formParams.append('name', <any>name) || formParams;
formParams = formParams.append('name', <any>name) as any || formParams;
}
if (status !== undefined) {
formParams = formParams.append('status', <any>status) || formParams;
formParams = formParams.append('status', <any>status) as any || formParams;
}
return this.httpClient.post<any>(`${this.configuration.basePath}/pet/${encodeURIComponent(String(petId))}`,
@ -500,10 +500,10 @@ export class PetService {
}
if (additionalMetadata !== undefined) {
formParams = formParams.append('additionalMetadata', <any>additionalMetadata) || formParams;
formParams = formParams.append('additionalMetadata', <any>additionalMetadata) as any || formParams;
}
if (file !== undefined) {
formParams = formParams.append('file', <any>file) || formParams;
formParams = formParams.append('file', <any>file) as any || formParams;
}
return this.httpClient.post<ApiResponse>(`${this.configuration.basePath}/pet/${encodeURIComponent(String(petId))}/uploadImage`,

View File

@ -427,10 +427,10 @@ export class PetService {
}
if (name !== undefined) {
formParams = formParams.append('name', <any>name) || formParams;
formParams = formParams.append('name', <any>name) as any || formParams;
}
if (status !== undefined) {
formParams = formParams.append('status', <any>status) || formParams;
formParams = formParams.append('status', <any>status) as any || formParams;
}
return this.httpClient.post<any>(`${this.configuration.basePath}/pet/${encodeURIComponent(String(petId))}`,
@ -500,10 +500,10 @@ export class PetService {
}
if (additionalMetadata !== undefined) {
formParams = formParams.append('additionalMetadata', <any>additionalMetadata) || formParams;
formParams = formParams.append('additionalMetadata', <any>additionalMetadata) as any || formParams;
}
if (file !== undefined) {
formParams = formParams.append('file', <any>file) || formParams;
formParams = formParams.append('file', <any>file) as any || formParams;
}
return this.httpClient.post<ApiResponse>(`${this.configuration.basePath}/pet/${encodeURIComponent(String(petId))}/uploadImage`,