Skip to content

Commit 0373b74

Browse files
authored
update ts angularjs petstore (oas2), fix model prefix (#245)
1 parent 3f976af commit 0373b74

5 files changed

Lines changed: 49 additions & 44 deletions

File tree

modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/TypeScriptAngularJsClientCodegen.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,11 @@ public String getSchemaType(Schema p) {
6161
return addModelPrefix(openAPIType);
6262
}
6363

64+
@Override
65+
public String getTypeDeclaration(String name) {
66+
return addModelPrefix(name);
67+
}
68+
6469
@Override
6570
public void postProcessParameter(CodegenParameter parameter) {
6671
super.postProcessParameter(parameter);
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
2.3.1
1+
3.0.0-SNAPSHOT

samples/client/petstore/typescript-angularjs/api/PetApi.ts

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -29,22 +29,22 @@ export class PetApi {
2929
/**
3030
*
3131
* @summary Add a new pet to the store
32-
* @param body Pet object that needs to be added to the store
32+
* @param pet Pet object that needs to be added to the store
3333
*/
34-
public addPet (body: models.Pet, extraHttpRequestParams?: any ) : ng.IHttpPromise<{}> {
34+
public addPet (pet: models.Pet, extraHttpRequestParams?: any ) : ng.IHttpPromise<{}> {
3535
const localVarPath = this.basePath + '/pet';
3636

3737
let queryParameters: any = {};
3838
let headerParams: any = (<any>Object).assign({}, this.defaultHeaders);
39-
// verify required parameter 'body' is not null or undefined
40-
if (body === null || body === undefined) {
41-
throw new Error('Required parameter body was null or undefined when calling addPet.');
39+
// verify required parameter 'pet' is not null or undefined
40+
if (pet === null || pet === undefined) {
41+
throw new Error('Required parameter pet was null or undefined when calling addPet.');
4242
}
4343

4444
let httpRequestParams: ng.IRequestConfig = {
4545
method: 'POST',
4646
url: localVarPath,
47-
data: body,
47+
data: pet,
4848
params: queryParameters,
4949
headers: headerParams
5050
};
@@ -183,22 +183,22 @@ export class PetApi {
183183
/**
184184
*
185185
* @summary Update an existing pet
186-
* @param body Pet object that needs to be added to the store
186+
* @param pet Pet object that needs to be added to the store
187187
*/
188-
public updatePet (body: models.Pet, extraHttpRequestParams?: any ) : ng.IHttpPromise<{}> {
188+
public updatePet (pet: models.Pet, extraHttpRequestParams?: any ) : ng.IHttpPromise<{}> {
189189
const localVarPath = this.basePath + '/pet';
190190

191191
let queryParameters: any = {};
192192
let headerParams: any = (<any>Object).assign({}, this.defaultHeaders);
193-
// verify required parameter 'body' is not null or undefined
194-
if (body === null || body === undefined) {
195-
throw new Error('Required parameter body was null or undefined when calling updatePet.');
193+
// verify required parameter 'pet' is not null or undefined
194+
if (pet === null || pet === undefined) {
195+
throw new Error('Required parameter pet was null or undefined when calling updatePet.');
196196
}
197197

198198
let httpRequestParams: ng.IRequestConfig = {
199199
method: 'PUT',
200200
url: localVarPath,
201-
data: body,
201+
data: pet,
202202
params: queryParameters,
203203
headers: headerParams
204204
};

samples/client/petstore/typescript-angularjs/api/StoreApi.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -109,22 +109,22 @@ export class StoreApi {
109109
/**
110110
*
111111
* @summary Place an order for a pet
112-
* @param body order placed for purchasing the pet
112+
* @param order order placed for purchasing the pet
113113
*/
114-
public placeOrder (body: models.Order, extraHttpRequestParams?: any ) : ng.IHttpPromise<models.Order> {
114+
public placeOrder (order: models.Order, extraHttpRequestParams?: any ) : ng.IHttpPromise<models.Order> {
115115
const localVarPath = this.basePath + '/store/order';
116116

117117
let queryParameters: any = {};
118118
let headerParams: any = (<any>Object).assign({}, this.defaultHeaders);
119-
// verify required parameter 'body' is not null or undefined
120-
if (body === null || body === undefined) {
121-
throw new Error('Required parameter body was null or undefined when calling placeOrder.');
119+
// verify required parameter 'order' is not null or undefined
120+
if (order === null || order === undefined) {
121+
throw new Error('Required parameter order was null or undefined when calling placeOrder.');
122122
}
123123

124124
let httpRequestParams: ng.IRequestConfig = {
125125
method: 'POST',
126126
url: localVarPath,
127-
data: body,
127+
data: order,
128128
params: queryParameters,
129129
headers: headerParams
130130
};

samples/client/petstore/typescript-angularjs/api/UserApi.ts

Lines changed: 25 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -29,22 +29,22 @@ export class UserApi {
2929
/**
3030
* This can only be done by the logged in user.
3131
* @summary Create user
32-
* @param body Created user object
32+
* @param user Created user object
3333
*/
34-
public createUser (body: models.User, extraHttpRequestParams?: any ) : ng.IHttpPromise<{}> {
34+
public createUser (user: models.User, extraHttpRequestParams?: any ) : ng.IHttpPromise<{}> {
3535
const localVarPath = this.basePath + '/user';
3636

3737
let queryParameters: any = {};
3838
let headerParams: any = (<any>Object).assign({}, this.defaultHeaders);
39-
// verify required parameter 'body' is not null or undefined
40-
if (body === null || body === undefined) {
41-
throw new Error('Required parameter body was null or undefined when calling createUser.');
39+
// verify required parameter 'user' is not null or undefined
40+
if (user === null || user === undefined) {
41+
throw new Error('Required parameter user was null or undefined when calling createUser.');
4242
}
4343

4444
let httpRequestParams: ng.IRequestConfig = {
4545
method: 'POST',
4646
url: localVarPath,
47-
data: body,
47+
data: user,
4848
params: queryParameters,
4949
headers: headerParams
5050
};
@@ -58,22 +58,22 @@ export class UserApi {
5858
/**
5959
*
6060
* @summary Creates list of users with given input array
61-
* @param body List of user object
61+
* @param modelsUser List of user object
6262
*/
63-
public createUsersWithArrayInput (body: Array<models.User>, extraHttpRequestParams?: any ) : ng.IHttpPromise<{}> {
63+
public createUsersWithArrayInput (modelsUser: Array<models.User>, extraHttpRequestParams?: any ) : ng.IHttpPromise<{}> {
6464
const localVarPath = this.basePath + '/user/createWithArray';
6565

6666
let queryParameters: any = {};
6767
let headerParams: any = (<any>Object).assign({}, this.defaultHeaders);
68-
// verify required parameter 'body' is not null or undefined
69-
if (body === null || body === undefined) {
70-
throw new Error('Required parameter body was null or undefined when calling createUsersWithArrayInput.');
68+
// verify required parameter 'modelsUser' is not null or undefined
69+
if (modelsUser === null || modelsUser === undefined) {
70+
throw new Error('Required parameter modelsUser was null or undefined when calling createUsersWithArrayInput.');
7171
}
7272

7373
let httpRequestParams: ng.IRequestConfig = {
7474
method: 'POST',
7575
url: localVarPath,
76-
data: body,
76+
data: modelsUser,
7777
params: queryParameters,
7878
headers: headerParams
7979
};
@@ -87,22 +87,22 @@ export class UserApi {
8787
/**
8888
*
8989
* @summary Creates list of users with given input array
90-
* @param body List of user object
90+
* @param modelsUser List of user object
9191
*/
92-
public createUsersWithListInput (body: Array<models.User>, extraHttpRequestParams?: any ) : ng.IHttpPromise<{}> {
92+
public createUsersWithListInput (modelsUser: Array<models.User>, extraHttpRequestParams?: any ) : ng.IHttpPromise<{}> {
9393
const localVarPath = this.basePath + '/user/createWithList';
9494

9595
let queryParameters: any = {};
9696
let headerParams: any = (<any>Object).assign({}, this.defaultHeaders);
97-
// verify required parameter 'body' is not null or undefined
98-
if (body === null || body === undefined) {
99-
throw new Error('Required parameter body was null or undefined when calling createUsersWithListInput.');
97+
// verify required parameter 'modelsUser' is not null or undefined
98+
if (modelsUser === null || modelsUser === undefined) {
99+
throw new Error('Required parameter modelsUser was null or undefined when calling createUsersWithListInput.');
100100
}
101101

102102
let httpRequestParams: ng.IRequestConfig = {
103103
method: 'POST',
104104
url: localVarPath,
105-
data: body,
105+
data: modelsUser,
106106
params: queryParameters,
107107
headers: headerParams
108108
};
@@ -145,7 +145,7 @@ export class UserApi {
145145
/**
146146
*
147147
* @summary Get user by user name
148-
* @param username The name that needs to be fetched. Use user1 for testing.
148+
* @param username The name that needs to be fetched. Use user1 for testing.
149149
*/
150150
public getUserByName (username: string, extraHttpRequestParams?: any ) : ng.IHttpPromise<models.User> {
151151
const localVarPath = this.basePath + '/user/{username}'
@@ -239,9 +239,9 @@ export class UserApi {
239239
* This can only be done by the logged in user.
240240
* @summary Updated user
241241
* @param username name that need to be deleted
242-
* @param body Updated user object
242+
* @param user Updated user object
243243
*/
244-
public updateUser (username: string, body: models.User, extraHttpRequestParams?: any ) : ng.IHttpPromise<{}> {
244+
public updateUser (username: string, user: models.User, extraHttpRequestParams?: any ) : ng.IHttpPromise<{}> {
245245
const localVarPath = this.basePath + '/user/{username}'
246246
.replace('{' + 'username' + '}', encodeURIComponent(String(username)));
247247

@@ -252,15 +252,15 @@ export class UserApi {
252252
throw new Error('Required parameter username was null or undefined when calling updateUser.');
253253
}
254254

255-
// verify required parameter 'body' is not null or undefined
256-
if (body === null || body === undefined) {
257-
throw new Error('Required parameter body was null or undefined when calling updateUser.');
255+
// verify required parameter 'user' is not null or undefined
256+
if (user === null || user === undefined) {
257+
throw new Error('Required parameter user was null or undefined when calling updateUser.');
258258
}
259259

260260
let httpRequestParams: ng.IRequestConfig = {
261261
method: 'PUT',
262262
url: localVarPath,
263-
data: body,
263+
data: user,
264264
params: queryParameters,
265265
headers: headerParams
266266
};

0 commit comments

Comments
 (0)