Ask a Question

Enum Generation with java client

sushilsinha
New Contributor

Enum Generation with java client

Hi when i am generating java client using openapi generator enum name is not generating properly. It is removing TEST_ with name 

 

openapi.yaml

 

fileType:
type: string
description: File type indicates test file or test run result
enum:
- TEST_PACKAGE
- TEST_RESULT_FILE

Actual generated java client is

@JsonAdapter(FileTypeEnum.Adapter.class)
public enum FileTypeEnum {
PACKAGE("TEST_PACKAGE"),

RESULT_FILE("TEST_RESULT_FILE");


EXPECTATION:

public enum FileType {
TEST_PACKAGE("package"),
TEST_RESULT_FILE("result");

private final String desc;
}


3 REPLIES 3
ponelat
Staff

Hi @sushilsinha ,

 

Not sure why "TEST_" is stripped out. Have you tried with swaggerhub-codegen, does it give the same result? @frantuma does the above ring any bells?

 

@sushilsinha you could create a bug report on either openapi-generator github repo, or if the same occurs on swaggerhub-codegen there too.

sushilsinha
New Contributor

Hi @ponelat , I didn't understand "Have you tried with swaggerhub-codegen, does it give the same result?"  

 

I am using  with https://openapi-generator.tech/docs/generators/java/

 

created bug 

https://github.com/OpenAPITools/openapi-generator/issues/14594

ponelat
Staff

@sushilsinha https://github.com/OpenAPITools/openapi-generator/ is a fork of https://github.com/swagger-api/swagger-codegen both do very similar things. 

Hopefully the bug report will get you success, it is an odd thing 🙂 

cancel
Showing results for 
Search instead for 
Did you mean: