OpenAPITools / OpenAPITools/openapi-generator

Configure HTTP client library with different JSON processing library

Open
#1,648 2 comments 3 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Enhancement: Feature
Dominant language
Java
Stars
26.8k
Forks
7.7k
PR merge metrics
PR metrics pending

Description

Looking at customisation.md it seems that the generator imposes to use specific pairs of http client/json processing libraries.

The pairs are specified as :

  • library template (sub-template) to use:
  • jersey1 - HTTP client: Jersey client 1.18. JSON processing: Jackson 2.4.2
  • jersey2 - HTTP client: Jersey client 2.6
  • feign - HTTP client: Netflix Feign 8.1.1. JSON processing: Jackson 2.6.3
  • okhttp-gson (default) - HTTP client: OkHttp 2.4.0. JSON processing: Gson 2.3.1
  • retrofit - HTTP client: OkHttp 2.4.0. JSON processing: Gson 2.3.1 (Retrofit 1.9.0)
  • retrofit2 - HTTP client: OkHttp 2.5.0. JSON processing: Gson 2.4 (Retrofit 2.0.0-beta2)
  • google-api-client - HTTP client: google-api-client 1.23.0. JSON processing: Jackson 2.8.9
  • rest-assured - HTTP client: rest-assured : 3.1.0. JSON processing: Gson 2.6.1. Only for Java8

However for better integration in our existing applications, we'd prefer the following pair :

HTTP client: OKHttp 3.6.0. JSON processing: Jackson 2.9.7

How would I go about using this ?
Should I craft new mustaches template and code generator by hand which might break in future releases ?
Shouldn't the configuration allow to separately specify the HTTP library and the json processing library ?

Thank you

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with docs/customization.md and trace the Java client generator's existing library configuration from the documented client templates. Define how HTTP-client and JSON-processing choices would be selected independently, then verify that the generated Java client supports the requested OkHttp and Jackson combination without requiring a separate hand-maintained template.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
api, tooling
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.