OpenAPITools has an npm package called openapi-generator-cli
. This package is described as follows on their GitHub page:
The OpenAPI Generator is a Java project. openapi-generator-cli will download the appropriate JAR file and invoke the java executable to run the OpenAPI Generator.
How do you specify the version of the OpenAPI generator (java project) that is used within the npm package?
On the GitHub page, under the configuration section, openapi-generator-cli is shown to be configured via a file called openapitools.json. The example config is as follows:
{
"$schema": "node_modules/@openapitools/openapi-generator-cli/config.schema.json",
"spaces": 2,
"generator-cli": {
"version": "4.3.1" // or the current latest version ;)
}
}
The documentation explains this configuration by saying:
the generator-cli version 4.3.1 is used
Does generator-cli.version refer to the version of the underlying Java project? I am confused because the npm package is referred to as the openapi-generator-cli
and the Java project is refered to as openapi-generator
.
The version refers to the openapi-generator version. Not to be confused with the openapi-generator-cli version, which has the latest as 2.7.0. For example the following code:
{
"$schema": "node_modules/@openapitools/openapi-generator-cli/config.schema.json",
"spaces": 2,
"generator-cli": {
"version": "7.0.0" <- refers to the openapi-generator version
}
}
Can be for example version 2.7.0 of the openapi-generator-cli, using the version 7.0.0 of the openapi-generator engine. The version of your project should be configured elsewhere.