Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Java] [okhttp-gson] Updating OkHttp to version 3.x #9606

Closed
nicktrav opened this issue Jul 27, 2019 · 5 comments · Fixed by #12017
Closed

[Java] [okhttp-gson] Updating OkHttp to version 3.x #9606

nicktrav opened this issue Jul 27, 2019 · 5 comments · Fixed by #12017

Comments

@nicktrav
Copy link

Description

I'd like to gauge the appetite for upgrading the version of OkHttp in the okhttp-gson module to a version in the 3.x series. Version 2.7.5 dates back to Feb 26, 2016, and there hasn't been an update since then.

Happy to put together a patch just for this module, but I first wanted to check to see if this is something that makes sense? Would this type of change need to wait for a major release of swagger-codegen, or could it be something that's released in a minor version - from what I can tell there would be API changes given the OkHttp package name is different in version 3.x and the API in okhttp-gson exposes some OkHttp classes.

Swagger-codegen version

3.0.10.

Related issues/PRs

This would help make progress on kubernetes-client/java#430. We'd love to be using a more recent version of OkHttp!

Suggest a fix/enhancement

Would be willing to offer up a patch (I have something already) if there's someone that would be willing to guide me through the process (my first time committing to this repo, so I might be missing some subtleties).

@frantuma
Copy link
Member

frantuma commented Aug 5, 2019

Thanks for this, a patch/PR is more than welcome!

this basically would mean touching related java class JavaClientCodegen (in 3.0.0 branch if supporting OpenApi 3.x), providing a new version option and updating relevant code and related template files

In case the differences are massive, it could make sense to add a new library option okhttp-gson-v3 instead of modifying the current one.

this would still involve JavaClientCodegen, adding there a library and related template files in new directory okhttp-gson-v3 in this resource dir

@heng4fun
Copy link

Any progress about this?

@nemanjakmno
Copy link

Anything yet?

@matpag
Copy link

matpag commented May 31, 2022

Any news about this?
OkHttp 2.7.5 is 6 years old now, I don't know if generating the java client with Swagger is the right thing at this point...

@meena561
Copy link

Any update on this?

deepsan added a commit to deepsan/swagger-codegen that referenced this issue Jan 12, 2023
Add support for okhttp4-gson as a replacement for okhttp-gson

okhttp-gson is based on okhttp 2.x which is no longer supported. okhttp 3.x is also [not supported anymore](https://square.github.io/okhttp/security/security/)

Creating a new target for codegen since okhttp 4.x is a breaking change over the okhttp 2.x with the changed package names.

The overall change is similar to the existing code with a few updates
- updates due to deprecations documented in https://square.github.io/okhttp/changelogs/changelog_3x/#version-300-rc1
- kept the utility methods in the existing code as-is

tested `mvn package`, ran the petstore generation scripts and the integration tests that are generated

Fixes swagger-api#9606
@deepsan deepsan mentioned this issue Jan 12, 2023
4 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
6 participants