OpenAPITools / OpenAPITools/openapi-generator
[REQ] Generated date should be reproducible (or disabled by default)
Nobody has claimed this yet.
- 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.
To meet the requirements of Reproducible Builds, generated timestamps should be predicable (so that packages can be rebuild with the same source and produce the same output)
Describe the solution you'd like
For projects using the Maven plugin, this could mean that the generatedDate would be set to Maven's project.build.outputTimestamp property.
Gradle's approach to this is to use a fixed date:
https://github.com/gradle/gradle/blob/f4fcd0b4f2c6a1903f80a4299a540d73d722f127/platforms/core-runtime/files/src/main/java/org/gradle/api/internal/file/archive/ZipEntryConstants.java#L24-L39
Describe alternatives you've considered
Alternatively configOptions.hideGenerationTimestamp could be set to true by default.
Another alternative would be to use the timestamp of the openapi spec file. There are a lot of edge cases around this, the file could be downloaded and timestamp not preserved, file could be copied at build time (and timestamp not preserved). Additionally, other inputs to the generator could change resulting in different code using the same source spec. So this probably isn't a valid option.
Additional context
See:
- Maven Artifact Plugin (list of non-compliant and fixed plugin versions)
- Maven Reproducible Builds Guide
- Maven Reproducible Builds wiki page
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start at modules/openapi-generator/src/main/java/org/openapitools/codegen/DefaultGenerator.java around line 289 and trace how generatedDate is set for Maven plugin users. Compare using Maven's project.build.outputTimestamp with disabling the timestamp by default, then define and verify behavior where repeated builds from the same inputs produce identical output.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- build-system
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100