Skip to content

Commit 27b7130

Browse files
Merge branch 'master' into bug/overwrittenDefaultOutputDirNullPointer
2 parents 4bdd7aa + a5ab60b commit 27b7130

File tree

4,469 files changed

+163289
-20789
lines changed

Some content is hidden

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

4,469 files changed

+163289
-20789
lines changed

.gitignore

+4
Original file line numberDiff line numberDiff line change
@@ -232,3 +232,7 @@ samples/client/petstore/elm/index.html
232232
# C
233233
samples/client/petstore/c/build
234234
samples/client/petstore/c/*.so
235+
236+
# Ruby
237+
samples/openapi3/client/petstore/ruby/Gemfile.lock
238+
samples/openapi3/client/petstore/ruby-faraday/Gemfile.lock

.travis.yml

+6
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,12 @@ before_install:
9494
# - Rely on `kerl` for [pre-compiled versions available](https://docs.travis-ci.com/user/languages/erlang#Choosing-OTP-releases-to-test-against). Rely on installation path chosen by [`travis-erlang-builder`](https://github.com/travis-ci/travis-erlang-builder/blob/e6d016b1a91ca7ecac5a5a46395bde917ea13d36/bin/compile#L18).
9595
# - . ~/otp/18.2.1/activate && erl -version
9696
#- curl -f -L -o ./rebar3 https://s3.amazonaws.com/rebar3/rebar3 && chmod +x ./rebar3 && ./rebar3 version && export PATH="${TRAVIS_BUILD_DIR}:$PATH"
97+
# install Qt 5.10
98+
- sudo add-apt-repository --yes ppa:beineri/opt-qt-5.10.1-trusty
99+
- sudo apt-get update -qq
100+
- sudo apt-get install qt510-meta-minimal
101+
- source /opt/qt510/bin/qt510-env.sh
102+
- qmake -v
97103

98104
# show host table to confirm petstore.swagger.io is mapped to localhost
99105
- cat /etc/hosts

CI/.drone.yml

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
kind: pipeline
2+
name: default
3+
4+
steps:
5+
# test Java 11 HTTP client
6+
- name: java11-test
7+
image: hirokimatsumoto/alpine-openjdk-11
8+
commands:
9+
- ./mvnw clean install
10+
- ./mvnw --quiet verify -Psamples.droneio
11+
# test ocaml petstore client
12+
- name: ocaml-test
13+
image: ocaml/opam2:4.07
14+
commands:
15+
- sudo apt-get -y install m4
16+
- cd samples/client/petstore/ocaml
17+
- opam install ppx_deriving_yojson cohttp ppx_deriving cohttp-lwt-unix
18+
- eval $(opam env)
19+
- sudo chmod -R 777 .
20+
- dune build --build-dir=./_build

CI/samples.ci/client/petstore/java/test-manual/okhttp-gson/ApiClientTest.java

+10-15
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010

1111
import org.junit.*;
1212
import static org.junit.Assert.*;
13+
import static org.hamcrest.CoreMatchers.*;
1314

1415

1516
public class ApiClientTest {
@@ -329,24 +330,18 @@ public void testSanitizeFilename() {
329330
assertEquals("sun.gif", apiClient.sanitizeFilename(".\\sun.gif"));
330331
}
331332

332-
333333
@Test
334-
public void testInterceptorCleanupWithNewClient() {
334+
public void testNewHttpClient() {
335335
OkHttpClient oldClient = apiClient.getHttpClient();
336-
assertEquals(1, oldClient.networkInterceptors().size());
337-
338-
OkHttpClient newClient = new OkHttpClient();
339-
apiClient.setHttpClient(newClient);
340-
assertEquals(1, apiClient.getHttpClient().networkInterceptors().size());
341-
apiClient.setHttpClient(newClient);
342-
assertEquals(1, apiClient.getHttpClient().networkInterceptors().size());
336+
apiClient.setHttpClient(oldClient.newBuilder().build());
337+
assertThat(apiClient.getHttpClient(), is(not(oldClient)));
343338
}
344339

345-
@Test
346-
public void testInterceptorCleanupWithSameClient() {
347-
OkHttpClient oldClient = apiClient.getHttpClient();
348-
assertEquals(1, oldClient.networkInterceptors().size());
349-
apiClient.setHttpClient(oldClient);
350-
assertEquals(1, apiClient.getHttpClient().networkInterceptors().size());
340+
/**
341+
* Tests the invariant that the HttpClient for the ApiClient must never be null
342+
*/
343+
@Test(expected = NullPointerException.class)
344+
public void testNullHttpClient() {
345+
apiClient.setHttpClient(null);
351346
}
352347
}

