- com.wordnik
+ io.swagger
swagger-codegen
${project.version}
diff --git a/modules/swagger-codegen-cli/src/main/java/com/wordnik/swagger/codegen/SwaggerCodegen.java b/modules/swagger-codegen-cli/src/main/java/io/swagger/codegen/SwaggerCodegen.java
similarity index 78%
rename from modules/swagger-codegen-cli/src/main/java/com/wordnik/swagger/codegen/SwaggerCodegen.java
rename to modules/swagger-codegen-cli/src/main/java/io/swagger/codegen/SwaggerCodegen.java
index f2c794776ce..3cdc01fe3f5 100644
--- a/modules/swagger-codegen-cli/src/main/java/com/wordnik/swagger/codegen/SwaggerCodegen.java
+++ b/modules/swagger-codegen-cli/src/main/java/io/swagger/codegen/SwaggerCodegen.java
@@ -1,17 +1,17 @@
-package com.wordnik.swagger.codegen;
+package io.swagger.codegen;
-import com.wordnik.swagger.codegen.cmd.ConfigHelp;
-import com.wordnik.swagger.codegen.cmd.Generate;
-import com.wordnik.swagger.codegen.cmd.Langs;
-import com.wordnik.swagger.codegen.cmd.Meta;
import io.airlift.airline.Cli;
import io.airlift.airline.Help;
+import io.swagger.codegen.cmd.ConfigHelp;
+import io.swagger.codegen.cmd.Generate;
+import io.swagger.codegen.cmd.Langs;
+import io.swagger.codegen.cmd.Meta;
/**
* User: lanwen
* Date: 24.03.15
* Time: 17:56
- *
+ *
* Command line interface for swagger codegen
* use `swagger-codegen-cli.jar help` for more info
*
diff --git a/modules/swagger-codegen-cli/src/main/java/com/wordnik/swagger/codegen/cmd/ConfigHelp.java b/modules/swagger-codegen-cli/src/main/java/io/swagger/codegen/cmd/ConfigHelp.java
similarity index 91%
rename from modules/swagger-codegen-cli/src/main/java/com/wordnik/swagger/codegen/cmd/ConfigHelp.java
rename to modules/swagger-codegen-cli/src/main/java/io/swagger/codegen/cmd/ConfigHelp.java
index fbdca12e6e8..6b34a4bf56d 100644
--- a/modules/swagger-codegen-cli/src/main/java/com/wordnik/swagger/codegen/cmd/ConfigHelp.java
+++ b/modules/swagger-codegen-cli/src/main/java/io/swagger/codegen/cmd/ConfigHelp.java
@@ -1,33 +1,24 @@
-package com.wordnik.swagger.codegen.cmd;
+package io.swagger.codegen.cmd;
-import com.wordnik.swagger.codegen.CliOption;
-import com.wordnik.swagger.codegen.CodegenConfig;
import io.airlift.airline.Command;
import io.airlift.airline.Option;
+import io.swagger.codegen.CliOption;
+import io.swagger.codegen.CodegenConfig;
+
import java.util.ServiceLoader;
+
import static java.util.ServiceLoader.load;
@Command(name = "config-help", description = "Config help for chosen lang")
public class ConfigHelp implements Runnable {
-
+
@Option(name = {"-l", "--lang"}, title = "language", required = true,
description = "language to get config help for")
private String lang;
- @Override
- public void run() {
- System.out.println();
- CodegenConfig config = forName(lang);
- System.out.println("CONFIG OPTIONS");
- for (CliOption langCliOption : config.cliOptions()) {
- System.out.println("\t" + langCliOption.getOpt());
- System.out.println("\t " + langCliOption.getDescription());
- System.out.println();
- }
- }
-
/**
* Tries to load config class with SPI first, then with class name directly from classpath
+ *
* @param name name of config, or full qualified class name in classpath
* @return config class
*/
@@ -46,4 +37,16 @@ private static CodegenConfig forName(String name) {
throw new RuntimeException("Can't load config class with name ".concat(name), e);
}
}
+
+ @Override
+ public void run() {
+ System.out.println();
+ CodegenConfig config = forName(lang);
+ System.out.println("CONFIG OPTIONS");
+ for (CliOption langCliOption : config.cliOptions()) {
+ System.out.println("\t" + langCliOption.getOpt());
+ System.out.println("\t " + langCliOption.getDescription());
+ System.out.println();
+ }
+ }
}
diff --git a/modules/swagger-codegen-cli/src/main/java/com/wordnik/swagger/codegen/cmd/Generate.java b/modules/swagger-codegen-cli/src/main/java/io/swagger/codegen/cmd/Generate.java
similarity index 84%
rename from modules/swagger-codegen-cli/src/main/java/com/wordnik/swagger/codegen/cmd/Generate.java
rename to modules/swagger-codegen-cli/src/main/java/io/swagger/codegen/cmd/Generate.java
index 3485eb8dd24..0d7e94e8f28 100644
--- a/modules/swagger-codegen-cli/src/main/java/com/wordnik/swagger/codegen/cmd/Generate.java
+++ b/modules/swagger-codegen-cli/src/main/java/io/swagger/codegen/cmd/Generate.java
@@ -1,15 +1,15 @@
-package com.wordnik.swagger.codegen.cmd;
-
-import com.wordnik.swagger.codegen.CliOption;
-import com.wordnik.swagger.codegen.ClientOptInput;
-import com.wordnik.swagger.codegen.ClientOpts;
-import com.wordnik.swagger.codegen.CodegenConfig;
-import com.wordnik.swagger.codegen.DefaultGenerator;
-import com.wordnik.swagger.models.Swagger;
+package io.swagger.codegen.cmd;
+
import config.Config;
import config.ConfigParser;
import io.airlift.airline.Command;
import io.airlift.airline.Option;
+import io.swagger.codegen.CliOption;
+import io.swagger.codegen.ClientOptInput;
+import io.swagger.codegen.ClientOpts;
+import io.swagger.codegen.CodegenConfig;
+import io.swagger.codegen.DefaultGenerator;
+import io.swagger.models.Swagger;
import io.swagger.parser.SwaggerParser;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -57,15 +57,37 @@ public class Generate implements Runnable {
"Pass in a URL-encoded string of name:header with a comma separating multiple values")
private String auth;
- @Option( name= {"-D"}, title = "system properties", description = "sets specified system properties in " +
+ @Option(name = {"-D"}, title = "system properties", description = "sets specified system properties in " +
"the format of name=value,name=value")
private String systemProperties;
-
- @Option( name= {"-c", "--config"}, title = "configuration file", description = "Path to json configuration file. " +
+
+ @Option(name = {"-c", "--config"}, title = "configuration file", description = "Path to json configuration file. " +
"File content should be in a json format {\"optionKey\":\"optionValue\", \"optionKey1\":\"optionValue1\"...} " +
"Supported options can be different for each language. Run config-help -l {lang} command for language specific config options.")
private String configFile;
+ /**
+ * Tries to load config class with SPI first, then with class name directly from classpath
+ *
+ * @param name name of config, or full qualified class name in classpath
+ * @return config class
+ */
+ private static CodegenConfig forName(String name) {
+ ServiceLoader loader = load(CodegenConfig.class);
+ for (CodegenConfig config : loader) {
+ if (config.getName().equals(name)) {
+ return config;
+ }
+ }
+
+ // else try to load directly
+ try {
+ return (CodegenConfig) Class.forName(name).newInstance();
+ } catch (Exception e) {
+ throw new RuntimeException("Can't load config class with name ".concat(name), e);
+ }
+ }
+
@Override
public void run() {
verbosed(verbose);
@@ -84,13 +106,13 @@ public void run() {
if (null != templateDir) {
config.additionalProperties().put(TEMPLATE_DIR_PARAM, new File(templateDir).getAbsolutePath());
}
-
- if(null != configFile){
+
+ if (null != configFile) {
Config genConfig = ConfigParser.read(configFile);
if (null != genConfig) {
for (CliOption langCliOption : config.cliOptions()) {
if (genConfig.hasOption(langCliOption.getOpt())) {
- config.additionalProperties().put(langCliOption.getOpt(), genConfig.getOption(langCliOption.getOpt()));
+ config.additionalProperties().put(langCliOption.getOpt(), genConfig.getOption(langCliOption.getOpt()));
}
}
}
@@ -103,11 +125,11 @@ public void run() {
}
private void setSystemProperties() {
- if( systemProperties != null && systemProperties.length() > 0 ){
- for( String property : systemProperties.split(",")) {
+ if (systemProperties != null && systemProperties.length() > 0) {
+ for (String property : systemProperties.split(",")) {
int ix = property.indexOf('=');
- if( ix > 0 && ix < property.length()-1 ){
- System.setProperty( property.substring(0, ix), property.substring(ix+1) );
+ if (ix > 0 && ix < property.length() - 1) {
+ System.setProperty(property.substring(0, ix), property.substring(ix + 1));
}
}
}
@@ -115,6 +137,7 @@ private void setSystemProperties() {
/**
* If true parameter, adds system properties which enables debug mode in generator
+ *
* @param verbose - if true, enables debug mode
*/
private void verbosed(boolean verbose) {
@@ -132,25 +155,4 @@ private void verbosed(boolean verbose) {
System.setProperty("debugOperations", "");
System.setProperty("debugSupportingFiles", "");
}
-
- /**
- * Tries to load config class with SPI first, then with class name directly from classpath
- * @param name name of config, or full qualified class name in classpath
- * @return config class
- */
- private static CodegenConfig forName(String name) {
- ServiceLoader loader = load(CodegenConfig.class);
- for (CodegenConfig config : loader) {
- if (config.getName().equals(name)) {
- return config;
- }
- }
-
- // else try to load directly
- try {
- return (CodegenConfig) Class.forName(name).newInstance();
- } catch (Exception e) {
- throw new RuntimeException("Can't load config class with name ".concat(name), e);
- }
- }
}
diff --git a/modules/swagger-codegen-cli/src/main/java/com/wordnik/swagger/codegen/cmd/Langs.java b/modules/swagger-codegen-cli/src/main/java/io/swagger/codegen/cmd/Langs.java
similarity index 87%
rename from modules/swagger-codegen-cli/src/main/java/com/wordnik/swagger/codegen/cmd/Langs.java
rename to modules/swagger-codegen-cli/src/main/java/io/swagger/codegen/cmd/Langs.java
index 7942804d434..c3d7391579e 100644
--- a/modules/swagger-codegen-cli/src/main/java/com/wordnik/swagger/codegen/cmd/Langs.java
+++ b/modules/swagger-codegen-cli/src/main/java/io/swagger/codegen/cmd/Langs.java
@@ -1,8 +1,8 @@
-package com.wordnik.swagger.codegen.cmd;
+package io.swagger.codegen.cmd;
import ch.lambdaj.collection.LambdaIterable;
-import com.wordnik.swagger.codegen.CodegenConfig;
import io.airlift.airline.Command;
+import io.swagger.codegen.CodegenConfig;
import static ch.lambdaj.Lambda.on;
import static ch.lambdaj.collection.LambdaCollections.with;
diff --git a/modules/swagger-codegen-cli/src/main/java/com/wordnik/swagger/codegen/cmd/Meta.java b/modules/swagger-codegen-cli/src/main/java/io/swagger/codegen/cmd/Meta.java
similarity index 93%
rename from modules/swagger-codegen-cli/src/main/java/com/wordnik/swagger/codegen/cmd/Meta.java
rename to modules/swagger-codegen-cli/src/main/java/io/swagger/codegen/cmd/Meta.java
index 47843de39ad..c75181c51cd 100644
--- a/modules/swagger-codegen-cli/src/main/java/com/wordnik/swagger/codegen/cmd/Meta.java
+++ b/modules/swagger-codegen-cli/src/main/java/io/swagger/codegen/cmd/Meta.java
@@ -1,13 +1,13 @@
-package com.wordnik.swagger.codegen.cmd;
+package io.swagger.codegen.cmd;
import ch.lambdaj.function.convert.Converter;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMap;
import com.samskivert.mustache.Mustache;
-import com.wordnik.swagger.codegen.DefaultGenerator;
-import com.wordnik.swagger.codegen.SupportingFile;
import io.airlift.airline.Command;
import io.airlift.airline.Option;
+import io.swagger.codegen.DefaultGenerator;
+import io.swagger.codegen.SupportingFile;
import org.apache.commons.io.FileUtils;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
@@ -47,8 +47,8 @@ public class Meta implements Runnable {
private String name = "default";
@Option(name = {"-p", "--package"}, title = "package",
- description = "the package to put the main class into (defaults to com.wordnik.swagger.codegen)")
- private String targetPackage = "com.wordnik.swagger.codegen";
+ description = "the package to put the main class into (defaults to io.swagger.codegen)")
+ private String targetPackage = "io.swagger.codegen";
@Override
public void run() {
@@ -65,7 +65,7 @@ public void run() {
new SupportingFile("api.template", "src/main/resources" + File.separator + name, "api.mustache"),
new SupportingFile("model.template", "src/main/resources" + File.separator + name, "model.mustache"),
new SupportingFile("services.mustache",
- "src/main/resources/META-INF/services", "com.wordnik.swagger.codegen.CodegenConfig")
+ "src/main/resources/META-INF/services", "io.swagger.codegen.CodegenConfig")
);
Map data = new ImmutableMap.Builder()
@@ -81,8 +81,9 @@ public void run() {
/**
* Converter method to process supporting files: execute with mustache,
* or simply copy to destination directory
+ *
* @param targetDir - destination directory
- * @param data - map with additional params needed to process templates
+ * @param data - map with additional params needed to process templates
* @return converter object to pass to lambdaj
*/
private Converter processFiles(final File targetDir, final Map data) {
@@ -121,6 +122,7 @@ public File convert(SupportingFile support) {
/**
* Creates mustache loader for template using classpath loader
+ *
* @param generator - class with reader getter
* @return loader for template
*/
@@ -135,6 +137,7 @@ public Reader getTemplate(String name) {
/**
* Converts package name to path on file system
+ *
* @param packageName - package name to convert
* @return relative path
*/
diff --git a/modules/swagger-codegen-cli/src/main/resources/logback.xml b/modules/swagger-codegen-cli/src/main/resources/logback.xml
index 4e86443d8d3..3bd0c92d369 100644
--- a/modules/swagger-codegen-cli/src/main/resources/logback.xml
+++ b/modules/swagger-codegen-cli/src/main/resources/logback.xml
@@ -1,12 +1,12 @@
-
-
-
- %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n
-
-
-
-
-
-
+
+
+
+ %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n
+
+
+
+
+
+
diff --git a/modules/swagger-codegen/pom.xml b/modules/swagger-codegen/pom.xml
index 2db20e67a2d..1b6712ba32f 100644
--- a/modules/swagger-codegen/pom.xml
+++ b/modules/swagger-codegen/pom.xml
@@ -1,347 +1,357 @@
-
-
- com.wordnik
- swagger-codegen-project
- 2.1.1-M2-SNAPSHOT
- ../..
-
- 4.0.0
- swagger-codegen
- jar
- swagger-codegen (core library)
-
- src/main/java
- install
-
-
- src/main/resources
-
- logback.xml
-
-
-
-
-
- org.jvnet.wagon-svn
- wagon-svn
- 1.8
-
-
- org.apache.maven.wagon
- wagon-ssh-external
- 1.0-alpha-6
-
-
- org.apache.maven.wagon
- wagon-webdav
- 1.0-beta-1
-
-
- target
- ${project.artifactId}-${project.version}
-
-
- org.codehaus.mojo
- exec-maven-plugin
- 1.3.2
-
-
-
- java
-
-
-
-
- com.wordnik.swagger.codegen.Codegen
-
-
-
- maven-dependency-plugin
-
-
- package
-
- copy-dependencies
-
-
- ${project.build.directory}/lib
-
-
-
-
-
- net.alchim31.maven
- scala-maven-plugin
-
-
-
- add-source
- compile
- testCompile
-
-
-
-
-
- incremental
-
-
- -Xmx384m
-
-
- -target:jvm-1.6
- -deprecation
-
-
-
- run-scalatest
- org.scalatest.tools.Runner
-
- -p
- ${project.build.testOutputDirectory}
-
-
- -Xmx512m
-
-
-
-
-
-
- maven-compiler-plugin
- 3.0
-
- 1.6
- 1.6
-
-
-
- org.apache.maven.plugins
- maven-jar-plugin
- 2.4
-
-
-
- development
- ${project.url}
- ${project.version}
- com.wordnik
-
-
-
-
-
- org.apache.maven.plugins
- maven-site-plugin
- 2.1
-
-
- org.apache.maven.plugins
- maven-release-plugin
- 2.1
-
-
-
-
-
- net.alchim31.maven
- scala-maven-plugin
- ${scala-maven-plugin-version}
-
-
- org.apache.maven.plugins
- maven-gpg-plugin
-
- release
- sign
-
-
-
-
-
-
-
- release-profile
-
- true
-
-
+
+
+ io.swagger
+ swagger-codegen-project
+ 2.1.1
+ ../..
+
+ 4.0.0
+ swagger-codegen
+ jar
+ swagger-codegen (core library)
+
+ src/main/java
+ install
+
+
+ src/main/resources
+
+ logback.xml
+
+
+
+
+
+ org.jvnet.wagon-svn
+ wagon-svn
+ 1.8
+
+
+ org.apache.maven.wagon
+ wagon-ssh-external
+ 1.0-alpha-6
+
+
+ org.apache.maven.wagon
+ wagon-webdav
+ 1.0-beta-1
+
+
+ target
+ ${project.artifactId}-${project.version}
-
- net.alchim31.maven
- scala-maven-plugin
-
-
-
- compile
- testCompile
-
-
-
-
-
-
- org.codehaus.mojo
- build-helper-maven-plugin
-
-
- add-source
- prepare-package
-
- add-source
-
+
+ org.codehaus.mojo
+ exec-maven-plugin
+ 1.3.2
+
+
+
+ java
+
+
+
-
- src/main/scala
-
+ io.swagger.codegen.Codegen
-
-
-
+