Skip to content

Commit 1644956

Browse files
committed
Merge pull request #843 from swagger-api/repackage
merge repackage into development
2 parents 7765087 + b1cea25 commit 1644956

File tree

921 files changed

+79664
-70591
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

921 files changed

+79664
-70591
lines changed

README.md

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ The Swagger Specification has undergone 3 revisions since initial creation in 20
1818

1919
Swagger Codegen Version | Release Date | Swagger Spec compatibility | Notes
2020
----------------------- | ------------ | -------------------------- | -----
21-
2.1.1-M2-SNAPSHOT | 2015-04-06 | 1.0, 1.1, 1.2, 2.0 | [master](https://github.com/swagger-api/swagger-codegen)
21+
2.1.0 | 2015-06-09 | 1.0, 1.1, 1.2, 2.0 | [master](https://github.com/swagger-api/swagger-codegen)
2222
2.0.17 | 2014-08-22 | 1.1, 1.2 | [tag v2.0.17](https://github.com/swagger-api/swagger-codegen/tree/v2.0.17)
2323
1.0.4 | 2012-04-12 | 1.0, 1.1 | [tag v1.0.4](https://github.com/swagger-api/swagger-codegen/tree/swagger-codegen_2.9.1-1.1)
2424

@@ -154,7 +154,8 @@ Great for creating libraries on your ci server, from the [Swagger Editor](http:/
154154
There are different aspects of customizing the code generator beyond just creating or modifying templates. Each language has a supporting configuration file to handle different type mappings, etc:
155155

156156
```
157-
$ ls -1 modules/swagger-codegen/src/main/java/com/wordnik/swagger/codegen/languages/
157+
$ ls -1 modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/
158+
AkkaScalaClientCodegen.java
158159
AndroidClientCodegen.java
159160
AsyncScalaClientCodegen.java
160161
CSharpClientCodegen.java
@@ -167,6 +168,7 @@ PhpClientCodegen.java
167168
Python3ClientCodegen.java
168169
PythonClientCodegen.java
169170
Qt5CPPGenerator.java
171+
RetrofitClientCodegen.java
170172
RubyClientCodegen.java
171173
ScalaClientCodegen.java
172174
ScalatraServerCodegen.java
@@ -175,6 +177,7 @@ StaticDocCodegen.java
175177
StaticHtmlGenerator.java
176178
SwaggerGenerator.java
177179
SwaggerYamlGenerator.java
180+
SwiftGenerator.java
178181
TizenClientCodegen.java
179182
```
180183

@@ -237,7 +240,7 @@ To change, for example, the prefix for the Objective-C generated files, simply s
237240
```
238241
package com.mycompany.swagger.codegen;
239242
240-
import com.wordnik.swagger.codegen.languages.*;
243+
import io.swagger.codegen.languages.*;
241244
242245
public class MyObjcCodegen extends ObjcClientCodegen {
243246
static {

bin/akka-scala-petstore.sh

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
#!/bin/sh
2+
3+
SCRIPT="$0"
4+
5+
while [ -h "$SCRIPT" ] ; do
6+
ls=`ls -ld "$SCRIPT"`
7+
link=`expr "$ls" : '.*-> \(.*\)$'`
8+
if expr "$link" : '/.*' > /dev/null; then
9+
SCRIPT="$link"
10+
else
11+
SCRIPT=`dirname "$SCRIPT"`/"$link"
12+
fi
13+
done
14+
15+
if [ ! -d "${APP_DIR}" ]; then
16+
APP_DIR=`dirname "$SCRIPT"`/..
17+
APP_DIR=`cd "${APP_DIR}"; pwd`
18+
fi
19+
20+
executable="./modules/swagger-codegen-cli/target/swagger-codegen-cli.jar"
21+
22+
if [ ! -f "$executable" ]
23+
then
24+
mvn clean package
25+
fi
26+
27+
# if you've executed sbt assembly previously it will use that instead.
28+
export JAVA_OPTS="${JAVA_OPTS} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties"
29+
ags="$@ generate -t modules/swagger-codegen/src/main/resources/akka-scala -i modules/swagger-codegen/src/test/resources/2_0/petstore.json -l akka-scala -o samples/client/petstore/akka-scala"
30+
31+
java $JAVA_OPTS -jar $executable $ags

modules/swagger-codegen-cli/pom.xml

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
1+
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/POM/4.0.0"
22
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
33
<parent>
4-
<groupId>com.wordnik</groupId>
4+
<groupId>io.swagger</groupId>
55
<artifactId>swagger-codegen-project</artifactId>
6-
<version>2.1.1-M2-SNAPSHOT</version>
6+
<version>2.1.1</version>
77
<relativePath>../..</relativePath>
88
</parent>
99
<modelVersion>4.0.0</modelVersion>
@@ -16,12 +16,12 @@
1616
<build>
1717
<finalName>swagger-codegen-cli</finalName>
1818
<resources>
19-
<resource>
20-
<directory>src/main/resources</directory>
21-
<excludes>
22-
<exclude>logback.xml</exclude>
23-
</excludes>
24-
</resource>
19+
<resource>
20+
<directory>src/main/resources</directory>
21+
<excludes>
22+
<exclude>logback.xml</exclude>
23+
</excludes>
24+
</resource>
2525
</resources>
2626
<plugins>
2727
<plugin>
@@ -30,7 +30,7 @@
3030
<configuration>
3131
<archive>
3232
<manifest>
33-
<mainClass>com.wordnik.swagger.codegen.SwaggerCodegen</mainClass>
33+
<mainClass>io.swagger.codegen.SwaggerCodegen</mainClass>
3434
</manifest>
3535
</archive>
3636
</configuration>
@@ -62,7 +62,8 @@
6262
</goals>
6363
<configuration>
6464
<transformers>
65-
<transformer implementation="org.apache.maven.plugins.shade.resource.ServicesResourceTransformer"/>
65+
<transformer
66+
implementation="org.apache.maven.plugins.shade.resource.ServicesResourceTransformer"/>
6667
</transformers>
6768
</configuration>
6869
</execution>
@@ -74,7 +75,7 @@
7475
<dependencies>
7576

7677
<dependency>
77-
<groupId>com.wordnik</groupId>
78+
<groupId>io.swagger</groupId>
7879
<artifactId>swagger-codegen</artifactId>
7980
<version>${project.version}</version>
8081
</dependency>
Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
1-
package com.wordnik.swagger.codegen;
1+
package io.swagger.codegen;
22

3-
import com.wordnik.swagger.codegen.cmd.ConfigHelp;
4-
import com.wordnik.swagger.codegen.cmd.Generate;
5-
import com.wordnik.swagger.codegen.cmd.Langs;
6-
import com.wordnik.swagger.codegen.cmd.Meta;
73
import io.airlift.airline.Cli;
84
import io.airlift.airline.Help;
5+
import io.swagger.codegen.cmd.ConfigHelp;
6+
import io.swagger.codegen.cmd.Generate;
7+
import io.swagger.codegen.cmd.Langs;
8+
import io.swagger.codegen.cmd.Meta;
99

1010
/**
1111
* User: lanwen
1212
* Date: 24.03.15
1313
* Time: 17:56
14-
*
14+
* <p>
1515
* Command line interface for swagger codegen
1616
* use `swagger-codegen-cli.jar help` for more info
1717
*
Lines changed: 19 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,24 @@
1-
package com.wordnik.swagger.codegen.cmd;
1+
package io.swagger.codegen.cmd;
22

3-
import com.wordnik.swagger.codegen.CliOption;
4-
import com.wordnik.swagger.codegen.CodegenConfig;
53
import io.airlift.airline.Command;
64
import io.airlift.airline.Option;
5+
import io.swagger.codegen.CliOption;
6+
import io.swagger.codegen.CodegenConfig;
7+
78
import java.util.ServiceLoader;
9+
810
import static java.util.ServiceLoader.load;
911

1012
@Command(name = "config-help", description = "Config help for chosen lang")
1113
public class ConfigHelp implements Runnable {
12-
14+
1315
@Option(name = {"-l", "--lang"}, title = "language", required = true,
1416
description = "language to get config help for")
1517
private String lang;
1618

17-
@Override
18-
public void run() {
19-
System.out.println();
20-
CodegenConfig config = forName(lang);
21-
System.out.println("CONFIG OPTIONS");
22-
for (CliOption langCliOption : config.cliOptions()) {
23-
System.out.println("\t" + langCliOption.getOpt());
24-
System.out.println("\t " + langCliOption.getDescription());
25-
System.out.println();
26-
}
27-
}
28-
2919
/**
3020
* Tries to load config class with SPI first, then with class name directly from classpath
21+
*
3122
* @param name name of config, or full qualified class name in classpath
3223
* @return config class
3324
*/
@@ -46,4 +37,16 @@ private static CodegenConfig forName(String name) {
4637
throw new RuntimeException("Can't load config class with name ".concat(name), e);
4738
}
4839
}
40+
41+
@Override
42+
public void run() {
43+
System.out.println();
44+
CodegenConfig config = forName(lang);
45+
System.out.println("CONFIG OPTIONS");
46+
for (CliOption langCliOption : config.cliOptions()) {
47+
System.out.println("\t" + langCliOption.getOpt());
48+
System.out.println("\t " + langCliOption.getDescription());
49+
System.out.println();
50+
}
51+
}
4952
}
Lines changed: 41 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
1-
package com.wordnik.swagger.codegen.cmd;
2-
3-
import com.wordnik.swagger.codegen.CliOption;
4-
import com.wordnik.swagger.codegen.ClientOptInput;
5-
import com.wordnik.swagger.codegen.ClientOpts;
6-
import com.wordnik.swagger.codegen.CodegenConfig;
7-
import com.wordnik.swagger.codegen.DefaultGenerator;
8-
import com.wordnik.swagger.models.Swagger;
1+
package io.swagger.codegen.cmd;
2+
93
import config.Config;
104
import config.ConfigParser;
115
import io.airlift.airline.Command;
126
import io.airlift.airline.Option;
7+
import io.swagger.codegen.CliOption;
8+
import io.swagger.codegen.ClientOptInput;
9+
import io.swagger.codegen.ClientOpts;
10+
import io.swagger.codegen.CodegenConfig;
11+
import io.swagger.codegen.DefaultGenerator;
12+
import io.swagger.models.Swagger;
1313
import io.swagger.parser.SwaggerParser;
1414
import org.slf4j.Logger;
1515
import org.slf4j.LoggerFactory;
@@ -57,15 +57,37 @@ public class Generate implements Runnable {
5757
"Pass in a URL-encoded string of name:header with a comma separating multiple values")
5858
private String auth;
5959

60-
@Option( name= {"-D"}, title = "system properties", description = "sets specified system properties in " +
60+
@Option(name = {"-D"}, title = "system properties", description = "sets specified system properties in " +
6161
"the format of name=value,name=value")
6262
private String systemProperties;
63-
64-
@Option( name= {"-c", "--config"}, title = "configuration file", description = "Path to json configuration file. " +
63+
64+
@Option(name = {"-c", "--config"}, title = "configuration file", description = "Path to json configuration file. " +
6565
"File content should be in a json format {\"optionKey\":\"optionValue\", \"optionKey1\":\"optionValue1\"...} " +
6666
"Supported options can be different for each language. Run config-help -l {lang} command for language specific config options.")
6767
private String configFile;
6868

69+
/**
70+
* Tries to load config class with SPI first, then with class name directly from classpath
71+
*
72+
* @param name name of config, or full qualified class name in classpath
73+
* @return config class
74+
*/
75+
private static CodegenConfig forName(String name) {
76+
ServiceLoader<CodegenConfig> loader = load(CodegenConfig.class);
77+
for (CodegenConfig config : loader) {
78+
if (config.getName().equals(name)) {
79+
return config;
80+
}
81+
}
82+
83+
// else try to load directly
84+
try {
85+
return (CodegenConfig) Class.forName(name).newInstance();
86+
} catch (Exception e) {
87+
throw new RuntimeException("Can't load config class with name ".concat(name), e);
88+
}
89+
}
90+
6991
@Override
7092
public void run() {
7193
verbosed(verbose);
@@ -84,13 +106,13 @@ public void run() {
84106
if (null != templateDir) {
85107
config.additionalProperties().put(TEMPLATE_DIR_PARAM, new File(templateDir).getAbsolutePath());
86108
}
87-
88-
if(null != configFile){
109+
110+
if (null != configFile) {
89111
Config genConfig = ConfigParser.read(configFile);
90112
if (null != genConfig) {
91113
for (CliOption langCliOption : config.cliOptions()) {
92114
if (genConfig.hasOption(langCliOption.getOpt())) {
93-
config.additionalProperties().put(langCliOption.getOpt(), genConfig.getOption(langCliOption.getOpt()));
115+
config.additionalProperties().put(langCliOption.getOpt(), genConfig.getOption(langCliOption.getOpt()));
94116
}
95117
}
96118
}
@@ -103,18 +125,19 @@ public void run() {
103125
}
104126

105127
private void setSystemProperties() {
106-
if( systemProperties != null && systemProperties.length() > 0 ){
107-
for( String property : systemProperties.split(",")) {
128+
if (systemProperties != null && systemProperties.length() > 0) {
129+
for (String property : systemProperties.split(",")) {
108130
int ix = property.indexOf('=');
109-
if( ix > 0 && ix < property.length()-1 ){
110-
System.setProperty( property.substring(0, ix), property.substring(ix+1) );
131+
if (ix > 0 && ix < property.length() - 1) {
132+
System.setProperty(property.substring(0, ix), property.substring(ix + 1));
111133
}
112134
}
113135
}
114136
}
115137

116138
/**
117139
* If true parameter, adds system properties which enables debug mode in generator
140+
*
118141
* @param verbose - if true, enables debug mode
119142
*/
120143
private void verbosed(boolean verbose) {
@@ -132,25 +155,4 @@ private void verbosed(boolean verbose) {
132155
System.setProperty("debugOperations", "");
133156
System.setProperty("debugSupportingFiles", "");
134157
}
135-
136-
/**
137-
* Tries to load config class with SPI first, then with class name directly from classpath
138-
* @param name name of config, or full qualified class name in classpath
139-
* @return config class
140-
*/
141-
private static CodegenConfig forName(String name) {
142-
ServiceLoader<CodegenConfig> loader = load(CodegenConfig.class);
143-
for (CodegenConfig config : loader) {
144-
if (config.getName().equals(name)) {
145-
return config;
146-
}
147-
}
148-
149-
// else try to load directly
150-
try {
151-
return (CodegenConfig) Class.forName(name).newInstance();
152-
} catch (Exception e) {
153-
throw new RuntimeException("Can't load config class with name ".concat(name), e);
154-
}
155-
}
156158
}
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
package com.wordnik.swagger.codegen.cmd;
1+
package io.swagger.codegen.cmd;
22

33
import ch.lambdaj.collection.LambdaIterable;
4-
import com.wordnik.swagger.codegen.CodegenConfig;
54
import io.airlift.airline.Command;
5+
import io.swagger.codegen.CodegenConfig;
66

77
import static ch.lambdaj.Lambda.on;
88
import static ch.lambdaj.collection.LambdaCollections.with;

0 commit comments

Comments
 (0)