Skip to content

Commit 6a18fb0

Browse files
committed
add string array and enum array to existing test case
Signed-off-by: titaneric <chenyihuang001@gmail.com>
1 parent f9f728c commit 6a18fb0

2 files changed

Lines changed: 22 additions & 3 deletions

File tree

modules/openapi-generator/src/test/java/org/openapitools/codegen/go/GoClientCodegenTest.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -454,9 +454,11 @@ public void testArrayDefaultValue() throws IOException {
454454
List<File> files = generator.opts(configurator.toClientOptInput()).generate();
455455
files.forEach(File::deleteOnExit);
456456
Path apiPath = Paths.get(output + "/api_default.go");
457-
String defaultArrayString = "var defaultValue []interface{} = []interface{}{\"test1\", \"test2\", 1}";
457+
String defaultStringArrayString = "var defaultValue []string = []string{\"test1\", \"test2\"}";
458+
String defaultEnumArrayString = "var defaultValue []ExampleEnum = []ExampleEnum{\"example1\"}";
458459
String defaultValueString = "var defaultValue string = \"test3\"";
459-
TestUtils.assertFileContains(apiPath, defaultArrayString);
460+
TestUtils.assertFileContains(apiPath, defaultStringArrayString);
461+
TestUtils.assertFileContains(apiPath, defaultEnumArrayString);
460462
TestUtils.assertFileContains(apiPath, defaultValueString);
461463
}
462464
}

modules/openapi-generator/src/test/resources/3_1/issue_21077.yaml

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,16 @@ paths:
1818
in: query
1919
schema:
2020
type: array
21-
default: ["test1", "test2", 1]
21+
items:
22+
type: string
23+
default: ["test1", "test2"]
24+
- name: "enumarrayparam"
25+
in: query
26+
schema:
27+
type: array
28+
items:
29+
$ref: "#/components/schemas/ExampleEnum"
30+
default: ["example1"]
2231
- name: "stringparam"
2332
in: query
2433
schema:
@@ -27,3 +36,11 @@ paths:
2736
responses:
2837
200:
2938
description: Ok
39+
40+
components:
41+
schemas:
42+
ExampleEnum:
43+
type: string
44+
enum:
45+
- example1
46+
- example2

0 commit comments

Comments
 (0)