docusign / OpenAPI-Specifications

The official Docusign REST APIs Swagger Specifications
MIT License
20 stars 18 forks source link

CodeGen typing List incorrectly in generated class List #28

Closed JosephFrenchLG closed 4 years ago

JosephFrenchLG commented 4 years ago

I am trying to use the Docusign Swagger v2.1 to generate code in a Spring app with Maven by using CodeGen. I am running into an issue with the generated files – specifically the List Model

…\client\docusign\ri\model\List.java

This class is called “List” per the swagger specs. However, it contains a few properties with datatypes of java.util.List:

private List<ListItem> listItems = null;

private List<String> tabGroupLabels = null;

Unfortunately, CodeGen is typing those properties at type List from the class definition rather than java.util.List type. This is preventing successful build. Are you aware of a work around for this issue to ensure these members get typed correctly via Maven code generation?

mmallis87 commented 4 years ago

@JosephFrenchLG first thing I'll recommend to do is to try out official Java SDK instead of creating your own.

If you still see value in generating your own, note that soon I will write a blog post where I describe in details how we were able to fork Swagger Codegen and make it work for a Swagger spec as large and complex as this one.

Until then and for your specific issue, I think you can use --type-mappings parameter to override the default model-class mapping using the following values: --type-mappings number=NumberTab,LocalDate=DateTab. This option is poorly documented so you'll have to dig into Swagger Codegen code or reach out to their repo maintainers if you run into issues.