CI/samples.ci/client/petstore/java/test-manual/okhttp-gson/model/ArrayOfArrayOfNumberOnlyTest.java

+2
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ public void arrayArrayNumberTest() {
5353
List<BigDecimal> arrayArrayNumber = new ArrayList<BigDecimal>();
5454
arrayArrayNumber.add(b1);
5555
arrayArrayNumber.add(b2);
56+
model.setArrayArrayNumber(new ArrayList<List<BigDecimal>>());
5657
model.getArrayArrayNumber().add(arrayArrayNumber);
5758

5859
// create another instance for comparison
@@ -62,6 +63,7 @@ public void arrayArrayNumberTest() {
6263
List<BigDecimal> arrayArrayNumber2 = new ArrayList<BigDecimal>();
6364
arrayArrayNumber2.add(b1);
6465
arrayArrayNumber2.add(b2);
66+
model2.setArrayArrayNumber(new ArrayList<List<BigDecimal>>());
6567
model2.getArrayArrayNumber().add(arrayArrayNumber2);
6668

6769
Assert.assertTrue(model2.equals(model));

README.md

+32-16
Large diffs are not rendered by default.

bin/cpp-qt5-petstore.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,6 @@ fi
2727

2828
# if you've executed sbt assembly previously it will use that instead.
2929
export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties"
30-
ags="generate -t modules/openapi-generator/src/main/resources/cpp-qt5-client -i modules/openapi-generator/src/test/resources/3_0/petstore.yaml -g cpp-qt5-client -o samples/client/petstore/cpp-qt5 $@"
30+
ags="generate -t modules/openapi-generator/src/main/resources/cpp-qt5-client -i modules/openapi-generator/src/test/resources/2_0/petstore.yaml -g cpp-qt5-client -o samples/client/petstore/cpp-qt5 $@"
3131

3232
java $JAVA_OPTS -jar $executable $ags

bin/java-petstore-all.sh

+1
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
./bin/java-petstore-feign-10x.sh
88
./bin/java-petstore-okhttp-gson.sh
99
./bin/java-petstore-okhttp-gson-parcelable.sh
10+
./bin/java-petstore-native.sh
1011
./bin/java-petstore-retrofit.sh
1112
./bin/java-petstore-retrofit2.sh
1213
./bin/java-petstore-retrofit2rx.sh

bin/java-petstore-jersey1.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ fi
2727

2828
# if you've executed sbt assembly previously it will use that instead.
2929
export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties"
30-
ags="generate --artifact-id petstore-java-client-jersey1 -t modules/openapi-generator/src/main/resources/Java -i modules/openapi-generator/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml -g java -o samples/client/petstore/java/jersey1 --additional-properties hideGenerationTimestamp=true --library=jersey1 --additional-properties useNullForUnknownEnumValue=true $@"
30+
ags="generate --artifact-id petstore-java-client-jersey1 -t modules/openapi-generator/src/main/resources/Java -i modules/openapi-generator/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml -g java -o samples/client/petstore/java/jersey1 --additional-properties hideGenerationTimestamp=true --library=jersey1 $@"
3131

3232
echo "Removing files and folders under samples/client/petstore/java/jersey1/src/main"
3333
rm -rf samples/client/petstore/java/jersey1/src/main

bin/java-petstore-jersey2.json

+1-4
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,4 @@
11
{
22
"library": "jersey2",
3-
"artifactId": "petstore-jersey2",
4-
"additionalProperties" : {
5-
"useNullForUnknownEnumValue" : true
6-
}
3+
"artifactId": "petstore-jersey2"
74
}

bin/java-petstore-native.json

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"library": "native",
3+
"artifactId": "petstore-native"
4+
}

bin/java-petstore-native.sh

+35
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
#!/bin/sh
2+
3+
SCRIPT="$0"
4+
echo "# START SCRIPT: $SCRIPT"
5+
6+
while [ -h "$SCRIPT" ] ; do
7+
ls=`ls -ld "$SCRIPT"`
8+
link=`expr "$ls" : '.*-> \(.*\)$'`
9+
if expr "$link" : '/.*' > /dev/null; then
10+
SCRIPT="$link"
11+
else
12+
SCRIPT=`dirname "$SCRIPT"`/"$link"
13+
fi
14+
done
15+
16+
if [ ! -d "${APP_DIR}" ]; then
17+
APP_DIR=`dirname "$SCRIPT"`/..
18+
APP_DIR=`cd "${APP_DIR}"; pwd`
19+
fi
20+
21+
executable="./modules/openapi-generator-cli/target/openapi-generator-cli.jar"
22+
23+
if [ ! -f "$executable" ]
24+
then
25+
mvn -B clean package
26+
fi
27+
28+
# if you've executed sbt assembly previously it will use that instead.
29+
export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties"
30+
ags="generate -t modules/openapi-generator/src/main/resources/Java/libraries/native -i modules/openapi-generator/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml -g java -c bin/java-petstore-native.json -o samples/client/petstore/java/native --additional-properties hideGenerationTimestamp=true $@"
31+
32+
echo "Removing files and folders under samples/client/petstore/java/httpclient/src/main"
33+
rm -rf samples/client/petstore/java/native/src/main
34+
find samples/client/petstore/java/native -maxdepth 1 -type f ! -name "README.md" -exec rm {} +
35+
java $JAVA_OPTS -jar $executable $ags

bin/nodejs-express-petstore-server.sh

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

bin/ocaml-petstore.sh

+34
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
#!/bin/sh
2+
3+
SCRIPT="$0"
4+
echo "# START SCRIPT: $SCRIPT"
5+
6+
while [ -h "$SCRIPT" ] ; do
7+
ls=`ls -ld "$SCRIPT"`
8+
link=`expr "$ls" : '.*-> \(.*\)$'`
9+
if expr "$link" : '/.*' > /dev/null; then
10+
SCRIPT="$link"
11+
else
12+
SCRIPT=`dirname "$SCRIPT"`/"$link"
13+
fi
14+
done
15+
16+
if [ ! -d "${APP_DIR}" ]; then
17+
APP_DIR=`dirname "$SCRIPT"`/..
18+
APP_DIR=`cd "${APP_DIR}"; pwd`
19+
fi
20+
21+
executable="./modules/openapi-generator-cli/target/openapi-generator-cli.jar"
22+
23+
if [ ! -f "$executable" ]
24+
then
25+
mvn -B clean package
26+
fi
27+
28+
# if you've executed sbt assembly previously it will use that instead.
29+
export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties"
30+
31+
args="generate -t modules/openapi-generator/src/main/resources/ocaml -i modules/openapi-generator/src/test/resources/2_0/petstore.yaml -g ocaml -o samples/client/petstore/ocaml --additional-properties packageName=petstore_client $@"
32+
33+
echo "java ${JAVA_OPTS} -jar ${executable} ${args}"
34+
java $JAVA_OPTS -jar $executable $args

bin/openapi3/ocaml-client-petstore.sh

+34
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
#!/bin/sh
2+
3+
SCRIPT="$0"
4+
echo "# START SCRIPT: $SCRIPT"
5+
6+
while [ -h "$SCRIPT" ] ; do
7+
ls=`ls -ld "$SCRIPT"`
8+
link=`expr "$ls" : '.*-> \(.*\)$'`
9+
if expr "$link" : '/.*' > /dev/null; then
10+
SCRIPT="$link"
11+
else
12+
SCRIPT=`dirname "$SCRIPT"`/"$link"
13+
fi
14+
done
15+
16+
if [ ! -d "${APP_DIR}" ]; then
17+
APP_DIR=`dirname "$SCRIPT"`/..
18+
APP_DIR=`cd "${APP_DIR}"; pwd`
19+
fi
20+
21+
executable="./modules/openapi-generator-cli/target/openapi-generator-cli.jar"
22+
23+
if [ ! -f "$executable" ]
24+
then
25+
mvn -B clean package
26+
fi
27+
28+
# if you've executed sbt assembly previously it will use that instead.
29+
export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DdebugOperations -DloggerPath=conf/log4j.properties"
30+
31+
args="generate -t modules/openapi-generator/src/main/resources/ocaml -i modules/openapi-generator/src/test/resources/3_0/petstore-with-fake-endpoints-models-for-testing.yaml -g ocaml -o samples/openapi3/client/petstore/ocaml/ --additional-properties packageName=petstore_client $@"
32+
33+
echo "java ${JAVA_OPTS} -jar ${executable} ${args}"
34+
java $JAVA_OPTS -jar $executable $args

bin/openapi3/php-symfony-petstore.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ if [ ! -d "${APP_DIR}" ]; then
2323
fi
2424

2525
# Make sure that we are regenerating the sample by removing any existing target directory
26-
TARGET_DIR="$SCRIPT_DIR/../../samples/server/petstore/php-symfony/SymfonyBundle-php"
26+
TARGET_DIR="$SCRIPT_DIR/../../samples/openapi3/server/petstore/php-symfony/SymfonyBundle-php"
2727
if [ -d "$TARGET_DIR" ]; then
2828
rm -rf $TARGET_DIR
2929
fi
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
#!/bin/sh
2+
3+
SCRIPT="$0"
4+
echo "# START SCRIPT: $SCRIPT"
5+
6+
while [ -h "$SCRIPT" ] ; do
7+
ls=`ls -ld "$SCRIPT"`
8+
link=`expr "$ls" : '.*-> \(.*\)$'`
9+
if expr "$link" : '/.*' > /dev/null; then
10+
SCRIPT="$link"
11+
else
12+
SCRIPT=`dirname "$SCRIPT"`/"$link"
13+
fi
14+
done
15+
16+
if [ ! -d "${APP_DIR}" ]; then
17+
APP_DIR=`dirname "$SCRIPT"`/..
18+
APP_DIR=`cd "${APP_DIR}"; pwd`
19+
fi
20+
21+
executable="./modules/openapi-generator-cli/target/openapi-generator-cli.jar"
22+
23+
if [ ! -f "$executable" ]
24+
then
25+
mvn clean package
26+
fi
27+
28+
# purge lib/doc folder
29+
echo "purge ruby petstore lib, docs folder"
30+
rm -Rf samples/openapi3/client/petstore/ruby-faraday/lib
31+
rm -Rf samples/openapi3/client/petstore/ruby-faraday/docs
32+
33+
# purge test files other than integration test
34+
# NOTE: spec/custom/*.rb and spec/petstore_helper.rb are not generated files
35+
echo "purge ruby petstore spec"
36+
find samples/openapi3/client/petstore/ruby-faraday/spec -type d -not -name spec -not -name custom | xargs rm -Rf
37+
find samples/openapi3/client/petstore/ruby-faraday/spec -type f -not -name petstore_helper.rb -not -iwholename '*/spec/custom/*' | xargs rm -Rf
38+
39+
# if you've executed sbt assembly previously it will use that instead.
40+
export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties"
41+
ags="generate -t modules/openapi-generator/src/main/resources/ruby-client -i modules/openapi-generator/src/test/resources/3_0/petstore-with-fake-endpoints-models-for-testing.yaml -g ruby -c bin/openapi3/ruby-petstore-faraday.json -o samples/openapi3/client/petstore/ruby-faraday --additional-properties skipFormModel=true $@"
42+
43+
java $JAVA_OPTS -jar $executable $ags
+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"gemName": "petstore",
3+
"moduleName": "Petstore",
4+
"library": "faraday",
5+
"gemVersion": "1.0.0"
6+
}

bin/ruby-client-petstore-faraday.sh

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

bin/ruby-petstore-faraday.json

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"gemName": "petstore",
3+
"moduleName": "Petstore",
4+
"library": "faraday",
5+
"gemVersion": "1.0.0"
6+
}

bin/ruby-petstore.json

+1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
{
22
"gemName": "petstore",
3+
"library": "typhoeus",
34
"moduleName": "Petstore",
45
"gemVersion": "1.0.0"
56
}

bin/rust-server-petstore.sh

+4
Original file line numberDiff line numberDiff line change
@@ -38,4 +38,8 @@ for spec_path in modules/openapi-generator/src/test/resources/*/rust-server/* ;
3838
$@"
3939

4040
java $JAVA_OPTS -jar $executable $args
41+
42+
if [ $? -ne 0 ]; then
43+
exit $?
44+
fi
4145
done

0 commit comments

Comments
 (0)