OpenAPITools / OpenAPITools/openapi-generator

[BUG] [GRADLE] GenerateTask caching does not detect changes to the input spec

Open
#15,094 0 comments 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

Description

When the specification changes, the gradle GenerateTask keeps returning the cached result and does not detect the changes.
This can be bypassed using --rerun-tasks, but normally this should not necessary.

openapi-generator version

6.4.0
Gradle version: 8.0.2

Command line used for generation

Automatically run the openApiGenerate on build:
compileJava.dependsOn tasks.openApiGenerate

./gradlew build

Steps to reproduce

We created a custom task, but you should be able to reproduce it by linking the openApiGenerate task to the build, change the spec and rerun the build. (this will not retrigger the generation of the java classes)

Automatically run the openApiGenerate on build:
compileJava.dependsOn tasks.openApiGenerate

Suggest a fix/enhancement

The in- and output directories do not have the right type and annotations in the GenerateTask: https://docs.gradle.org/current/userguide/build_cache.html#using_annotations

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

Locate GenerateTask and compare its input and output directory declarations with Gradle's task annotation guidance linked in the issue. Reproduce with openApiGenerate wired to compileJava, change the specification, and run ./gradlew build; done means generation reruns without --rerun-tasks.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
build-system
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 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.