The different OpenAPI generators use Mustache as the template engine for generating the different artifacts.
In this specific use case, the version information is defined in licenseInfo.mustache
.
This template is included by the rest of templates used to generate the different client artifacts.
You can try to modify that template and provide your own version. The OpenAPI generator gives you the ability to override existing templates.
Once modified, you need to configure the tool (CLI, Maven, Gradle) you are using as your generator to indicate where to look for the modified template.
If necessary, you can even provide your own custom user defined templates.
Another approach could be to define some kind of file post-processing logic that will be executed once the generator has finished its process.
In the case of the typescript-rxjs
generator, the code to be executed must be defined as a string value in the environment variable TS_POST_PROCESS_FILE
.
A typical example:
export TS_POST_PROCESS_FILE="/usr/local/bin/prettier --write"
In your case perhaps you can define some kind of script, for instance, with sed
or other text processing tool, if you are using a linux or unix based OS, or a custom node.js script, that removes that information. The solution will depend again on the actual mechanism - CLI, Maven, Gradle,... - you are using for generating your code.
Having said that, please consider if it is necessary to put a generated file under version control. Possibly there are mechanisms that would allow it to be generated and used directly by your code, or you can define CI flows that generate an npm package that could be used in a private registry and use this package in your different projects, if necessary.
git
? If so, why commit generated files? – Buskined