OpenAPITools / OpenAPITools/openapi-generator

[BUG][Java][client] `mvn package` fails on Javadoc error

Open
#3,272 9 comments 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

Bug Report Checklist
  • [*] Have you provided a full/minimal spec to reproduce the issue?
    • Any spec reproduces this, even the one included in samples
  • [*] Have you validated the input using an OpenAPI validator (example)?
  • [*] What's the version of OpenAPI Generator used?
    • seems all versions are affected, tested on 4.0.2 and master
  • [*] Have you search for related issues/PRs?
  • [*] What's the actual output vs expected output?
    • See below
  • [Optional] Bounty to sponsor the fix (example)
Description

Generated Java client (okhttp-gson) fails to build, erroring out on javadoc issues. This is reproducible even on samples/client/petstore/java/okhttp-gson for me. The output of mvn package is as follows:

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-javadoc-plugin:2.10.4:jar (attach-javadocs) on project petstore-okhttp-gson: MavenReportException: Error while generating Javadoc:
[ERROR] Exit code: 1 - javadoc: error - The code being documented uses modules but the packages defined in http://docs.oracle.com/javase/8/docs/api/ are in the unnamed module.
[ERROR] /Users/slavek.kabrda/programming/openapi-generator/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/api/AnotherFakeApi.java:64: error: attribute not supported in HTML5: summary
[ERROR]      <table summary="Response Details" border="1">
[ERROR]             ^
# and many more error lines repeating the "table summary" error

It seems that there are 2 separate issues - the "table summary" being incorrect for HTML 5 and the other: "The code being documented uses modules but the packages defined in http://docs.oracle.com/javase/8/docs/api/ are in the unnamed module."

openapi-generator version

Seems to be both in 4.0.2 and current master.

OpenAPI declaration file content or url

Use the one included in samples.

Command line used for generation

None, just trying to build samples/client/petstore/java/okhttp-gson after cloning the repo.

Steps to reproduce
$ cd samples/client/petstore/java/okhttp-gson
$ mvn package
Related issues/PRs

None AFAICS.

Suggest a fix

For the first problem ("table summary"), we could probably easily fix the HTML to produce something that is compatible with HTML 5.

For the other issue, I guess the problem is a version combination of my JDK/maven, but I'm not a Java expert, so I don't know. Quick googling around didn't really help. My environment:

$ mvn -v
Apache Maven 3.6.1 (d66c9c0b3152b2e69ee9bac180bb8fcc8e6af555; 2019-04-04T21:00:29+02:00)
Maven home: /usr/local/Cellar/maven/3.6.1/libexec
Java version: 12.0.1, vendor: AdoptOpenJDK, runtime: /Library/Java/JavaVirtualMachines/adoptopenjdk-12.0.1.jdk/Contents/Home
Default locale: en_CZ, platform encoding: UTF-8
OS name: "mac os x", version: "10.14.5", arch: "x86_64", family: "mac"

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 in samples/client/petstore/java/okhttp-gson and run mvn package to reproduce the failure. Inspect the generated AnotherFakeApi.java Javadoc around the table summary attribute, then investigate the separate module-related Javadoc error using the reported Java 12 and Maven versions. Done means the sample package completes without these Javadoc errors.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
build-system
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.