Forum Discussion

andrewfg's avatar
andrewfg
New Member
18 days ago

Swagger CodeGen declares multiple JSON fields named 'type'

Relates to swagger-codegen-maven-plugin.

In OpenHAB one of its 450 odd third party integrations uses Swagger CodeGen to convert an API YAML file to respective Java API DTOs. We were using CodeGen v2.3.1 but we recently attempted to upgrade to CodeGen v2.4.41 -- but failed.

The API and the respective YAML have API fields name 'type' and CodeGen v2.3.1 creates them them in the DTO and applies the @SerializedName("type") annotation to them. When attemting to use  CodeGen v2.4.41 we started seeing GSON exceptions that the DTO "declares multiple JSON fields named 'type'".

I am wondering what happened, and how to fix it?

See this https://github.com/openhab/openhab-addons/issues/16779 for more..

 

No RepliesBe the first to reply