Erros when generating Pipedrive API Java client with Swagger

Hello, I am currently tring to use Swagger to generate a Java client for the Pipedrive API.
I tried generating the client through the maven plugin - swagger-codegen/modules/swagger-codegen-maven-plugin at master · swagger-api/swagger-codegen · GitHub,
and through the cli generator - GitHub - swagger-api/swagger-codegen: swagger-codegen contains a template-driven engine to generate documentation, API clients and server stubs in different languages by parsing your OpenAPI / Swagger definition., but both of the methods give the same errors: in a couple of the classes there are fields which are of incompatible types.
For example the field “active_flag” is generated as the type “ActiveFlagEnum”, but the code is trying to convert it to a BigDecimal, and so when compiling the project, I get an error for incompatible types:

@JsonProperty(“active_flag”)
private ActiveFlagEnum activeFlag = new BigDecimal(1);

Could this be some sort of configuration option which I have to include when generating the client, or is there something wrong with the Pipedrive API or Swagger?

1 Like

Hey @TashoGeorgiev
We haven’t generated a Java client yet and unfortunately, I see that this is a bit cumbersome. While I check with the concerned team, I am curious to know how you solved the challenge?

I see that you made some good progress from this thread (which is cool btw) Swagger codegen missing nested objects. Feel free to share your findings

Hi, I’ve managed to get around this problem by changing the types of the data in the Open API JSON, which is a quick solution, but it will break when there is an update in the json. I can’t figure out if this is coming from swagger or the API json.

2 Likes

Would you mind sharing your results? I’m also struggling with generating a java client and will continue with a simple Retrofit solution instead now :wink: