mirror of
https://github.com/OpenAPITools/openapi-generator.git
synced 2025-07-03 06:00:52 +00:00
Use new functionality to add 't' as a command line option to set 'templateDir'
This commit is contained in:
parent
33436d62c3
commit
d7dec5a43d
46
modules/swagger-codegen/nbactions.xml
Normal file
46
modules/swagger-codegen/nbactions.xml
Normal file
@ -0,0 +1,46 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<actions>
|
||||
<action>
|
||||
<actionName>run</actionName>
|
||||
<packagings>
|
||||
<packaging>jar</packaging>
|
||||
</packagings>
|
||||
<goals>
|
||||
<goal>process-classes</goal>
|
||||
<goal>org.codehaus.mojo:exec-maven-plugin:1.2.1:exec</goal>
|
||||
</goals>
|
||||
<properties>
|
||||
<exec.args>-classpath %classpath ${packageClassName} generate -i http://hyeghsealnxd1.bigfish.lan:83/gamestatus.json -l java -o /home/hrachya/Desktop/codegen/java -t blah</exec.args>
|
||||
<exec.executable>java</exec.executable>
|
||||
</properties>
|
||||
</action>
|
||||
<action>
|
||||
<actionName>debug</actionName>
|
||||
<packagings>
|
||||
<packaging>jar</packaging>
|
||||
</packagings>
|
||||
<goals>
|
||||
<goal>process-classes</goal>
|
||||
<goal>org.codehaus.mojo:exec-maven-plugin:1.2.1:exec</goal>
|
||||
</goals>
|
||||
<properties>
|
||||
<exec.args>-Xdebug -Xrunjdwp:transport=dt_socket,server=n,address=${jpda.address} -classpath %classpath ${packageClassName} generate -i http://hyeghsealnxd1.bigfish.lan:83/gamestatus.json -l java -o /home/hrachya/Desktop/codegen/java -t blah</exec.args>
|
||||
<exec.executable>java</exec.executable>
|
||||
<jpda.listen>true</jpda.listen>
|
||||
</properties>
|
||||
</action>
|
||||
<action>
|
||||
<actionName>profile</actionName>
|
||||
<packagings>
|
||||
<packaging>jar</packaging>
|
||||
</packagings>
|
||||
<goals>
|
||||
<goal>process-classes</goal>
|
||||
<goal>org.codehaus.mojo:exec-maven-plugin:1.2.1:exec</goal>
|
||||
</goals>
|
||||
<properties>
|
||||
<exec.args>-classpath %classpath ${packageClassName} generate -i http://hyeghsealnxd1.bigfish.lan:83/gamestatus.json -l java -o /home/hrachya/Desktop/codegen/java -t blah</exec.args>
|
||||
<exec.executable>java</exec.executable>
|
||||
</properties>
|
||||
</action>
|
||||
</actions>
|
@ -47,7 +47,6 @@ public class Codegen extends DefaultGenerator {
|
||||
options.addOption("l", "lang", true, "client language to generate.\nAvailable languages include:\n\t[" + configString + "]");
|
||||
options.addOption("o", "output", true, "where to write the generated files");
|
||||
options.addOption("i", "input-spec", true, "location of the swagger spec, as URL or file");
|
||||
options.addOption("t", "template-dir", true, "folder containing the template files");
|
||||
options.addOption("d", "debug-info", false, "prints additional info for debugging");
|
||||
options.addOption("a", "auth", true, "adds authorization headers when fetching the swagger definitions remotely. Pass in a URL-encoded string of name:header with a comma separating multiple values");
|
||||
|
||||
@ -114,8 +113,6 @@ public class Codegen extends DefaultGenerator {
|
||||
}
|
||||
if (cmd.hasOption("i"))
|
||||
swagger = new SwaggerParser().read(cmd.getOptionValue("i"), clientOptInput.getAuthorizationValues(), true);
|
||||
if (cmd.hasOption("t"))
|
||||
clientOpts.getProperties().put("templateDir", String.valueOf(cmd.getOptionValue("t")));
|
||||
|
||||
//add all passed cliOptions to clientOpts.properties
|
||||
for (CliOption langCliOption : clientOptInput.getConfig().cliOptions()) {
|
||||
|
@ -84,8 +84,8 @@ public class DefaultCodegen {
|
||||
}
|
||||
|
||||
public void processOpts(){
|
||||
if(additionalProperties.containsKey("templateDir")) {
|
||||
this.setTemplateDir((String)additionalProperties.get("templateDir"));
|
||||
if(additionalProperties.containsKey("t")) {
|
||||
this.setTemplateDir((String)additionalProperties.get("t"));
|
||||
}
|
||||
}
|
||||
|
||||
@ -286,6 +286,8 @@ public class DefaultCodegen {
|
||||
importMapping.put("LocalDateTime", "org.joda.time.*");
|
||||
importMapping.put("LocalDate", "org.joda.time.*");
|
||||
importMapping.put("LocalTime", "org.joda.time.*");
|
||||
|
||||
cliOptions.add(new CliOption("t", "template-dir", true, "folder containing the template files"));
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user