Skip to content

Commit dab458b

Browse files
authored
[angular-v13] Add compilation test for typescript-angular-v13-provided-in-root using petstore v3 (OpenAPITools#11471)
1 parent 53eebc9 commit dab458b

File tree

10 files changed

+334
-120
lines changed

10 files changed

+334
-120
lines changed

bin/configs/typescript-angular-v13-provided-in-root-with-npm.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
generatorName: typescript-angular
22
outputDir: samples/client/petstore/typescript-angular-v13-provided-in-root/builds/with-npm
3-
inputSpec: modules/openapi-generator/src/test/resources/2_0/petstore.yaml
3+
inputSpec: modules/openapi-generator/src/test/resources/3_0/petstore.yaml
44
templateDir: modules/openapi-generator/src/main/resources/typescript-angular
55
additionalProperties:
66
ngVersion: 13.0.1

bin/configs/typescript-angular-v13-provided-in-root.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
generatorName: typescript-angular
22
outputDir: samples/client/petstore/typescript-angular-v13-provided-in-root/builds/default
3-
inputSpec: modules/openapi-generator/src/test/resources/2_0/petstore.yaml
3+
inputSpec: modules/openapi-generator/src/test/resources/3_0/petstore.yaml
44
templateDir: modules/openapi-generator/src/main/resources/typescript-angular
55
additionalProperties:
66
ngVersion: 13.0.1

pom.xml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/POM/4.0.0" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
1+
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/POM/4.0.0"
2+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
23
<parent>
34
<groupId>org.sonatype.oss</groupId>
45
<artifactId>oss-parent</artifactId>
@@ -290,7 +291,7 @@
290291
<configuration>
291292
<rules>
292293
<requireJavaVersion>
293-
<version>1.8.0</version>
294+
<version>1.8.0</version>
294295
</requireJavaVersion>
295296
<requireMavenVersion>
296297
<version>3.2.5</version>
@@ -1207,6 +1208,7 @@
12071208
<!-- comment out due to error `npm run build`
12081209
<module>samples/client/petstore/typescript-jquery/npm</module>-->
12091210
<module>samples/client/petstore/typescript-angular-v11-provided-in-root</module>
1211+
<module>samples/client/petstore/typescript-angular-v13-provided-in-root</module>
12101212
<module>samples/openapi3/client/petstore/typescript/builds/default</module>
12111213
<module>samples/openapi3/client/petstore/typescript/tests/default</module>
12121214
<module>samples/openapi3/client/petstore/typescript/builds/jquery</module>

samples/client/petstore/typescript-angular-v13-provided-in-root/builds/default/api/pet.service.ts

Lines changed: 27 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -103,16 +103,17 @@ export class PetService {
103103

104104
/**
105105
* Add a new pet to the store
106-
* @param body Pet object that needs to be added to the store
106+
*
107+
* @param pet Pet object that needs to be added to the store
107108
* @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body.
108109
* @param reportProgress flag to report request and response progress.
109110
*/
110-
public addPet(body: Pet, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: undefined, context?: HttpContext}): Observable<any>;
111-
public addPet(body: Pet, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: undefined, context?: HttpContext}): Observable<HttpResponse<any>>;
112-
public addPet(body: Pet, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: undefined, context?: HttpContext}): Observable<HttpEvent<any>>;
113-
public addPet(body: Pet, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: undefined, context?: HttpContext}): Observable<any> {
114-
if (body === null || body === undefined) {
115-
throw new Error('Required parameter body was null or undefined when calling addPet.');
111+
public addPet(pet: Pet, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/xml' | 'application/json', context?: HttpContext}): Observable<Pet>;
112+
public addPet(pet: Pet, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/xml' | 'application/json', context?: HttpContext}): Observable<HttpResponse<Pet>>;
113+
public addPet(pet: Pet, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/xml' | 'application/json', context?: HttpContext}): Observable<HttpEvent<Pet>>;
114+
public addPet(pet: Pet, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/xml' | 'application/json', context?: HttpContext}): Observable<any> {
115+
if (pet === null || pet === undefined) {
116+
throw new Error('Required parameter pet was null or undefined when calling addPet.');
116117
}
117118

118119
let localVarHeaders = this.defaultHeaders;
@@ -128,6 +129,8 @@ export class PetService {
128129
if (localVarHttpHeaderAcceptSelected === undefined) {
129130
// to determine the Accept header
130131
const httpHeaderAccepts: string[] = [
132+
'application/xml',
133+
'application/json'
131134
];
132135
localVarHttpHeaderAcceptSelected = this.configuration.selectHeaderAccept(httpHeaderAccepts);
133136
}
@@ -162,8 +165,8 @@ export class PetService {
162165
}
163166
}
164167

165-
return this.httpClient.post<any>(`${this.configuration.basePath}/pet`,
166-
body,
168+
return this.httpClient.post<Pet>(`${this.configuration.basePath}/pet`,
169+
pet,
167170
{
168171
context: localVarHttpContext,
169172
responseType: <any>responseType_,
@@ -177,6 +180,7 @@ export class PetService {
177180

178181
/**
179182
* Deletes a pet
183+
*
180184
* @param petId Pet id to delete
181185
* @param apiKey
182186
* @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body.
@@ -457,16 +461,17 @@ export class PetService {
457461

458462
/**
459463
* Update an existing pet
460-
* @param body Pet object that needs to be added to the store
464+
*
465+
* @param pet Pet object that needs to be added to the store
461466
* @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body.
462467
* @param reportProgress flag to report request and response progress.
463468
*/
464-
public updatePet(body: Pet, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: undefined, context?: HttpContext}): Observable<any>;
465-
public updatePet(body: Pet, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: undefined, context?: HttpContext}): Observable<HttpResponse<any>>;
466-
public updatePet(body: Pet, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: undefined, context?: HttpContext}): Observable<HttpEvent<any>>;
467-
public updatePet(body: Pet, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: undefined, context?: HttpContext}): Observable<any> {
468-
if (body === null || body === undefined) {
469-
throw new Error('Required parameter body was null or undefined when calling updatePet.');
469+
public updatePet(pet: Pet, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/xml' | 'application/json', context?: HttpContext}): Observable<Pet>;
470+
public updatePet(pet: Pet, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/xml' | 'application/json', context?: HttpContext}): Observable<HttpResponse<Pet>>;
471+
public updatePet(pet: Pet, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/xml' | 'application/json', context?: HttpContext}): Observable<HttpEvent<Pet>>;
472+
public updatePet(pet: Pet, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/xml' | 'application/json', context?: HttpContext}): Observable<any> {
473+
if (pet === null || pet === undefined) {
474+
throw new Error('Required parameter pet was null or undefined when calling updatePet.');
470475
}
471476

472477
let localVarHeaders = this.defaultHeaders;
@@ -482,6 +487,8 @@ export class PetService {
482487
if (localVarHttpHeaderAcceptSelected === undefined) {
483488
// to determine the Accept header
484489
const httpHeaderAccepts: string[] = [
490+
'application/xml',
491+
'application/json'
485492
];
486493
localVarHttpHeaderAcceptSelected = this.configuration.selectHeaderAccept(httpHeaderAccepts);
487494
}
@@ -516,8 +523,8 @@ export class PetService {
516523
}
517524
}
518525

519-
return this.httpClient.put<any>(`${this.configuration.basePath}/pet`,
520-
body,
526+
return this.httpClient.put<Pet>(`${this.configuration.basePath}/pet`,
527+
pet,
521528
{
522529
context: localVarHttpContext,
523530
responseType: <any>responseType_,
@@ -531,6 +538,7 @@ export class PetService {
531538

532539
/**
533540
* Updates a pet in the store with form data
541+
*
534542
* @param petId ID of pet that needs to be updated
535543
* @param name Updated name of the pet
536544
* @param status Updated status of the pet
@@ -619,6 +627,7 @@ export class PetService {
619627

620628
/**
621629
* uploads an image
630+
*
622631
* @param petId ID of pet to update
623632
* @param additionalMetadata Additional data to pass to server
624633
* @param file file to upload

samples/client/petstore/typescript-angular-v13-provided-in-root/builds/default/api/store.service.ts

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -265,16 +265,17 @@ export class StoreService {
265265

266266
/**
267267
* Place an order for a pet
268-
* @param body order placed for purchasing the pet
268+
*
269+
* @param order order placed for purchasing the pet
269270
* @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body.
270271
* @param reportProgress flag to report request and response progress.
271272
*/
272-
public placeOrder(body: Order, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/xml' | 'application/json', context?: HttpContext}): Observable<Order>;
273-
public placeOrder(body: Order, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/xml' | 'application/json', context?: HttpContext}): Observable<HttpResponse<Order>>;
274-
public placeOrder(body: Order, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/xml' | 'application/json', context?: HttpContext}): Observable<HttpEvent<Order>>;
275-
public placeOrder(body: Order, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/xml' | 'application/json', context?: HttpContext}): Observable<any> {
276-
if (body === null || body === undefined) {
277-
throw new Error('Required parameter body was null or undefined when calling placeOrder.');
273+
public placeOrder(order: Order, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/xml' | 'application/json', context?: HttpContext}): Observable<Order>;
274+
public placeOrder(order: Order, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/xml' | 'application/json', context?: HttpContext}): Observable<HttpResponse<Order>>;
275+
public placeOrder(order: Order, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/xml' | 'application/json', context?: HttpContext}): Observable<HttpEvent<Order>>;
276+
public placeOrder(order: Order, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/xml' | 'application/json', context?: HttpContext}): Observable<any> {
277+
if (order === null || order === undefined) {
278+
throw new Error('Required parameter order was null or undefined when calling placeOrder.');
278279
}
279280

280281
let localVarHeaders = this.defaultHeaders;
@@ -300,6 +301,7 @@ export class StoreService {
300301

301302
// to determine the Content-Type header
302303
const consumes: string[] = [
304+
'application/json'
303305
];
304306
const httpContentTypeSelected: string | undefined = this.configuration.selectHeaderContentType(consumes);
305307
if (httpContentTypeSelected !== undefined) {
@@ -318,7 +320,7 @@ export class StoreService {
318320
}
319321

320322
return this.httpClient.post<Order>(`${this.configuration.basePath}/store/order`,
321-
body,
323+
order,
322324
{
323325
context: localVarHttpContext,
324326
responseType: <any>responseType_,

0 commit comments

Comments
 (0)