java - How to call swagger codegen programatically? -


i generating restful java jax-rs api swagger-codgen-cli.jar.
right call java -jar command line options this.

java -jar swagger-codegen-cli.jar generate -i api.yaml -l jaxrs -o ./outputdir 

which works fine.

but make call of java program i.e. including codegen.jar classpath , call corresponding method similar parameters.

so there public api swagger-codegen module can call?

if correctly understand need, dinamically generate stub classes. why don't use swagger-codegen-maven-plugin generate stub classes?

as reported in usage section, add build->plugins section (default phase generate-sources phase)

<plugin>     <groupid>com.garethevans.plugin</groupid>     <artifactid>swagger-codegen-maven-plugin</artifactid>     <version>${project.version}</version>     <executions>         <execution>             <goals>                 <goal>generate</goal>             </goals>             <configuration>                 <inputspec>src/main/resources/api.yaml</inputspec>                 <language>java</language>             </configuration>         </execution>     </executions> </plugin> 

if execute command program may use runtime.getruntime().exec() or runtime.getruntime().exec() alternatives


Comments

Popular posts from this blog

html - Outlook 2010 Anchor (url/address/link) -

javascript - Why does running this loop 9 times take 100x longer than running it 8 times? -

Getting gateway time-out Rails app with Nginx + Puma running on Digital Ocean -