File tree Expand file tree Collapse file tree
modules/openapi-generator/src/test
java/org/openapitools/codegen/go Expand file tree Collapse file tree Original file line number Diff line number Diff 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}
Original file line number Diff line number Diff 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
You can’t perform that action at this time.
0 commit comments