[BUG?] Why do generation parameters for CLI and Maven Plugin differ?
Bug Report Checklist
I noticed that the code generator parameters I can pass to the CLI and the Maven Plugin differ. When we consider Java as target language, here are the parameters the CLI understands: https://openapi-generator.tech/docs/generators/java Here are the parameters the Maven Plugin supports: https://github.com/OpenAPITools/openapi-generator/tree/master/modules/openapi-generator-maven-plugin
One particular example:
The Maven Plugin understands removeOperationIdPrefix, whereas the CLI does not.
I would expect that both parameter lists are equal, as in the end it should not matter whether I use the CLI or the Maven Plugin.
Is this a misunderstanding?
I think I ran into this issue as well. I tried the following:
CLI options
openapi-generator-cli generate --remove-operation-id-prefix --remove-operation-id-prefix-delimiter . --remove-operation-id-prefix-count -1 ...
Does recognize --remove-operation-id-prefix, but not the others:
[error] Found unexpected parameters: [--remove-operation-id-prefix-delimiter, ., --remove-operation-id-prefix-count, -1]
In addition it does not seem to work, as I still get full method names.
Additional properties
openapi-generator-cli generate --additional-properties=removeOperationIdPrefix=true,removeOperationIdPrefixDelimiter=.,removeOperationIdPrefixCount=-1 ...
Does not seem to do anything.
Config
openapi-generator-cli generate --config config.yaml ...
in config.yaml:
removeOperationIdPrefix: true
removeOperationIdPrefixDelimiter: "."
removeOperationIdPrefixCount: -1
Does not seem to do anything.
I'm quite confused how it should work or whether this is a bug.
Bumping this issue, since it seems that it persists in the 7.5.0 stable version as well
openapi-generator-cli generate --additional-properties=removeOperationIdPrefix=true,removeOperationIdPrefixDelimiter=.,removeOperationIdPrefixCount=-1 ...
those are global/general options (available to all generators) and it shouldn't be set via additional properties (which is for generator's options)
Hello @wing328, thanks for the update. I tried the following command that @bobvanderlinden also tried with version 7.5.0:
java -jar openapi-generator-cli.jar generate -i https://geoserver.dx.ugix.org.in/api -g python --remove-operation-id-prefix --remove-operation-id-prefix-delimiter . --remove-operation-id-prefix-count -1
but I get the same error they mentioned:
[error] Found unexpected parameters: [--remove-operation-id-prefix-delimiter, ., --remove-operation-id-prefix-count, -1]
See 'openapi-generator-cli help' for usage.
Thanks for the help.
can you try the following instead?
java -jar modules/openapi-generator-cli/target/openapi-generator-cli.jar generate -i https://geoserver.dx.ugix.org.in/api -g python --remove-operation-id-prefix --additional-properties removeOperationIdPrefixDelimiter=.,removeOperationIdPrefixCount=-1
I though all 3 are global options and I was wrong. ref: https://github.com/OpenAPITools/openapi-generator/commit/bd18ba6b418a0cddc31e73fdd10d8d013244601d#diff-3a138675e8cb40943bcb00feb46edd6f6ee5c5306c29cc19f02c845a299c8658R328
removeOperationIdPrefixDelimiter, removeOperationIdPrefixCount were added later via another PR and the author uses additional properties instead.
definitely we need to improve the documentation for this.
sorry for the inconvenience caused.
Hello @wing328,
The command you shared works as intended, thanks so much for the help. Also, per the commit you shared, the 'remove operation ID prefix' boolean config value is also recognized/accepted in additionalProperties (see here), so the following command also works:
java -jar openapi-generator-cli.jar generate -i https://geoserver.dx.ugix.org.in/api -g python --additional-properties removeOperationIdPrefix=true,removeOperationIdPrefixDelimiter=-,removeOperationIdPrefixCount=-1
I understand that since the removeOperationIdPrefixDelimiter and removeOperationIdPrefixCount options are in the additionalProperties, they may need to be updated in every supported language's additionalProperties documentation, so that must be a big change. Would it be better if these 2 options are in the global options itself? If yes, I can try to make a PR to fix this.
Thanks again for the help!
thanks for confirming the command works.
let's keep it as it's for the time being (because flipping the option to make it global will likely break some use cases out there)
if there are more demands to "normalize" this option, we will reconsider.