Skip to content
This repository has been archived by the owner on Dec 21, 2020. It is now read-only.

OkHttp 3 #12

Open
devemux86 opened this issue Nov 15, 2017 · 7 comments
Open

OkHttp 3 #12

devemux86 opened this issue Nov 15, 2017 · 7 comments

Comments

@devemux86
Copy link

Since client-hc uses OkHttp 3, is there a reason why directions-api-clients/java is still with OkHttp 2?

It's a bit inconvenient (specially on Android) to include double similar http libs, if want to use both clients together.

@karussell
Copy link
Member

Indeed but we just use the automatically created client from swagger. Maybe they released a new version with a more recent okhttp or there is already an issue?

@boldtrn
Copy link
Member

boldtrn commented Nov 16, 2017

I had a look into swagger code gen and they have different library versions available for java:

library
            library template (sub-template) to use (Default: okhttp-gson)
                jersey1 - HTTP client: Jersey client 1.19.4. JSON processing: Jackson 2.8.9. Enable Java6 support using '-DsupportJava6=true'. Enable gzip request encoding using '-DuseGzipFeature=true'.
                feign - HTTP client: OpenFeign 9.4.0. JSON processing: Jackson 2.8.9
                jersey2 - HTTP client: Jersey client 2.25.1. JSON processing: Jackson 2.8.9
                okhttp-gson - HTTP client: OkHttp 2.7.5. JSON processing: Gson 2.8.1. Enable Parcelable models on Android using '-DparcelableModel=true'. Enable gzip request encoding using '-DuseGzipFeature=true'.
                retrofit - HTTP client: OkHttp 2.7.5. JSON processing: Gson 2.3.1 (Retrofit 1.9.0). IMPORTANT NOTE: retrofit1.x is no longer actively maintained so please upgrade to 'retrofit2' instead.
                retrofit2 - HTTP client: OkHttp 3.8.0. JSON processing: Gson 2.6.1 (Retrofit 2.3.0). Enable the RxJava adapter using '-DuseRxJava[2]=true'. (RxJava 1.x or 2.x)
                resttemplate - HTTP client: Spring RestTemplate 4.3.9-RELEASE. JSON processing: Jackson 2.8.9
                resteasy - HTTP client: Resteasy client 3.1.3.Final. JSON processing: Jackson 2.8.9

If we would choose retrofit2, we would get OkHttp3, but we would also get a different Gson version (not sure if this matters). I just tried that here.

I haven't tested it though, just ran the generation and as usual swagger generates a huge change :).

@devemux86, do you think your issue would be resolved with this update?

BTW: I used Swagger-Codegen 2.2.3, which is still the current stable and it could not find the language R, maybe the current state of this repo was generated with a different version of the swagger codegen?

@karussell
Copy link
Member

BTW: I used Swagger-Codegen 2.2.3, which is still the current stable and it could not find the language R, maybe the current state of this repo was generated with a different version of the swagger codegen?

Yeah, it was included recently and had to use master.

@devemux86
Copy link
Author

If understand correctly the generated code, it uses OkHttp 3 and introduces new dependency for Retrofit?

@boldtrn
Copy link
Member

boldtrn commented Nov 20, 2017

If understand correctly the generated code, it uses OkHttp 3 and introduces new dependency for Retrofit?

Yes :). Probably also not a good solution for Android?

@devemux86
Copy link
Author

Probably also not a good solution for Android?

At least would have same OkHttp 3 version. 🙂
BTW the old one mentions Retrofit too, though not required in client.

@karussell
Copy link
Member

The simplest would be to create a PR at swagger codegen, they usually merge fast and this does not sound like a big change. Or at least create an issue there ;)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants