Skip to content

Commit 4fb2eb2

Browse files
Test for #20998
1 parent 2576813 commit 4fb2eb2

File tree

4 files changed

+21
-8
lines changed

4 files changed

+21
-8
lines changed

modules/openapi-generator/src/test/resources/3_0/query-param-form.yaml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,7 @@ components:
8686
required:
8787
- name
8888
- age
89+
- nicknames
8990
properties:
9091
name:
9192
type: string
@@ -96,6 +97,10 @@ components:
9697
default: 5
9798
nullable: false
9899
description: The age
100+
nicknames:
101+
type: array
102+
items:
103+
type: string
99104

100105
Response:
101106
type: object
@@ -121,3 +126,9 @@ components:
121126
default: 5
122127
nullable: false
123128
description: The age
129+
nicknames:
130+
type: array
131+
items:
132+
type: string
133+
minLength: 1
134+
example: Nick

samples/client/others/typescript-angular-v20/builds/query-param-form/model/filter.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,5 +18,6 @@ export interface Filter {
1818
* The age
1919
*/
2020
age?: number;
21+
nicknames?: Array<string>;
2122
}
2223

samples/client/others/typescript-angular-v20/builds/query-param-form/model/item.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,5 +18,6 @@ export interface Item {
1818
* The age
1919
*/
2020
age: number;
21+
nicknames: Array<string>;
2122
}
2223

samples/client/others/typescript-angular-v20/projects/app/src/api.query_param_form.spec.ts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ import {HttpTestingController, provideHttpClientTesting} from '@angular/common/h
55
import {DefaultService, Filter, provideApi} from '@swagger/typescript-angular-query-param-form'
66

77
const ids: number[] = [4, 5];
8-
const filter: Filter = {name: 'John', age: 37};
9-
const filterWithSpecialCharacters: Filter = {name: 'Éléonore &,|+', age: 42};
8+
const filter: Filter = {name: 'John', age: 37, nicknames: ['Joe', 'Joey']};
9+
const filterWithSpecialCharacters: Filter = {name: 'Éléonore &,|+', age: 42, nicknames: ['Elé', 'Ellie']};
1010
const country: string = "Belgium";
1111

1212
describe('Form Query Param testing', () => {
@@ -36,13 +36,13 @@ describe('Form Query Param testing', () => {
3636

3737
it('should separate the query parameter with ampersands (all set)', async () => {
3838
service.searchExplode(ids, filter, country).subscribe();
39-
const req = httpTesting.expectOne('http://localhost/search_explode?ids=4&ids=5&name=John&age=37&country=Belgium');
39+
const req = httpTesting.expectOne('http://localhost/search_explode?ids=4&ids=5&name=John&age=37&nicknames=Joe&nicknames=Joey&country=Belgium');
4040
expect(req.request.method).toEqual('GET');
4141
});
4242

4343
it('should separate the query parameter with ampersands (all set) - special characters', async () => {
4444
service.searchExplode(ids, filterWithSpecialCharacters, country).subscribe();
45-
const req = httpTesting.expectOne('http://localhost/search_explode?ids=4&ids=5&name=%C3%89l%C3%A9onore%20%26%2C%7C%2B&age=42&country=Belgium');
45+
const req = httpTesting.expectOne('http://localhost/search_explode?ids=4&ids=5&name=%C3%89l%C3%A9onore%20%26%2C%7C%2B&age=42&nicknames=El%C3%A9&nicknames=Ellie&country=Belgium');
4646
expect(req.request.method).toEqual('GET');
4747
});
4848

@@ -70,7 +70,7 @@ describe('Form Query Param testing', () => {
7070
it('should separate the query parameter with ampersands (object only)', async () => {
7171
service.searchExplode(undefined, filter, undefined).subscribe();
7272

73-
const req = httpTesting.expectOne('http://localhost/search_explode?name=John&age=37');
73+
const req = httpTesting.expectOne('http://localhost/search_explode?name=John&age=37&nicknames=Joe&nicknames=Joey');
7474
expect(req.request.method).toEqual('GET');
7575
});
7676

@@ -82,13 +82,13 @@ describe('Form Query Param testing', () => {
8282

8383
it('should separate the query parameter with comma (all set)', async () => {
8484
service.searchNotExplode(ids, filter, country).subscribe();
85-
const req = httpTesting.expectOne('http://localhost/search_not_explode?ids=4,5&filter=name,John,age,37&country=Belgium');
85+
const req = httpTesting.expectOne('http://localhost/search_not_explode?ids=4,5&filter=name,John,age,37,nicknames,Joe,Joey&country=Belgium');
8686
expect(req.request.method).toEqual('GET');
8787
});
8888

8989
it('should separate the query parameter with comma (all set) - special characters', async () => {
9090
service.searchNotExplode(ids, filterWithSpecialCharacters, country).subscribe();
91-
const req = httpTesting.expectOne('http://localhost/search_not_explode?ids=4,5&filter=name,%C3%89l%C3%A9onore%20%26%2C%7C%2B,age,42&country=Belgium');
91+
const req = httpTesting.expectOne('http://localhost/search_not_explode?ids=4,5&filter=name,%C3%89l%C3%A9onore%20%26%2C%7C%2B,age,42,nicknames,El%C3%A9,Ellie&country=Belgium');
9292
expect(req.request.method).toEqual('GET');
9393
});
9494

@@ -116,7 +116,7 @@ describe('Form Query Param testing', () => {
116116
it('should separate the query parameter with comma (object only)', async () => {
117117
service.searchNotExplode(undefined, filter, undefined).subscribe();
118118

119-
const req = httpTesting.expectOne('http://localhost/search_not_explode?filter=name,John,age,37');
119+
const req = httpTesting.expectOne('http://localhost/search_not_explode?filter=name,John,age,37,nicknames,Joe,Joey');
120120
expect(req.request.method).toEqual('GET');
121121
});
122122

0 commit comments

Comments
 (0)