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.
|
config.additionalProperties().put("generatedDate", ZonedDateTime.now().toString()); |
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:
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
generatedDatewould be set to Maven'sproject.build.outputTimestampproperty.openapi-generator/modules/openapi-generator/src/main/java/org/openapitools/codegen/DefaultGenerator.java
Line 289 in 6da343a
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.hideGenerationTimestampcould be set totrueby 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: