Merge pull request #413 from swagger-api/assembly

Created assembly and submodules
This commit is contained in:
Tony Tam 2015-02-05 11:51:00 -08:00
commit caaa753f58
249 changed files with 4580 additions and 444 deletions

View File

@ -18,20 +18,14 @@ if [ ! -d "${APP_DIR}" ]; then
fi fi
cd $APP_DIR cd $APP_DIR
./bin/java-wordnik-api.sh
./bin/php-wordnik-api.sh
./bin/python3-wordnik-api.sh
./bin/objc-wordnik-api.sh
./bin/python-wordnik-api.sh
./bin/scala-wordnik-api.sh
./bin/android-java-petstore.sh ./bin/android-java-petstore.sh
./bin/csharp-petstore.sh ./bin/android-java-wordnik-api.sh
./bin/flash-petstore.sh ./bin/dynamic-html.sh
./bin/html.sh
./bin/jaxrs-petstore-server.sh
./bin/java-petstore-filemap.sh
./bin/java-petstore.sh ./bin/java-petstore.sh
./bin/java-wordnik-api.sh
./bin/objc-petstore.sh ./bin/objc-petstore.sh
./bin/php-petstore.sh ./bin/objc-wordnik-api.sh
./bin/python-petstore.sh ./bin/tizen-petstore.sh
./bin/python3-petstore.sh
./bin/ruby-petstore.sh
./bin/scala-petstore.sh

View File

@ -17,11 +17,20 @@ if [ ! -d "${APP_DIR}" ]; then
APP_DIR=`cd "${APP_DIR}"; pwd` APP_DIR=`cd "${APP_DIR}"; pwd`
fi fi
cd $APP_DIR root=./modules/swagger-codegen-distribution/pom.xml
# gets version of swagger-codegen
version=$(sed '/<project>/,/<\/project>/d;/<version>/!d;s/ *<\/\?version> *//g' $root | sed -n '2p' | sed -e 's,.*<version>\([^<]*\)</version>.*,\1,g')
executable="./modules/swagger-codegen-distribution/target/swagger-codegen-distribution-$version.jar"
if [ ! -f "$executable" ]
then
mvn clean package
fi
# if you've executed sbt assembly previously it will use that instead. # if you've executed sbt assembly previously it will use that instead.
export JAVA_OPTS="${JAVA_OPTS} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties" export JAVA_OPTS="${JAVA_OPTS} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties"
ags="$@ com.wordnik.swagger.codegen.Codegen -i src/test/resources/petstore.json -l android -o samples/client/petstore/android-java" ags="$@ -i modules/swagger-codegen/src/test/resources/2_0/petstore.json -l android -o samples/client/petstore/android-java"
java -cp $APP_DIR/target/*:$APP_DIR/target/lib/* $ags java $JAVA_OPTS -jar $executable $ags

View File

@ -1,7 +1,6 @@
#!/bin/sh #!/bin/sh
SCRIPT="$0" SCRIPT="$0"
SCALA_RUNNER_VERSION=$(scala ./bin/Version.scala)
while [ -h "$SCRIPT" ] ; do while [ -h "$SCRIPT" ] ; do
ls=`ls -ld "$SCRIPT"` ls=`ls -ld "$SCRIPT"`
@ -18,15 +17,20 @@ if [ ! -d "${APP_DIR}" ]; then
APP_DIR=`cd "${APP_DIR}"; pwd` APP_DIR=`cd "${APP_DIR}"; pwd`
fi fi
cd $APP_DIR root=./modules/swagger-codegen-distribution/pom.xml
# gets version of swagger-codegen
version=$(sed '/<project>/,/<\/project>/d;/<version>/!d;s/ *<\/\?version> *//g' $root | sed -n '2p' | sed -e 's,.*<version>\([^<]*\)</version>.*,\1,g')
executable="./modules/swagger-codegen-distribution/target/swagger-codegen-distribution-$version.jar"
if [ ! -f "$executable" ]
then
mvn clean package
fi
# if you've executed sbt assembly previously it will use that instead. # if you've executed sbt assembly previously it will use that instead.
export JAVA_OPTS="${JAVA_OPTS} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties" export JAVA_OPTS="${JAVA_OPTS} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties"
ags="$@ samples/client/petstore/android-java/AndroidJavaPetstoreCodegen.scala http://petstore.swagger.wordnik.com/api/api-docs special-key" ags="$@ -i modules/swagger-codegen/src/test/resources/2_0/wordnik.json -l android -o samples/client/wordnik/android-java"
if [ -f $APP_DIR/target/scala-$SCALA_RUNNER_VERSION/*assembly*.jar ]; then java $JAVA_OPTS -jar $executable $ags
scala -cp target/scala-$SCALA_RUNNER_VERSION/*assembly*.jar $ags
else
echo "Please set scalaVersion := \"$SCALA_RUNNER_VERSION\" in build.sbt and run ./sbt assembly"
fi

View File

@ -17,11 +17,20 @@ if [ ! -d "${APP_DIR}" ]; then
APP_DIR=`cd "${APP_DIR}"; pwd` APP_DIR=`cd "${APP_DIR}"; pwd`
fi fi
cd $APP_DIR root=./modules/swagger-codegen-distribution/pom.xml
# gets version of swagger-codegen
version=$(sed '/<project>/,/<\/project>/d;/<version>/!d;s/ *<\/\?version> *//g' $root | sed -n '2p' | sed -e 's,.*<version>\([^<]*\)</version>.*,\1,g')
executable="./modules/swagger-codegen-distribution/target/swagger-codegen-distribution-$version.jar"
if [ ! -f "$executable" ]
then
mvn clean package
fi
# if you've executed sbt assembly previously it will use that instead. # if you've executed sbt assembly previously it will use that instead.
export JAVA_OPTS="${JAVA_OPTS} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties" export JAVA_OPTS="${JAVA_OPTS} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties"
ags="$@ com.wordnik.swagger.codegen.Codegen -i http://petstore.swagger.wordnik.com/v2/swagger.json -l dynamic-html -o samples/swagger-dynamic-html" ags="$@ -i http://petstore.swagger.wordnik.com/v2/swagger.json -l dynamic-html -o samples/swagger-dynamic-html"
java -cp $APP_DIR/target/*:$APP_DIR/target/lib/* $ags java $JAVA_OPTS -jar $executable $ags

View File

@ -17,11 +17,20 @@ if [ ! -d "${APP_DIR}" ]; then
APP_DIR=`cd "${APP_DIR}"; pwd` APP_DIR=`cd "${APP_DIR}"; pwd`
fi fi
cd $APP_DIR root=./modules/swagger-codegen-distribution/pom.xml
# gets version of swagger-codegen
version=$(sed '/<project>/,/<\/project>/d;/<version>/!d;s/ *<\/\?version> *//g' $root | sed -n '2p' | sed -e 's,.*<version>\([^<]*\)</version>.*,\1,g')
executable="./modules/swagger-codegen-distribution/target/swagger-codegen-distribution-$version.jar"
if [ ! -f "$executable" ]
then
mvn clean package
fi
# if you've executed sbt assembly previously it will use that instead. # if you've executed sbt assembly previously it will use that instead.
export JAVA_OPTS="${JAVA_OPTS} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties" export JAVA_OPTS="${JAVA_OPTS} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties"
ags="$@ com.wordnik.swagger.codegen.Codegen -i http://petstore.swagger.wordnik.com/v2/swagger.json -l html -o samples/swagger-html" ags="$@ -i http://petstore.swagger.wordnik.com/v2/swagger.json -l html -o samples/swagger-html"
java -cp $APP_DIR/target/*:$APP_DIR/target/lib/* $ags java $JAVA_OPTS -jar $executable $ags

View File

@ -17,10 +17,20 @@ if [ ! -d "${APP_DIR}" ]; then
APP_DIR=`cd "${APP_DIR}"; pwd` APP_DIR=`cd "${APP_DIR}"; pwd`
fi fi
cd $APP_DIR root=./modules/swagger-codegen-distribution/pom.xml
# gets version of swagger-codegen
version=$(sed '/<project>/,/<\/project>/d;/<version>/!d;s/ *<\/\?version> *//g' $root | sed -n '2p' | sed -e 's,.*<version>\([^<]*\)</version>.*,\1,g')
executable="./modules/swagger-codegen-distribution/target/swagger-codegen-distribution-$version.jar"
if [ ! -f "$executable" ]
then
mvn clean package
fi
# if you've executed sbt assembly previously it will use that instead. # if you've executed sbt assembly previously it will use that instead.
export JAVA_OPTS="${JAVA_OPTS} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties" export JAVA_OPTS="${JAVA_OPTS} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties"
ags="$@ com.wordnik.swagger.codegen.Codegen -i src/test/resources/petstore.json -l java -o samples/client/petstore/java" ags="$@ -i modules/swagger-codegen/src/test/resources/2_0/petstore.json -l java -o samples/client/petstore/java"
java -cp $APP_DIR/target/*:$APP_DIR/target/lib/* $ags java $JAVA_OPTS -jar $executable $ags

View File

@ -17,10 +17,20 @@ if [ ! -d "${APP_DIR}" ]; then
APP_DIR=`cd "${APP_DIR}"; pwd` APP_DIR=`cd "${APP_DIR}"; pwd`
fi fi
cd $APP_DIR root=./modules/swagger-codegen-distribution/pom.xml
# gets version of swagger-codegen
version=$(sed '/<project>/,/<\/project>/d;/<version>/!d;s/ *<\/\?version> *//g' $root | sed -n '2p' | sed -e 's,.*<version>\([^<]*\)</version>.*,\1,g')
executable="./modules/swagger-codegen-distribution/target/swagger-codegen-distribution-$version.jar"
if [ ! -f "$executable" ]
then
mvn clean package
fi
# if you've executed sbt assembly previously it will use that instead. # if you've executed sbt assembly previously it will use that instead.
export JAVA_OPTS="${JAVA_OPTS} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties" export JAVA_OPTS="${JAVA_OPTS} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties"
ags="$@ com.wordnik.swagger.codegen.Codegen -i http://petstore.swagger.wordnik.com/v2/swagger.json -l java -o samples/client/petstore/java" ags="$@ -i http://petstore.swagger.wordnik.com/v2/swagger.json -l java -o samples/client/petstore/java"
java -cp $APP_DIR/target/*:$APP_DIR/target/lib/* $ags java $JAVA_OPTS -jar $executable $ags

View File

@ -17,10 +17,20 @@ if [ ! -d "${APP_DIR}" ]; then
APP_DIR=`cd "${APP_DIR}"; pwd` APP_DIR=`cd "${APP_DIR}"; pwd`
fi fi
cd $APP_DIR root=./modules/swagger-codegen-distribution/pom.xml
# gets version of swagger-codegen
version=$(sed '/<project>/,/<\/project>/d;/<version>/!d;s/ *<\/\?version> *//g' $root | sed -n '2p' | sed -e 's,.*<version>\([^<]*\)</version>.*,\1,g')
executable="./modules/swagger-codegen-distribution/target/swagger-codegen-distribution-$version.jar"
if [ ! -f "$executable" ]
then
mvn clean package
fi
# if you've executed sbt assembly previously it will use that instead. # if you've executed sbt assembly previously it will use that instead.
export JAVA_OPTS="${JAVA_OPTS} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties" export JAVA_OPTS="${JAVA_OPTS} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties"
ags="$@ com.wordnik.swagger.codegen.Codegen -i src/test/resources/wordnik.json -l java" ags="$@ -i modules/swagger-codegen/src/test/resources/2_0/wordnik.json -l java -o samples/client/wordnik/java"
java -cp $APP_DIR/target/*:$APP_DIR/target/lib/* $ags java $JAVA_OPTS -jar $executable $ags

36
bin/jaxrs-petstore-server.sh Executable file
View File

@ -0,0 +1,36 @@
#!/bin/sh
SCRIPT="$0"
while [ -h "$SCRIPT" ] ; do
ls=`ls -ld "$SCRIPT"`
link=`expr "$ls" : '.*-> \(.*\)$'`
if expr "$link" : '/.*' > /dev/null; then
SCRIPT="$link"
else
SCRIPT=`dirname "$SCRIPT"`/"$link"
fi
done
if [ ! -d "${APP_DIR}" ]; then
APP_DIR=`dirname "$SCRIPT"`/..
APP_DIR=`cd "${APP_DIR}"; pwd`
fi
root=./modules/swagger-codegen-distribution/pom.xml
# gets version of swagger-codegen
version=$(sed '/<project>/,/<\/project>/d;/<version>/!d;s/ *<\/\?version> *//g' $root | sed -n '2p' | sed -e 's,.*<version>\([^<]*\)</version>.*,\1,g')
executable="./modules/swagger-codegen-distribution/target/swagger-codegen-distribution-$version.jar"
if [ ! -f "$executable" ]
then
mvn clean package
fi
# if you've executed sbt assembly previously it will use that instead.
export JAVA_OPTS="${JAVA_OPTS} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties"
ags="$@ -i http://petstore.swagger.wordnik.com/v2/swagger.json -l jaxrs -o samples/server/petstore/jaxrs -t modules/swagger-codegen/src/main/resources/JavaJaxRS"
java $JAVA_OPTS -jar $executable $ags

View File

@ -17,10 +17,20 @@ if [ ! -d "${APP_DIR}" ]; then
APP_DIR=`cd "${APP_DIR}"; pwd` APP_DIR=`cd "${APP_DIR}"; pwd`
fi fi
cd $APP_DIR root=./modules/swagger-codegen-distribution/pom.xml
# gets version of swagger-codegen
version=$(sed '/<project>/,/<\/project>/d;/<version>/!d;s/ *<\/\?version> *//g' $root | sed -n '2p' | sed -e 's,.*<version>\([^<]*\)</version>.*,\1,g')
executable="./modules/swagger-codegen-distribution/target/swagger-codegen-distribution-$version.jar"
if [ ! -f "$executable" ]
then
mvn clean package
fi
# if you've executed sbt assembly previously it will use that instead. # if you've executed sbt assembly previously it will use that instead.
export JAVA_OPTS="${JAVA_OPTS} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties" export JAVA_OPTS="${JAVA_OPTS} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties"
ags="$@ com.wordnik.swagger.codegen.Codegen -i src/test/resources/petstore.json -l objc -o samples/client/petstore/objc -t src/main/resources/objc" ags="$@ -i modules/swagger-codegen/src/test/resources/petstore.json -l objc -o samples/client/petstore/objc -t src/main/resources/objc"
java -cp $APP_DIR/target/*:$APP_DIR/target/lib/* $ags java $JAVA_OPTS -jar $executable $ags

View File

@ -17,10 +17,20 @@ if [ ! -d "${APP_DIR}" ]; then
APP_DIR=`cd "${APP_DIR}"; pwd` APP_DIR=`cd "${APP_DIR}"; pwd`
fi fi
cd $APP_DIR root=./modules/swagger-codegen-distribution/pom.xml
# gets version of swagger-codegen
version=$(sed '/<project>/,/<\/project>/d;/<version>/!d;s/ *<\/\?version> *//g' $root | sed -n '2p' | sed -e 's,.*<version>\([^<]*\)</version>.*,\1,g')
executable="./modules/swagger-codegen-distribution/target/swagger-codegen-distribution-$version.jar"
if [ ! -f "$executable" ]
then
mvn clean package
fi
# if you've executed sbt assembly previously it will use that instead. # if you've executed sbt assembly previously it will use that instead.
export JAVA_OPTS="${JAVA_OPTS} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties" export JAVA_OPTS="${JAVA_OPTS} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties"
ags="$@ com.wordnik.swagger.codegen.Codegen -i src/test/resources/wordnik.json -l objc" ags="$@ -i modules/swagger-codegen/src/test/resources/2_0/wordnik.json -l objc -o samples/client/wordnik/objc"
java -cp $APP_DIR/target/*:$APP_DIR/target/lib/* $ags java $JAVA_OPTS -jar $executable $ags

View File

@ -17,10 +17,20 @@ if [ ! -d "${APP_DIR}" ]; then
APP_DIR=`cd "${APP_DIR}"; pwd` APP_DIR=`cd "${APP_DIR}"; pwd`
fi fi
cd $APP_DIR root=./modules/swagger-codegen-distribution/pom.xml
# gets version of swagger-codegen
version=$(sed '/<project>/,/<\/project>/d;/<version>/!d;s/ *<\/\?version> *//g' $root | sed -n '2p' | sed -e 's,.*<version>\([^<]*\)</version>.*,\1,g')
executable="./modules/swagger-codegen-distribution/target/swagger-codegen-distribution-$version.jar"
if [ ! -f "$executable" ]
then
mvn clean package
fi
# if you've executed sbt assembly previously it will use that instead. # if you've executed sbt assembly previously it will use that instead.
export JAVA_OPTS="${JAVA_OPTS} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties" export JAVA_OPTS="${JAVA_OPTS} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties"
ags="$@ com.wordnik.swagger.codegen.Codegen -i http://petstore.swagger.wordnik.com/v2/swagger.json -l tizen -o samples/client/petstore/tizen" ags="$@ -i http://petstore.swagger.wordnik.com/v2/swagger.json -l tizen -o samples/client/petstore/tizen"
java -cp $APP_DIR/target/*:$APP_DIR/target/lib/* $ags java $JAVA_OPTS -jar $executable $ags

View File

@ -0,0 +1,63 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<parent>
<groupId>com.wordnik</groupId>
<artifactId>swagger-codegen-project</artifactId>
<version>2.1.0-SNAPSHOT</version>
<relativePath>../..</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
<groupId>com.wordnik</groupId>
<artifactId>swagger-codegen-distribution</artifactId>
<packaging>jar</packaging>
<name>swagger-codegen-distribution</name>
<version>2.1.0-SNAPSHOT</version>
<build>
<testSourceDirectory>src/test/scala</testSourceDirectory>
<outputDirectory>target/classes</outputDirectory>
<testOutputDirectory>target/test-classes</testOutputDirectory>
<defaultGoal>install</defaultGoal>
<directory>target</directory>
<finalName>${project.artifactId}-${project.version}</finalName>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>2.3</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
<configuration>
<minimizeJar>false</minimizeJar>
<createDependencyReducedPom>true</createDependencyReducedPom>
<dependencyReducedPomLocation>
${java.io.tmpdir}/dependency-reduced-pom.xml
</dependencyReducedPomLocation>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<configuration>
<archive>
<manifest>
<mainClass>com.wordnik.swagger.codegen.Codegen</mainClass>
</manifest>
</archive>
</configuration>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>com.wordnik</groupId>
<artifactId>swagger-codegen</artifactId>
<version>${project.parent.version}</version>
</dependency>
</dependencies>
</project>

View File

@ -0,0 +1,391 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<parent>
<groupId>com.wordnik</groupId>
<artifactId>swagger-codegen-project</artifactId>
<version>2.1.0-SNAPSHOT</version>
<relativePath>../..</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
<groupId>com.wordnik</groupId>
<artifactId>swagger-codegen</artifactId>
<packaging>jar</packaging>
<name>swagger-codegen (core library)</name>
<version>2.1.0-SNAPSHOT</version>
<build>
<sourceDirectory>src/main/java</sourceDirectory>
<defaultGoal>install</defaultGoal>
<extensions>
<extension>
<groupId>org.jvnet.wagon-svn</groupId>
<artifactId>wagon-svn</artifactId>
<version>1.8</version>
</extension>
<extension>
<groupId>org.apache.maven.wagon</groupId>
<artifactId>wagon-ssh-external</artifactId>
<version>1.0-alpha-6</version>
</extension>
<extension>
<groupId>org.apache.maven.wagon</groupId>
<artifactId>wagon-webdav</artifactId>
<version>1.0-beta-1</version>
</extension>
</extensions>
<directory>target</directory>
<finalName>${project.artifactId}-${project.version}</finalName>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>1.3.2</version>
<executions>
<execution>
<goals>
<goal>java</goal>
</goals>
</execution>
</executions>
<configuration>
<mainClass>com.wordnik.swagger.codegen.Codegen</mainClass>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<configuration>
<archive>
<manifest>
<addClasspath>true</addClasspath>
<mainClass>com.wordnik.swagger.codegen.Codegen</mainClass>
</manifest>
</archive>
</configuration>
</plugin>
<plugin>
<artifactId>maven-dependency-plugin</artifactId>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>copy-dependencies</goal>
</goals>
<configuration>
<outputDirectory>${project.build.directory}/lib</outputDirectory>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>net.alchim31.maven</groupId>
<artifactId>scala-maven-plugin</artifactId>
<executions>
<execution>
<goals>
<goal>add-source</goal>
<goal>compile</goal>
<goal>testCompile</goal>
</goals>
</execution>
</executions>
<configuration>
<configuration>
<recompileMode>incremental</recompileMode>
</configuration>
<jvmArgs>
<jvmArg>-Xmx384m</jvmArg>
</jvmArgs>
<args>
<arg>-target:jvm-1.6</arg>
<arg>-deprecation</arg>
</args>
<launchers>
<launcher>
<id>run-scalatest</id>
<mainClass>org.scalatest.tools.Runner</mainClass>
<args>
<arg>-p</arg>
<arg>${project.build.testOutputDirectory}</arg>
</args>
<jvmArgs>
<jvmArg>-Xmx512m</jvmArg>
</jvmArgs>
</launcher>
</launchers>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
<version>2.1.2</version>
<executions>
<execution>
<id>attach-sources</id>
<phase>verify</phase>
<goals>
<goal>jar-no-fork</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>2.7</version>
<configuration>
<aggregate>true</aggregate>
<source>1.6</source>
<encoding>UTF-8</encoding>
<maxmemory>1g</maxmemory>
<links>
<link>http://java.sun.com/javase/6/docs/api/</link>
</links>
<excludePackageNames>${javadoc.package.exclude}</excludePackageNames>
</configuration>
<executions>
<execution>
<id>attach-javadocs</id>
<phase>verify</phase>
<goals>
<goal>jar</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.0</version>
<configuration>
<source>1.6</source>
<target>1.6</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>2.4</version>
<configuration>
<archive>
<manifestEntries>
<mode>development</mode>
<url>${project.url}</url>
<implementation-version>${project.version}</implementation-version>
<package>com.wordnik</package>
</manifestEntries>
</archive>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-site-plugin</artifactId>
<version>2.1</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-release-plugin</artifactId>
<version>2.1</version>
</plugin>
</plugins>
<pluginManagement>
<plugins>
<plugin>
<groupId>net.alchim31.maven</groupId>
<artifactId>scala-maven-plugin</artifactId>
<version>${scala-maven-plugin-version}</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-gpg-plugin</artifactId>
<configuration>
<releaseProfiles>release</releaseProfiles>
<goals>sign</goals>
</configuration>
</plugin>
</plugins>
</pluginManagement>
</build>
<profiles>
<profile>
<id>release-profile</id>
<properties>
<skipTests>true</skipTests>
</properties>
<build>
<plugins>
<plugin>
<groupId>net.alchim31.maven</groupId>
<artifactId>scala-maven-plugin</artifactId>
<executions>
<execution>
<goals>
<goal>compile</goal>
<goal>testCompile</goal>
</goals>
</execution>
</executions>
<configuration />
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
<executions>
<execution>
<id>add-source</id>
<phase>prepare-package</phase>
<goals>
<goal>add-source</goal>
</goals>
<configuration>
<sources>
<source>src/main/scala</source>
</sources>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
<profile>
<id>release-sign-artifacts</id>
<activation>
<property>
<name>performRelease</name>
<value>true</value>
</property>
</activation>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-gpg-plugin</artifactId>
<executions>
<execution>
<id>sign-artifacts</id>
<phase>verify</phase>
<goals>
<goal>sign</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
</profiles>
<reporting>
<outputDirectory>target/site</outputDirectory>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>2.9</version>
<configuration>
<aggregate>true</aggregate>
<debug>true</debug>
<links>
<link>http://java.sun.com/javaee/5/docs/api</link>
<link>http://java.sun.com/j2se/1.5.0/docs/api</link>
</links>
<excludePackageNames />
</configuration>
</plugin>
<plugin>
<groupId>net.alchim31.maven</groupId>
<artifactId>scala-maven-plugin</artifactId>
<version>${scala-maven-plugin-version}</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jxr-plugin</artifactId>
<version>2.3</version>
<configuration>
<aggregate>true</aggregate>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-project-info-reports-plugin</artifactId>
<version>2.6</version>
<reportSets>
<reportSet>
<reports>
<report>project-team</report>
</reports>
</reportSet>
</reportSets>
</plugin>
</plugins>
</reporting>
<dependencies>
<dependency>
<groupId>io.swagger</groupId>
<artifactId>swagger-parser</artifactId>
<version>${swagger-parser-version}</version>
</dependency>
<dependency>
<groupId>io.swagger</groupId>
<artifactId>swagger-legacy-spec-parser</artifactId>
<version>${swagger-parser-version}</version>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>swagger-core</artifactId>
<version>${swagger-core-version}</version>
</dependency>
<dependency>
<groupId>com.samskivert</groupId>
<artifactId>jmustache</artifactId>
<version>${jmustache-version}</version>
</dependency>
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
<version>${commons-io-version}</version>
</dependency>
<dependency>
<groupId>org.apache.maven</groupId>
<artifactId>maven-plugin-tools-api</artifactId>
<version>2.0</version>
</dependency>
<dependency>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<version>${felix-version}</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-ext</artifactId>
<version>${slf4j-version}</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>${slf4j-version}</version>
</dependency>
<dependency>
<groupId>commons-lang</groupId>
<artifactId>commons-lang</artifactId>
<version>${commons-lang-version}</version>
</dependency>
<dependency>
<groupId>commons-cli</groupId>
<artifactId>commons-cli</artifactId>
<version>${commons-cli-version}</version>
</dependency>
<dependency>
<groupId>org.scalatest</groupId>
<artifactId>scalatest_2.11</artifactId>
<version>${scala-test-version}</version>
<scope>test</scope>
</dependency>
</dependencies>
<repositories>
<repository>
<id>sonatype-snapshots</id>
<url>https://oss.sonatype.org/content/repositories/snapshots</url>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
</repositories>
</project>

View File

@ -7,9 +7,14 @@ import com.wordnik.swagger.util.Json;
import org.apache.commons.lang.StringUtils; import org.apache.commons.lang.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.util.*; import java.util.*;
public class DefaultCodegen { public class DefaultCodegen {
Logger LOGGER = LoggerFactory.getLogger(DefaultCodegen.class);
protected String outputFolder = ""; protected String outputFolder = "";
protected Set<String> defaultIncludes = new HashSet<String>(); protected Set<String> defaultIncludes = new HashSet<String>();
protected Map<String, String> typeMapping = new HashMap<String, String>(); protected Map<String, String> typeMapping = new HashMap<String, String>();
@ -375,7 +380,7 @@ public class DefaultCodegen {
Property prop = impl.getProperties().get(key); Property prop = impl.getProperties().get(key);
if(prop == null) { if(prop == null) {
System.out.println("null property for " + key); LOGGER.warn("null property for " + key);
} }
else { else {
CodegenProperty cp = fromProperty(key, prop); CodegenProperty cp = fromProperty(key, prop);
@ -422,7 +427,7 @@ public class DefaultCodegen {
public CodegenProperty fromProperty(String name, Property p) { public CodegenProperty fromProperty(String name, Property p) {
if(p == null) { if(p == null) {
System.out.println("unexpected missing property for name " + null); LOGGER.error("unexpected missing property for name " + null);
return null; return null;
} }
CodegenProperty property = CodegenModelFactory.newInstance(CodegenModelType.PROPERTY); CodegenProperty property = CodegenModelFactory.newInstance(CodegenModelType.PROPERTY);
@ -481,8 +486,7 @@ public class DefaultCodegen {
ArrayProperty ap = (ArrayProperty) p; ArrayProperty ap = (ArrayProperty) p;
CodegenProperty cp = fromProperty("inner", ap.getItems()); CodegenProperty cp = fromProperty("inner", ap.getItems());
if(cp == null) { if(cp == null) {
System.out.println("skipping invalid property:"); LOGGER.warn("skipping invalid property " + Json.pretty(p));
Json.prettyPrint(p);
} }
else { else {
property.baseType = getSwaggerType(p); property.baseType = getSwaggerType(p);
@ -540,7 +544,7 @@ public class DefaultCodegen {
} }
} }
operationId = builder.toString(); operationId = builder.toString();
System.out.println("generated operationId " + operationId); LOGGER.warn("generated operationId " + operationId);
} }
op.path = path; op.path = path;
op.operationId = operationId; op.operationId = operationId;
@ -741,7 +745,7 @@ public class DefaultCodegen {
if("array".equals(qp.getType())) { if("array".equals(qp.getType())) {
Property inner = qp.getItems(); Property inner = qp.getItems();
if(inner == null) { if(inner == null) {
System.out.println("warning! No inner type supplied for array parameter \"" + qp.getName() + "\", using String"); LOGGER.warn("warning! No inner type supplied for array parameter \"" + qp.getName() + "\", using String");
inner = new StringProperty().description("//TODO automatically added by swagger-codegen"); inner = new StringProperty().description("//TODO automatically added by swagger-codegen");
} }
property = new ArrayProperty(inner); property = new ArrayProperty(inner);
@ -753,7 +757,7 @@ public class DefaultCodegen {
else else
property = PropertyBuilder.build(qp.getType(), qp.getFormat(), null); property = PropertyBuilder.build(qp.getType(), qp.getFormat(), null);
if(property == null) { if(property == null) {
System.out.println("warning! Property type \"" + qp.getType() + "\" not found for parameter \"" + param.getName() + "\", using String"); LOGGER.warn("warning! Property type \"" + qp.getType() + "\" not found for parameter \"" + param.getName() + "\", using String");
property = new StringProperty().description("//TODO automatically added by swagger-codegen. Type was " + qp.getType() + " but not supported"); property = new StringProperty().description("//TODO automatically added by swagger-codegen. Type was " + qp.getType() + " but not supported");
} }
CodegenProperty model = fromProperty(qp.getName(), property); CodegenProperty model = fromProperty(qp.getName(), property);

View File

@ -0,0 +1,86 @@
#---------------------------------------------------------------------
# Global settings
#---------------------------------------------------------------------
global
log 127.0.0.1 local2
chroot /var/lib/haproxy
pidfile /var/run/haproxy.pid
maxconn 4000
user haproxy
group haproxy
daemon
#---------------------------------------------------------------------
# common defaults that all the 'listen' and 'backend' sections will
# use if not designated in their block
#---------------------------------------------------------------------
defaults
mode http
log global
option dontlognull
option httpclose
option httplog
option forwardfor
option redispatch
timeout connect 10000 # default 10 second time out if a backend is not found
timeout client 300000
timeout server 300000
maxconn 60000
retries 3
#---------------------------------------------------------------------
# main frontend which proxys to the backends
#---------------------------------------------------------------------
frontend main *:80
default_backend app
acl is_swagger_online hdr_beg(host) -i online.swagger.io
acl is_swagger_io hdr_beg(host) -i swagger.io
acl is_old hdr_beg(host) -i swagger.wordnik.com
acl is_old_editor hdr_beg(host) -i editor.swagger.wordnik.com
acl is_validator_swagger path_beg /swagger.json
# online spec validator
reqrep ([^\ ]*)\ /validator/(.*) \1\ /validator/validator/\2 if is_swagger_online
# something that didn't work
reqrep ([^\ ]*)\ /swagger.json(.*) \1\ /validator/swagger.json if is_validator_swagger
# swagger schema
reqrep ^([^\ :]*)\ /v2/schema.json(.*) \1\ /swagger-api/swagger-spec/master/schemas/v2.0/schema.json\2
acl is_swagger_spec path_beg /swagger-api/swagger-spec
# swagger docs
reqrep ^([^\ :]*)\ /swagger-core/documentation/annotations/apidocs/current(.*) \1\ /swagger-core/apidocs/\2
acl is_swagger_docs path_beg /swagger-core/apidocs
use_backend github_swagger_io if is_swagger_docs
use_backend validator if is_swagger_online
use_backend validator if is_validator_swagger
use_backend github_swagger_io if is_swagger_io !is_swagger_spec
use_backend github_swagger_spec if is_swagger_spec
redirect location http://editor.swagger.io if is_old_editor
redirect location http://swagger.io if is_old
#---------------------------------------------------------------------
# round robin balancing between the various backends
#---------------------------------------------------------------------
backend github_swagger_io
balance roundrobin
server gh1 swagger-api.github.io:80 check
backend github_swagger_spec
http-request set-header Host raw.githubusercontent.com
rspirep ^Content-type:(.*) Content-Type:\ application/json
rspirep ^Access-Control-Allow-Origin:(.*) Access-Control-Allow-Origin:*
balance roundrobin
server gh2 raw.githubusercontent.com:443 check ssl verify none
backend validator
balance roundrobin
server app1 127.0.0.1:8000 check
backend app
balance roundrobin
server app1 127.0.0.1:8000 check

View File

@ -10,8 +10,8 @@ import java.util.*;
import java.io.File; import java.io.File;
public class JaxRSServerCodegen extends JavaClientCodegen implements CodegenConfig { public class JaxRSServerCodegen extends JavaClientCodegen implements CodegenConfig {
protected String invokerPackage = "com.wordnik.api"; protected String invokerPackage = "io.swagger.api";
protected String groupId = "com.wordnik"; protected String groupId = "io.swagger";
protected String artifactId = "swagger-server"; protected String artifactId = "swagger-server";
protected String artifactVersion = "1.0.0"; protected String artifactVersion = "1.0.0";
protected String sourceFolder = "src/main/java"; protected String sourceFolder = "src/main/java";
@ -31,8 +31,8 @@ public class JaxRSServerCodegen extends JavaClientCodegen implements CodegenConf
modelTemplateFiles.put("model.mustache", ".java"); modelTemplateFiles.put("model.mustache", ".java");
apiTemplateFiles.put("api.mustache", ".java"); apiTemplateFiles.put("api.mustache", ".java");
templateDir = "JavaJaxRS"; templateDir = "JavaJaxRS";
apiPackage = "com.wordnik.api"; apiPackage = "io.swagger.api";
modelPackage = "com.wordnik.model"; modelPackage = "io.swagger.model";
additionalProperties.put("invokerPackage", invokerPackage); additionalProperties.put("invokerPackage", invokerPackage);
additionalProperties.put("groupId", groupId); additionalProperties.put("groupId", groupId);
@ -66,6 +66,22 @@ public class JaxRSServerCodegen extends JavaClientCodegen implements CodegenConf
); );
} }
@Override
public String getTypeDeclaration(Property p) {
if(p instanceof ArrayProperty) {
ArrayProperty ap = (ArrayProperty) p;
Property inner = ap.getItems();
return getSwaggerType(p) + "<" + getTypeDeclaration(inner) + ">";
}
else if (p instanceof MapProperty) {
MapProperty mp = (MapProperty) p;
Property inner = mp.getAdditionalProperties();
return getTypeDeclaration(inner);
}
return super.getTypeDeclaration(p);
}
@Override @Override
public void addOperationToGroup(String tag, String resourcePath, Operation operation, CodegenOperation co, Map<String, List<CodegenOperation>> operations) { public void addOperationToGroup(String tag, String resourcePath, Operation operation, CodegenOperation co, Map<String, List<CodegenOperation>> operations) {
String basePath = resourcePath; String basePath = resourcePath;

View File

@ -23,6 +23,7 @@ public class {{classname}} {
{{#subresourceOperation}}@Path("{{path}}"){{/subresourceOperation}} {{#subresourceOperation}}@Path("{{path}}"){{/subresourceOperation}}
{{#hasConsumes}}@Consumes({ {{#consumes}}"{{mediaType}}"{{#hasMore}}, {{/hasMore}}{{/consumes}} }){{/hasConsumes}} {{#hasConsumes}}@Consumes({ {{#consumes}}"{{mediaType}}"{{#hasMore}}, {{/hasMore}}{{/consumes}} }){{/hasConsumes}}
{{#hasProduces}}@Produces({ {{#produces}}"{{mediaType}}"{{#hasMore}}, {{/hasMore}}{{/produces}} }){{/hasProduces}} {{#hasProduces}}@Produces({ {{#produces}}"{{mediaType}}"{{#hasMore}}, {{/hasMore}}{{/produces}} }){{/hasProduces}}
// {{returnType}}
@ApiOperation(value = "{{{summary}}}", notes = "{{{notes}}}", response = {{{returnType}}}.class{{#returnContainer}}, responseContainer = "{{{returnContainer}}}"{{/returnContainer}}) @ApiOperation(value = "{{{summary}}}", notes = "{{{notes}}}", response = {{{returnType}}}.class{{#returnContainer}}, responseContainer = "{{{returnContainer}}}"{{/returnContainer}})
@ApiResponses(value = { {{#responses}} @ApiResponses(value = { {{#responses}}
@ApiResponse(code = {{{code}}}, message = "{{{message}}}"){{#hasMore}}, @ApiResponse(code = {{{code}}}, message = "{{{message}}}"){{#hasMore}},

View File

@ -123,14 +123,8 @@
<version>${servlet-api-version}</version> <version>${servlet-api-version}</version>
</dependency> </dependency>
</dependencies> </dependencies>
<repositories>
<repository>
<id>sonatype-snapshots</id>
<url>https://oss.sonatype.org/content/repositories/snapshots</url>
</repository>
</repositories>
<properties> <properties>
<swagger-core-version>1.5.0-SNAPSHOT</swagger-core-version> <swagger-core-version>1.5.0-M1</swagger-core-version>
<jetty-version>8.1.11.v20130520</jetty-version> <jetty-version>8.1.11.v20130520</jetty-version>
<jersey-version>1.13</jersey-version> <jersey-version>1.13</jersey-version>
<slf4j-version>1.6.3</slf4j-version> <slf4j-version>1.6.3</slf4j-version>

View File

@ -45,7 +45,7 @@
</servlet-mapping> </servlet-mapping>
<filter> <filter>
<filter-name>ApiOriginFilter</filter-name> <filter-name>ApiOriginFilter</filter-name>
<filter-class>com.wordnik.api.ApiOriginFilter</filter-class> <filter-class>{{apiPackage}}.ApiOriginFilter</filter-class>
</filter> </filter>
<filter-mapping> <filter-mapping>
<filter-name>ApiOriginFilter</filter-name> <filter-name>ApiOriginFilter</filter-name>

Some files were not shown because too many files have changed in this diff Show More