OpenAPITools / OpenAPITools/openapi-generator

[BUG] supportJava6=true creates a client with dependencies that do not support Java 6

Open
#8,383 6 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Client: Java Issue: Bug
Dominant language
Java
Stars
26.8k
Forks
7.7k
PR merge metrics
PR metrics pending

Description

Goodmorning,

I am trying to generate an API client in Java with Open API. Sadly, it needs to work with java 6. I enable the flag, and everything works fine in the development environment (Eclipse) running on Java 11 with compliance for Java 6. When I export the JAR and try to run it in the staging environment with JRE 1.6, I get the error ClassDefNotFound okhttp3/Interceptor. If I try to download this dependency from Maven I then get Unsupported major.minor version 52.0.

So, I am wondering if the flag supportJava6 actually does something or not, since it seems like it requires at least Java 8.

Am I doing something wrong?

I generated the client from the CLI Docker like this:

// from docker-compose.yml

version: "3.6"
services:

  openapi:
    image: openapitools/openapi-generator-cli
    volumes:
      - ".:local"
    command: generate -g java -I local/in/api.yml -o /local/out/java-client --additional-properties=supportJava6=true

Best regards

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 by reproducing the Docker CLI command from docker-compose.yml with supportJava6=true and the input in/in/api.yml. Inspect the generated Java client's dependency declarations and verify them on JRE 1.6; done means the generated client and its dependencies no longer require a newer Java version.

Written by the indexing model from the issue text.

Assessment

Tech stack
docker, java
Domain
tooling
Issue type
Bug
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.