You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Custom generators are not visible to openapi-generator
Custom generators can be shipped as .jar file with codegen config and templates. This works fine with maven/gradle plugins, just add the .jar with a custom generator to dependencies. However, this will not work with openapi-generator-cli because generator .jar is called using -jar option. When java is started with -jar option, then -cp (classpath) option is ignored.
A solution to this could be use of class path and main class explicitly
Add script to package.json with JAVA_OPTS='-cp custom-generator.jar' openapi-generator-cli list
You will not see the generator because -cp option is ignored
Expected behavior
A mechanism to add custom .jar files to classpath. This will make it possible to ship custom generator as a .jar file.
I can make a pull request with this fix if you approve this idea. PassThroughService can simply check if class path extensions are provided. If not, then run generator with -jar option. Otherwise, assemble class path and run main class directly.
The text was updated successfully, but these errors were encountered:
I implemented the feature but I missed how it was originally requested to accept the -cp argument. Rather than intercept a provided -cp I implemented it as a custom parameter that changes the behavior. Not sure if this is preferable or not.
Custom generators are not visible to openapi-generator
Custom generators can be shipped as
.jar
file with codegen config and templates. This works fine withmaven
/gradle
plugins, just add the.jar
with a custom generator to dependencies. However, this will not work withopenapi-generator-cli
because generator .jar is called using-jar
option. When java is started with-jar
option, then-cp
(classpath) option is ignored.A solution to this could be use of class path and main class explicitly
This will work the same as with
-jar
option, but provides the user with an option to declare custom generator.Steps to Reproduce
package.json
withJAVA_OPTS='-cp custom-generator.jar' openapi-generator-cli list
-cp
option is ignoredExpected behavior
A mechanism to add custom
.jar
files to classpath. This will make it possible to ship custom generator as a.jar
file.I can make a pull request with this fix if you approve this idea.
PassThroughService
can simply check if class path extensions are provided. If not, then run generator with-jar
option. Otherwise, assemble class path and run main class directly.The text was updated successfully, but these errors were encountered: