Fix generated module imports in Aurelia APIs (#7465) (#7520)

This commit is contained in:
Konstantin Simon Maria Möllers 2018-01-29 08:46:51 +01:00 committed by William Cheng
parent 7c20316755
commit 7faaa091cd
5 changed files with 12 additions and 15 deletions

View File

@ -94,7 +94,7 @@ public class TypeScriptAureliaClientCodegen extends AbstractTypeScriptClientCode
// Collect models to be imported
for (CodegenParameter param : op.allParams) {
if (!param.isPrimitiveType) {
if (!param.isPrimitiveType && !param.isListContainer && !param.dataType.equals("any")) {
modelImports.add(param.dataType);
}
}

View File

@ -30,6 +30,7 @@ export class {{classname}} extends Api {
* Creates a new {{classname}} class.
*
* @param httpClient The Aurelia HTTP client to be injected.
* @param authStorage A storage for authentication data.
*/
constructor(httpClient: HttpClient, authStorage: AuthStorage) {
super(httpClient, authStorage);
@ -57,7 +58,7 @@ export class {{classname}} extends Api {
// Create URL to call
const url = `${this.basePath}{{{path}}}`{{#pathParams}}
.replace(`{${'{{baseName}}'}}`, encodeURIComponent(String(${params['{{paramName}}']}))){{/pathParams}};
.replace(`{${'{{baseName}}'}}`, encodeURIComponent(`${params['{{paramName}}']}`)){{/pathParams}};
const response = await this.httpClient.createRequest(url)
// Set HTTP method

View File

@ -15,11 +15,8 @@ import { HttpClient } from 'aurelia-http-client';
import { Api } from './Api';
import { AuthStorage } from './AuthStorage';
import {
Array<string>,
any,
Pet,
ApiResponse,
Array<'available' | 'pending' | 'sold'>,
} from './models';
/**
@ -141,7 +138,7 @@ export class PetApi extends Api {
// Create URL to call
const url = `${this.basePath}/pet/{petId}`
.replace(`{${'petId'}}`, encodeURIComponent(String(${params['petId']})));
.replace(`{${'petId'}}`, encodeURIComponent(`${params['petId']}`));
const response = await this.httpClient.createRequest(url)
// Set HTTP method
@ -234,7 +231,7 @@ export class PetApi extends Api {
// Create URL to call
const url = `${this.basePath}/pet/{petId}`
.replace(`{${'petId'}}`, encodeURIComponent(String(${params['petId']})));
.replace(`{${'petId'}}`, encodeURIComponent(`${params['petId']}`));
const response = await this.httpClient.createRequest(url)
// Set HTTP method
@ -297,7 +294,7 @@ export class PetApi extends Api {
// Create URL to call
const url = `${this.basePath}/pet/{petId}`
.replace(`{${'petId'}}`, encodeURIComponent(String(${params['petId']})));
.replace(`{${'petId'}}`, encodeURIComponent(`${params['petId']}`));
const response = await this.httpClient.createRequest(url)
// Set HTTP method
@ -334,7 +331,7 @@ export class PetApi extends Api {
// Create URL to call
const url = `${this.basePath}/pet/{petId}/uploadImage`
.replace(`{${'petId'}}`, encodeURIComponent(String(${params['petId']})));
.replace(`{${'petId'}}`, encodeURIComponent(`${params['petId']}`));
const response = await this.httpClient.createRequest(url)
// Set HTTP method

View File

@ -71,7 +71,7 @@ export class StoreApi extends Api {
// Create URL to call
const url = `${this.basePath}/store/order/{orderId}`
.replace(`{${'orderId'}}`, encodeURIComponent(String(${params['orderId']})));
.replace(`{${'orderId'}}`, encodeURIComponent(`${params['orderId']}`));
const response = await this.httpClient.createRequest(url)
// Set HTTP method
@ -126,7 +126,7 @@ export class StoreApi extends Api {
// Create URL to call
const url = `${this.basePath}/store/order/{orderId}`
.replace(`{${'orderId'}}`, encodeURIComponent(String(${params['orderId']})));
.replace(`{${'orderId'}}`, encodeURIComponent(`${params['orderId']}`));
const response = await this.httpClient.createRequest(url)
// Set HTTP method

View File

@ -16,7 +16,6 @@ import { Api } from './Api';
import { AuthStorage } from './AuthStorage';
import {
User,
Array<User>,
} from './models';
/**
@ -192,7 +191,7 @@ export class UserApi extends Api {
// Create URL to call
const url = `${this.basePath}/user/{username}`
.replace(`{${'username'}}`, encodeURIComponent(String(${params['username']})));
.replace(`{${'username'}}`, encodeURIComponent(`${params['username']}`));
const response = await this.httpClient.createRequest(url)
// Set HTTP method
@ -220,7 +219,7 @@ export class UserApi extends Api {
// Create URL to call
const url = `${this.basePath}/user/{username}`
.replace(`{${'username'}}`, encodeURIComponent(String(${params['username']})));
.replace(`{${'username'}}`, encodeURIComponent(`${params['username']}`));
const response = await this.httpClient.createRequest(url)
// Set HTTP method
@ -309,7 +308,7 @@ export class UserApi extends Api {
// Create URL to call
const url = `${this.basePath}/user/{username}`
.replace(`{${'username'}}`, encodeURIComponent(String(${params['username']})));
.replace(`{${'username'}}`, encodeURIComponent(`${params['username']}`));
const response = await this.httpClient.createRequest(url)
// Set HTTP method