Skip to content

[BUG] [feign-java] default client changed; okhttp vs httpclient5 are now the same? #21187

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

Open
4 of 6 tasks
lesteenman opened this issue Apr 30, 2025 · 0 comments
Open
4 of 6 tasks

Comments

@lesteenman
Copy link

lesteenman commented Apr 30, 2025

Bug Report Checklist

  • Have you provided a full/minimal spec to reproduce the issue?
  • Have you validated the input using an OpenAPI validator (example)?
  • Have you tested with the latest master to confirm the issue still exists?
  • Have you searched for related issues/PRs?
  • What's the actual output vs expected output?
  • [Optional] Sponsorship to speed up the bug fix or feature request (example)
Description

Since OpenAPI generator 7.13.0, our patch methods have stopped working. It turns out that #21085 resulted in our client implementations being changed from OkHTTP to the default Feign one, which does not support patch methods. This means that that performance fix has caused a backwards incompatible change in the library.

Furthermore, in the same version, HttpClient5 support was added for feign (#21007). From what I can see, this no longer does anything either - since there are no default clients created, you will never get HttpClient5 nor OkHttp out of the box.

openapi-generator version

Changed in 7.13.0

OpenAPI declaration file content or url

Java-Feign HttpClient5

generatorName: java
outputDir: samples/client/petstore/java/feign-hc5
library: feign-hc5

Java-Feign:

generatorName: java
outputDir: samples/client/petstore/java/feign
library: feign

Under 7.13.0 (broken):

Java-Feign HttpClient5 builder:

    feignBuilder = Feign.builder()
                .encoder(new FormEncoder(new JacksonEncoder(objectMapper)))
                .decoder(new ApiResponseDecoder(objectMapper))
                .errorDecoder(new ApiErrorDecoder())
                .retryer(new Retryer.Default(0, 0, 2))
                .logger(new Slf4jLogger());

Or Java-Feign builder:

    feignBuilder = Feign.builder()
                .encoder(new FormEncoder(new JacksonEncoder(objectMapper)))
                .decoder(new ApiResponseDecoder(objectMapper))
                .errorDecoder(new ApiErrorDecoder())
                .retryer(new Retryer.Default(0, 0, 2))
                .logger(new Slf4jLogger());

Before merging #21085:

Java-Feign HttpClient5 builder:

    feignBuilder = Feign.builder()
                .client(new ApacheHttp5Client())
                .encoder(new FormEncoder(new JacksonEncoder(objectMapper)))
                .decoder(new ApiResponseDecoder(objectMapper))
                .errorDecoder(new ApiErrorDecoder())
                .retryer(new Retryer.Default(0, 0, 2))
                .logger(new Slf4jLogger());

Or Java-Feign builder:

    feignBuilder = Feign.builder()
                .client(new OkHttpClient())
                .encoder(new FormEncoder(new JacksonEncoder(objectMapper)))
                .decoder(new ApiResponseDecoder(objectMapper))
                .errorDecoder(new ApiErrorDecoder())
                .retryer(new Retryer.Default(0, 0, 2))
                .logger(new Slf4jLogger());
Generation Details

See description.

Steps to reproduce
  • Build a java client with library feign or feign-hc5
  • Check the feign builder
Related issues/PRs

"Broken" in #21085

Suggest a fix

We should either:

Remove the default clients entirely
  • remove httpclient5 flavor
  • remove the implementation imports for okhttp and httpclient5 from the pom.xml and build.gradle files
  • make it clear you need to supply your own client
Support the clients again
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant