OpenAPITools / OpenAPITools/openapi-generator

[REQ] [Java] API classes do not have a sufficient javadoc causing failing builds when running `mvn javadoc:javadoc` with `-Werror` enabled

Open
#17,704 0 comments 0 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

Is your feature request related to a problem? Please describe.

When generating Java servers the API class defined in api.mustache and apiInterface.mustache does not have java doc.
When running mvn javadoc:javadoc this becomes a warning, which due to -Werror becomes an error and the build fails.

This is tested on openjdk version "17.0.9".

A PR is incoming.

Describe the solution you'd like

I propose additions to the api.mustache and apiInterface.mustache files so that there is some javadoc there.

For api.mustache (text borrowed from csharp/api.interface:

/**
 * Represents a collection of functions to interact with the API endpoints. 
 */

And the same for apiResponse.mustache:

/**
 * {{{notes}}}
 *
 {{#allParams}}
 * @param {{paramName}} {{description}}
 {{/allParams}}
 {{#responses}}
 * @return {{{message}}}
 {{/responses}}
 */

Describe alternatives you've considered

We've implemented two alternative solutions.

Exclusion in pom.xml

In our pom.xml we can exclude the files, but this is quite a big hammer because the files are very close to passing the checks.

Add a local api.mustache template with the needed changes

This solutions works a little better but requires us to copy the entire api.mustache and apiInterface.mustache files into our repository, making it much more cumbersome to migrate to a future version of openapi-generator.

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 the Java server templates api.mustache, apiInterface.mustache, and apiResponse.mustache. Run mvn javadoc:javadoc with -Werror on a generated server to reproduce the warnings; done means the generated API classes have sufficient Javadoc and the build completes without Javadoc errors.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
api, build-system, documentation
Issue type
Documentation
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.