Open alexec opened 11 months ago
I'd use native, but that is Java 11+.
what about the default which is okhttp-gson
? it should work with JDK8
Same thing forme, i am sitting with an older code base using Java and i cant i my life get the maven plugin or the cli generator to make me a client that works. Either there is miss matching in file names, packeges or imports.
Maven pluggin 7.0.0 is not able to run under Java 8 så i need to go back to an older version, but still just issues. Spent to much time on this and do someone know if there is a known version and setup for generating a Java client using an OpenApi 3.0.1 spec, using Java 1.8 and Maven.
My conclusion is: Unless you have a need to integrate with a specific framework, use native
for Java 11+ and apache-httpclient
for Java 8+.
I spend several hours testing out the different Java generator libraries and evaluating them. Here is that tabulated:
I may have made mistakes, please correct and I'll update.
Commentary:
java
generator has ~14 library options. Python and Javascript have just two, Golang just one. This seems a Java only problem.ApiClient
or DefaultAPI
an interface rather than a class.Here are the runtime dependencies of native
:
Here are the runtime dependencies of apache-httpclient
:
In this list, I've struck out dependencies that Maven identified as unused. You could probably remove them.
@alexec
Awesome writing, thank you. And yes the Java generator feels awful i agree. I am not a fun of Java in the first hand but this have been such a mess to get going. What i ended upp doing is made my self a script that first clean out old generated god, then generate new one with a .openapi-ignore file so it just generates the client code that i want, and some supporting files. And since the Java8 generator is so buggy and not able to place the package and the folder structure in a good way i just used some terminal move command and then som folder cleaning with the script.....
I can see why anyone could use this in a production environment.
I need to generate client for many (100s to 1000s of API specifications) to be used by many (100s to 1000s) of consumers.
Describe the solution you'd like
A lowest common denominator client.
Describe alternatives you've considered
I'd use
native
, but that is Java 11+.What's the most widely compatible option? Should I write my own using
HTTPUrlConnection
?