I added to my yaml file new "Scheme" enum:
SchemeEnum:
type: string
enum:
- SCHEME_I
- SCHEME_II
after generation is finished in generated public enum SchemeEnum I have enums like:
I("SCHEME_I"),
II("SCHEME_II");
I would like to stay with
SCHEME_I("SCHEME_I"),
SCHEME_II("SCHEME_II");
I do not know whay SpringCodegen doing this. When I add one more value, like :
SchemeEnum:
type: string
enum:
- SCHEME
- SCHEME_I
- SCHEME_II
everything is correct, I am getting
public enum SchemeEnum{
SCHEME("SCHEME"),
SCHEME_I("SCHEME_I"),
SCHEME_II("SCHEME_II");
in my generated class. Is there any way to fix it? Should I change something in configuration?
I am expecting to get generated class like this:
public enum SchemeEnum{
SCHEME_I("SCHEME_I"),
SCHEME_II("SCHEME_II");
The below yml is generating correct class structure
SchemeEnum:
type: string
enum:
- SCHEME_I
- SCHEME_II
- SCHEME_III
x-enum-varnames:
- SCHEME_I
- SCHEME_II
- SCHEME_III
with below dependencies and plugin
<dependency>
<groupId>io.swagger.core.v3</groupId>
<artifactId>swagger-annotations</artifactId>
<version>2.2.19</version>
</dependency>
<dependency>
<groupId>org.openapitools</groupId>
<artifactId>jackson-databind-nullable</artifactId>
<version>0.2.6</version>
</dependency>
<build>
<plugins>
<plugin>
<groupId>org.openapitools</groupId>
<artifactId>openapi-generator-maven-plugin</artifactId>
<version>7.4.0</version>
<executions>
<execution>
<id>order-inbound</id>
<goals>
<goal>generate</goal>
</goals>
<configuration>
<inputSpec>
${project.basedir}/src/main/resources/swagger/grocery-app-v1.json
</inputSpec>
<generatorName>spring</generatorName>
<generateApis>false</generateApis>
<generateModels>true</generateModels>
<generateModelDocumentation>false</generateModelDocumentation>
<generateModelTests>false</generateModelTests>
<generateSupportingFiles>false</generateSupportingFiles>
<modelPackage>com.dev.model.generated</modelPackage>
<configOptions>
<dateLibrary>java8</dateLibrary>
<Library>spring-boot</Library>
</configOptions>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>