OpenAPITools / OpenAPITools/openapi-generator

[REQ][Java] Update the build to verify generated Java code passes common linters

Open
#24,746 2 comments 2 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.

There are plenty of issues raised, where generated code fails to compile with common linters, e.g., javac -Xlint:all -Werror. This forces consumers to add workarounds, such as using separate javac invocations or disabling certain lint checks for the entire project.

Describe the solution you'd like

The build of this project attempts to compile all Java samples with all linters (at least the very common ones, i.e., javac, javadoc, Error Prone, NullAway, and Checkstyle). This would prevent new violations from finding their way into the project.

Describe alternatives you've considered

Retain the status quo and have users report violations instead. This is problematic because users will often not bother to report issues and when they do, they will often not have the knowledge to contribute a fix. Whereas if the required checks would be done at the moment a PR is created, it's often trivial for the author of the PR to fix any violations.

Additional context

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 examining the project build and how it compiles the Java samples. Determine how javac, javadoc, Error Prone, NullAway, and Checkstyle could be run against generated code, then verify the build catches common lint violations without requiring consumer workarounds.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
build-system, ci-cd, testing-qa
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.