File tree Expand file tree Collapse file tree 2 files changed +57
-0
lines changed
modules/openapi-generator/src/test
java/org/openapitools/codegen/go Expand file tree Collapse file tree 2 files changed +57
-0
lines changed Original file line number Diff line number Diff line change @@ -396,4 +396,25 @@ public void testAdditionalPropertiesWithoutGoMod() throws Exception {
396396 Path goSumFile = Paths .get (output + "/go.sum" );
397397 TestUtils .assertFileNotExists (goSumFile );
398398 }
399+
400+ @ Test
401+ public void testInlineEnums_issue9567 () throws Exception {
402+ File output = Files .createTempDirectory ("test" ).toFile ();
403+ output .deleteOnExit ();
404+
405+ final CodegenConfigurator configurator = new CodegenConfigurator ()
406+ .setGeneratorName ("go" )
407+ .setInputSpec ("src/test/resources/bugs/issue_9567.yaml" )
408+ .setOutputDir (output .getAbsolutePath ().replace ("\\ " , "/" ))
409+ .addInlineSchemaOption ("RESOLVE_INLINE_ENUMS" , "true" )
410+ .addAdditionalProperty (GoClientCodegen .WITH_GO_MOD , false );
411+
412+ DefaultGenerator generator = new DefaultGenerator ();
413+ List <File > files = generator .opts (configurator .toClientOptInput ()).generate ();
414+ System .out .println (files );
415+ files .forEach (File ::deleteOnExit );
416+
417+ Path enumFile = Paths .get (output + "/model_pet_status.go" );
418+ TestUtils .assertFileExists (enumFile );
419+ }
399420}
Original file line number Diff line number Diff line change 1+ openapi : 3.0.1
2+ info :
3+ title : TEST
4+ description : |-
5+ ## TEST
6+ version : 1.0.0
7+
8+ servers :
9+ - url : /v3
10+ description : Major version of service
11+
12+ paths :
13+ /agreements :
14+ get :
15+ operationId : readAPet
16+ responses :
17+ " 200 " :
18+ description : OK
19+ content :
20+ ' */* ' :
21+ schema :
22+ $ref : ' #/components/schemas/Pet'
23+ components :
24+ schemas :
25+ Pet :
26+ title : a Pet
27+ description : A pet for sale in the pet store
28+ type : object
29+ properties :
30+ status :
31+ type : string
32+ description : pet status in the store
33+ enum :
34+ - available
35+ - pending
36+ - sold
You can’t perform that action at this time.
0 commit comments