diff --git a/bin/ada-petstore.sh b/bin/ada-petstore.sh index 87005f0ee1bf..5441bd13ec31 100755 --- a/bin/ada-petstore.sh +++ b/bin/ada-petstore.sh @@ -30,7 +30,7 @@ export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties" model="modules/openapi-generator/src/test/resources/2_0/petstore.yaml" ags="generate --template-dir modules/openapi-generator/src/main/resources/Ada -g ada $@" ags="$ags -i $model -t modules/openapi-generator/src/main/resources/Ada -o samples/client/petstore/ada" -ags="$ags -DprojectName=Petstore --model-package Samples.Petstore" +ags="$ags --additional-properties projectName=Petstore --model-package Samples.Petstore" java $JAVA_OPTS -jar $executable $ags rm -rf samples/client/petstore/ada/src/server diff --git a/bin/android-petstore-httpclient.sh b/bin/android-petstore-httpclient.sh index c2e03a737faf..d0982cec14fc 100755 --- a/bin/android-petstore-httpclient.sh +++ b/bin/android-petstore-httpclient.sh @@ -27,6 +27,6 @@ fi # if you've executed sbt assembly previously it will use that instead. export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties" -ags="generate -t modules/openapi-generator/src/main/resources/android -i modules/openapi-generator/src/test/resources/2_0/petstore.yaml -g android -Dlibrary=httpclient -o samples/client/petstore/android/httpclient $@" +ags="generate -t modules/openapi-generator/src/main/resources/android -i modules/openapi-generator/src/test/resources/2_0/petstore.yaml -g android --additional-properties library=httpclient -o samples/client/petstore/android/httpclient $@" java $JAVA_OPTS -jar $executable $ags diff --git a/bin/dart-flutter-petstore.sh b/bin/dart-flutter-petstore.sh index af7a58af75f6..af3aaca2bec8 100755 --- a/bin/dart-flutter-petstore.sh +++ b/bin/dart-flutter-petstore.sh @@ -28,18 +28,18 @@ fi export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties" ## Generate non-browserClient -#ags="generate -t modules/openapi-generator/src/main/resources/dart -i modules/openapi-generator/src/test/resources/2_0/petstore.yaml -g dart -o samples/client/petstore/dart/swagger -DhideGenerationTimestamp=true -DbrowserClient=false $@" +#ags="generate -t modules/openapi-generator/src/main/resources/dart -i modules/openapi-generator/src/test/resources/2_0/petstore.yaml -g dart -o samples/client/petstore/dart/swagger --additional-properties hideGenerationTimestamp=true,browserClient=false $@" # ## then options to generate the library for vm would be: -##ags="generate -i modules/openapi-generator/src/test/resources/2_0/petstore.yaml -g dart -o samples/client/petstore/dart/swagger_vm -DbrowserClient=false -DpubName=swagger_vm $@" +##ags="generate -i modules/openapi-generator/src/test/resources/2_0/petstore.yaml -g dart -o samples/client/petstore/dart/swagger_vm --additional-properties browserClient=false,pubName=swagger_vm $@" #java $JAVA_OPTS -jar $executable $ags # ## Generate browserClient -#ags="generate -t modules/openapi-generator/src/main/resources/dart -i modules/openapi-generator/src/test/resources/2_0/petstore.yaml -g dart -o samples/client/petstore/dart/swagger-browser-client -DhideGenerationTimestamp=true -DbrowserClient=true $@" +#ags="generate -t modules/openapi-generator/src/main/resources/dart -i modules/openapi-generator/src/test/resources/2_0/petstore.yaml -g dart -o samples/client/petstore/dart/swagger-browser-client --additional-properties hideGenerationTimestamp=true,browserClient=true $@" #java $JAVA_OPTS -jar $executable $ags # Generate non-browserClient and put it to the flutter sample app -ags="generate -t modules/openapi-generator/src/main/resources/dart -i modules/openapi-generator/src/test/resources/2_0/petstore.yaml -g dart -o samples/client/petstore/dart/flutter_petstore/swagger -DhideGenerationTimestamp=true -DbrowserClient=false $@" +ags="generate -t modules/openapi-generator/src/main/resources/dart -i modules/openapi-generator/src/test/resources/2_0/petstore.yaml -g dart -o samples/client/petstore/dart/flutter_petstore/swagger --additional-properties hideGenerationTimestamp=true,browserClient=false $@" java $JAVA_OPTS -jar $executable $ags # There is a proposal to allow importing different libraries depending on the environment: diff --git a/bin/dart-jaguar-petstore.sh b/bin/dart-jaguar-petstore.sh index ffec056c46e5..c5348cd34be0 100755 --- a/bin/dart-jaguar-petstore.sh +++ b/bin/dart-jaguar-petstore.sh @@ -28,19 +28,19 @@ fi export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties" # Generate client -ags="$@ generate -t modules/openapi-generator/src/main/resources/dart-jaguar -i modules/openapi-generator/src/test/resources/2_0/petstore.yaml -g dart-jaguar -o samples/client/petstore/dart-jaguar/openapi -DhideGenerationTimestamp=true -DpubName=openapi" +ags="$@ generate -t modules/openapi-generator/src/main/resources/dart-jaguar -i modules/openapi-generator/src/test/resources/2_0/petstore.yaml -g dart-jaguar -o samples/client/petstore/dart-jaguar/openapi --additional-properties hideGenerationTimestamp=true,pubName=openapi" java $JAVA_OPTS -jar $executable $ags # Generate non-browserClient and put it to the flutter sample app -ags="$@ generate -t modules/openapi-generator/src/main/resources/dart-jaguar -i modules/openapi-generator/src/test/resources/2_0/petstore.yaml -g dart-jaguar -o samples/client/petstore/dart-jaguar/flutter_petstore/openapi -DhideGenerationTimestamp=true -DpubName=openapi" +ags="$@ generate -t modules/openapi-generator/src/main/resources/dart-jaguar -i modules/openapi-generator/src/test/resources/2_0/petstore.yaml -g dart-jaguar -o samples/client/petstore/dart-jaguar/flutter_petstore/openapi --additional-properties hideGenerationTimestamp=true,pubName=openapi" java $JAVA_OPTS -jar $executable $ags # Generate proto and put it to the flutter sample app -ags="$@ generate -t modules/openapi-generator/src/main/resources/dart-jaguar -i modules/openapi-generator/src/test/resources/2_0/petstore-proto.yaml -g dart-jaguar -o samples/client/petstore/dart-jaguar/flutter_proto_petstore/openapi -Dserialization=proto -DhideGenerationTimestamp=true -DpubName=openapi" +ags="$@ generate -t modules/openapi-generator/src/main/resources/dart-jaguar -i modules/openapi-generator/src/test/resources/2_0/petstore-proto.yaml -g dart-jaguar -o samples/client/petstore/dart-jaguar/flutter_proto_petstore/openapi --additional-properties serialization=proto,hideGenerationTimestamp=true,pubName=openapi" java $JAVA_OPTS -jar $executable $ags # Generate proto and put it to the sample -ags="$@ generate -t modules/openapi-generator/src/main/resources/dart-jaguar -i modules/openapi-generator/src/test/resources/2_0/petstore-proto.yaml -g dart-jaguar -o samples/client/petstore/dart-jaguar/openapi_proto -Dserialization=proto -DhideGenerationTimestamp=true -DpubName=openapi" +ags="$@ generate -t modules/openapi-generator/src/main/resources/dart-jaguar -i modules/openapi-generator/src/test/resources/2_0/petstore-proto.yaml -g dart-jaguar -o samples/client/petstore/dart-jaguar/openapi_proto --additional-properties serialization=proto,hideGenerationTimestamp=true,pubName=openapi" java $JAVA_OPTS -jar $executable $ags # There is a proposal to allow importing different libraries depending on the environment: diff --git a/bin/dart-petstore.sh b/bin/dart-petstore.sh index 669105c6ae5e..ee60cb6c4f81 100755 --- a/bin/dart-petstore.sh +++ b/bin/dart-petstore.sh @@ -29,18 +29,18 @@ fi export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties" # Generate non-browserClient -ags="generate -t modules/openapi-generator/src/main/resources/dart -i modules/openapi-generator/src/test/resources/2_0/petstore.yaml -g dart -o samples/client/petstore/dart/openapi -DhideGenerationTimestamp=true -DbrowserClient=false --additional-properties supportDart2=false $@" +ags="generate -t modules/openapi-generator/src/main/resources/dart -i modules/openapi-generator/src/test/resources/2_0/petstore.yaml -g dart -o samples/client/petstore/dart/openapi --additional-properties hideGenerationTimestamp=true,browserClient=false,supportDart2=false $@" # then options to generate the library for vm would be: -#ags="generate -i modules/openapi-generator/src/test/resources/2_0/petstore.yaml -g dart -o samples/client/petstore/dart/openapi_vm -DbrowserClient=false -DpubName=openapi_vm --additional-properties supportDart2=false $@" +#ags="generate -i modules/openapi-generator/src/test/resources/2_0/petstore.yaml -g dart -o samples/client/petstore/dart/openapi_vm --additional-properties browserClient=false,pubName=openapi_vm --additional-properties supportDart2=false $@" java $JAVA_OPTS -jar $executable $ags # Generate browserClient -ags="generate -t modules/openapi-generator/src/main/resources/dart -i modules/openapi-generator/src/test/resources/2_0/petstore.yaml -g dart -o samples/client/petstore/dart/openapi-browser-client -DhideGenerationTimestamp=true -DbrowserClient=true --additional-properties supportDart2=false $@" +ags="generate -t modules/openapi-generator/src/main/resources/dart -i modules/openapi-generator/src/test/resources/2_0/petstore.yaml -g dart -o samples/client/petstore/dart/openapi-browser-client --additional-properties hideGenerationTimestamp=true,browserClient=true,supportDart2=false $@" java $JAVA_OPTS -jar $executable $ags # Generate non-browserClient and put it to the flutter sample app -ags="generate -t modules/openapi-generator/src/main/resources/dart -i modules/openapi-generator/src/test/resources/2_0/petstore.yaml -g dart -o samples/client/petstore/dart/flutter_petstore/openapi -DhideGenerationTimestamp=true -DbrowserClient=false --additional-properties supportDart2=false $@" +ags="generate -t modules/openapi-generator/src/main/resources/dart -i modules/openapi-generator/src/test/resources/2_0/petstore.yaml -g dart -o samples/client/petstore/dart/flutter_petstore/openapi --additional-properties hideGenerationTimestamp=true,browserClient=false,supportDart2=false $@" java $JAVA_OPTS -jar $executable $ags # There is a proposal to allow importing different libraries depending on the environment: diff --git a/bin/dart2-petstore.sh b/bin/dart2-petstore.sh index 8fa61715ada2..e8a57ffca7e3 100755 --- a/bin/dart2-petstore.sh +++ b/bin/dart2-petstore.sh @@ -29,18 +29,18 @@ fi export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties" # Generate non-browserClient -ags="generate -t modules/openapi-generator/src/main/resources/dart -i modules/openapi-generator/src/test/resources/2_0/petstore.yaml -g dart -o samples/client/petstore/dart2/openapi -DhideGenerationTimestamp=true -DbrowserClient=false $@" +ags="generate -t modules/openapi-generator/src/main/resources/dart -i modules/openapi-generator/src/test/resources/2_0/petstore.yaml -g dart -o samples/client/petstore/dart2/openapi --additional-properties hideGenerationTimestamp=true,browserClient=false $@" # then options to generate the library for vm would be: -#ags="generate -i modules/openapi-generator/src/test/resources/2_0/petstore.yaml -g dart -o samples/client/petstore/dart2/openapi_vm -DbrowserClient=false -DpubName=openapi_vm $@" +#ags="generate -i modules/openapi-generator/src/test/resources/2_0/petstore.yaml -g dart -o samples/client/petstore/dart2/openapi_vm --additional-properties browserClient=false,pubName=openapi_vm $@" java $JAVA_OPTS -jar $executable $ags # Generate browserClient -ags="generate -t modules/openapi-generator/src/main/resources/dart -i modules/openapi-generator/src/test/resources/2_0/petstore.yaml -g dart -o samples/client/petstore/dart2/openapi-browser-client -DhideGenerationTimestamp=true -DbrowserClient=true $@" +ags="generate -t modules/openapi-generator/src/main/resources/dart -i modules/openapi-generator/src/test/resources/2_0/petstore.yaml -g dart -o samples/client/petstore/dart2/openapi-browser-client --additional-properties hideGenerationTimestamp=true,browserClient=true $@" java $JAVA_OPTS -jar $executable $ags # Generate non-browserClient and put it to the flutter sample app -ags="generate -t modules/openapi-generator/src/main/resources/dart -i modules/openapi-generator/src/test/resources/2_0/petstore.yaml -g dart -o samples/client/petstore/dart2/flutter_petstore/openapi -DhideGenerationTimestamp=true -DbrowserClient=false $@" +ags="generate -t modules/openapi-generator/src/main/resources/dart -i modules/openapi-generator/src/test/resources/2_0/petstore.yaml -g dart -o samples/client/petstore/dart2/flutter_petstore/openapi --additional-properties hideGenerationTimestamp=true,browserClient=false $@" java $JAVA_OPTS -jar $executable $ags # There is a proposal to allow importing different libraries depending on the environment: diff --git a/bin/erlang-petstore-client.sh b/bin/erlang-petstore-client.sh index 7afeffd2e3f2..77ee5acf0ef9 100755 --- a/bin/erlang-petstore-client.sh +++ b/bin/erlang-petstore-client.sh @@ -27,6 +27,6 @@ fi # if you've executed sbt assembly previously it will use that instead. export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties" -ags="generate -t modules/openapi-generator/src/main/resources/erlang-client -DpackageName=petstore -i modules/openapi-generator/src/test/resources/2_0/petstore.yaml -g erlang-client -o samples/client/petstore/erlang-client $@" +ags="generate -t modules/openapi-generator/src/main/resources/erlang-client --additional-properties packageName=petstore -i modules/openapi-generator/src/test/resources/2_0/petstore.yaml -g erlang-client -o samples/client/petstore/erlang-client $@" java $JAVA_OPTS -jar $executable $ags diff --git a/bin/erlang-petstore-proper.sh b/bin/erlang-petstore-proper.sh index 409b5f2eae46..4c19eec46df7 100755 --- a/bin/erlang-petstore-proper.sh +++ b/bin/erlang-petstore-proper.sh @@ -27,6 +27,6 @@ fi # if you've executed sbt assembly previously it will use that instead. export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties" -ags="generate -t modules/openapi-generator/src/main/resources/erlang-proper -DpackageName=petstore -i modules/openapi-generator/src/test/resources/2_0/petstore.yaml -g erlang-proper -o samples/client/petstore/erlang-proper $@" +ags="generate -t modules/openapi-generator/src/main/resources/erlang-proper --additional-properties packageName=petstore -i modules/openapi-generator/src/test/resources/2_0/petstore.yaml -g erlang-proper -o samples/client/petstore/erlang-proper $@" java $JAVA_OPTS -jar $executable $ags diff --git a/bin/go-gin-petstore-server.sh b/bin/go-gin-petstore-server.sh index 1ac7605d7918..b18bffcdff72 100755 --- a/bin/go-gin-petstore-server.sh +++ b/bin/go-gin-petstore-server.sh @@ -35,7 +35,7 @@ rm -rf $STUB_DIR # if you've executed sbt assembly previously it will use that instead. export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties" -ags="generate -t modules/openapi-generator/src/main/resources/go-gin-server -i $SPEC -g $GENERATOR -o $STUB_DIR -DpackageName=petstoreserver --additional-properties hideGenerationTimestamp=true -Dservice $@" +ags="generate -t modules/openapi-generator/src/main/resources/go-gin-server -i $SPEC -g $GENERATOR -o $STUB_DIR --additional-properties packageName=petstoreserver --additional-properties hideGenerationTimestamp=true $@" java $JAVA_OPTS -jar $executable $ags #!/usr/bin/env bash \ No newline at end of file diff --git a/bin/go-petstore-server.sh b/bin/go-petstore-server.sh index 32dfa8e93c46..3e5c19e436b9 100755 --- a/bin/go-petstore-server.sh +++ b/bin/go-petstore-server.sh @@ -35,6 +35,6 @@ rm -rf $STUB_DIR # if you've executed sbt assembly previously it will use that instead. export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties" -ags="generate -t modules/openapi-generator/src/main/resources/go-server -i $SPEC -g $GENERATOR -o $STUB_DIR -DpackageName=petstoreserver --additional-properties hideGenerationTimestamp=true -Dservice $@" +ags="generate -t modules/openapi-generator/src/main/resources/go-server -i $SPEC -g $GENERATOR -o $STUB_DIR --additional-properties packageName=petstoreserver,hideGenerationTimestamp=true $@" java $JAVA_OPTS -jar $executable $ags diff --git a/bin/go-petstore-withxml.sh b/bin/go-petstore-withxml.sh index 50b8cb27833f..4c5754972548 100755 --- a/bin/go-petstore-withxml.sh +++ b/bin/go-petstore-withxml.sh @@ -34,6 +34,6 @@ rm -rf $STUB_DIR # if you've executed sbt assembly previously it will use that instead. export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties" -ags="generate -t modules/openapi-generator/src/main/resources/go -i $SPEC -g $GENERATOR -o $STUB_DIR -DpackageName=petstore,withXml=true,withGoCodegenComment=true $@" +ags="generate -t modules/openapi-generator/src/main/resources/go -i $SPEC -g $GENERATOR -o $STUB_DIR --additional-properties packageName=petstore,withXml=true,withGoCodegenComment=true $@" java $JAVA_OPTS -jar $executable $ags diff --git a/bin/go-petstore.sh b/bin/go-petstore.sh index 865212c93bac..7dc5fe4907bf 100755 --- a/bin/go-petstore.sh +++ b/bin/go-petstore.sh @@ -34,6 +34,6 @@ rm -rf $STUB_DIR # if you've executed sbt assembly previously it will use that instead. export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties" -ags="generate -t modules/openapi-generator/src/main/resources/go -i $SPEC -g $GENERATOR -o $STUB_DIR -DpackageName=petstore $@" +ags="generate -t modules/openapi-generator/src/main/resources/go -i $SPEC -g $GENERATOR -o $STUB_DIR --additional-properties packageName=petstore $@" java $JAVA_OPTS -jar $executable $ags diff --git a/bin/graphql-nodejs-express-server.sh b/bin/graphql-nodejs-express-server.sh index b257e5299352..69ee4a3bf556 100755 --- a/bin/graphql-nodejs-express-server.sh +++ b/bin/graphql-nodejs-express-server.sh @@ -27,6 +27,6 @@ fi # if you've executed sbt assembly previously it will use that instead. export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties $@" -ags="generate -t modules/openapi-generator/src/main/resources/graphql-nodejs-express-server -i modules/openapi-generator/src/test/resources/2_0/petstore.yaml -g graphql-nodejs-express-server -o samples/server/petstore/graphql-nodejs-express-server -DpackageName=petstore $@" +ags="generate -t modules/openapi-generator/src/main/resources/graphql-nodejs-express-server -i modules/openapi-generator/src/test/resources/2_0/petstore.yaml -g graphql-nodejs-express-server -o samples/server/petstore/graphql-nodejs-express-server --additional-properties packageName=petstore $@" java $JAVA_OPTS -jar $executable $ags diff --git a/bin/graphql-schema-petstore.sh b/bin/graphql-schema-petstore.sh index 10dfb5a5dc9d..c6f36de2b5e9 100755 --- a/bin/graphql-schema-petstore.sh +++ b/bin/graphql-schema-petstore.sh @@ -27,6 +27,6 @@ fi # if you've executed sbt assembly previously it will use that instead. export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties $@" -ags="generate -t modules/openapi-generator/src/main/resources/graphql-schema -i modules/openapi-generator/src/test/resources/2_0/petstore.yaml -g graphql-schema -o samples/config/petstore/graphql-schema -DpackageName=petstore $@" +ags="generate -t modules/openapi-generator/src/main/resources/graphql-schema -i modules/openapi-generator/src/test/resources/2_0/petstore.yaml -g graphql-schema -o samples/config/petstore/graphql-schema --additional-properties packageName=petstore $@" java $JAVA_OPTS -jar $executable $ags diff --git a/bin/groovy-petstore.sh b/bin/groovy-petstore.sh index 99fa2e940a5b..1a9db858a3c7 100755 --- a/bin/groovy-petstore.sh +++ b/bin/groovy-petstore.sh @@ -27,5 +27,5 @@ fi # if you've executed sbt assembly previously it will use that instead. export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties" -ags="generate -t modules/openapi-generator/src/main/resources/Groovy/ -i modules/openapi-generator/src/test/resources/2_0/petstore.yaml -g groovy -o samples/client/petstore/groovy -DhideGenerationTimestamp=true $@" +ags="generate -t modules/openapi-generator/src/main/resources/Groovy/ -i modules/openapi-generator/src/test/resources/2_0/petstore.yaml -g groovy -o samples/client/petstore/groovy --additional-properties hideGenerationTimestamp=true $@" java $JAVA_OPTS -jar $executable $ags diff --git a/bin/java-inflector-petstore-server.sh b/bin/java-inflector-petstore-server.sh index 1456a7457fd3..b37e444a9235 100755 --- a/bin/java-inflector-petstore-server.sh +++ b/bin/java-inflector-petstore-server.sh @@ -27,6 +27,6 @@ fi # if you've executed sbt assembly previously it will use that instead. export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties" -ags="generate -t modules/openapi-generator/src/main/resources/JavaInflector -i modules/openapi-generator/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml -g java-inflector -o samples/server/petstore/java-inflector -DhideGenerationTimestamp=true $@" +ags="generate -t modules/openapi-generator/src/main/resources/JavaInflector -i modules/openapi-generator/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml -g java-inflector -o samples/server/petstore/java-inflector --additional-properties hideGenerationTimestamp=true $@" java $JAVA_OPTS -jar $executable $ags diff --git a/bin/java-msf4j-petstore-server.sh b/bin/java-msf4j-petstore-server.sh index 8df820296c26..46ae1caef9a8 100755 --- a/bin/java-msf4j-petstore-server.sh +++ b/bin/java-msf4j-petstore-server.sh @@ -27,7 +27,7 @@ fi # if you've executed sbt assembly previously it will use that instead. export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties" -ags="generate -t modules/openapi-generator/src/main/resources/java-msf4j-server -i modules/openapi-generator/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml -g java-msf4j -o samples/server/petstore/java-msf4j/ -DhideGenerationTimestamp=true --additional-properties artifactId=java-msf4j-server $@" +ags="generate -t modules/openapi-generator/src/main/resources/java-msf4j-server -i modules/openapi-generator/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml -g java-msf4j -o samples/server/petstore/java-msf4j/ --additional-properties hideGenerationTimestamp=true --additional-properties artifactId=java-msf4j-server $@" echo "Removing files and folders under samples/server/petstore/java-msf4j/src/main" rm -rf samples/server/petstore/java-msf4j/src/main diff --git a/bin/java-petstore-feign-10x.sh b/bin/java-petstore-feign-10x.sh index 3ee6bd937e1e..15b1b40e2149 100755 --- a/bin/java-petstore-feign-10x.sh +++ b/bin/java-petstore-feign-10x.sh @@ -27,7 +27,7 @@ fi # if you've executed sbt assembly previously it will use that instead. export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties" -ags="generate -t modules/openapi-generator/src/main/resources/Java/libraries/feign -i modules/openapi-generator/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml -g java -c bin/java-petstore-feign-10x.json -o samples/client/petstore/java/feign10x -DhideGenerationTimestamp=true -DbooleanGetterPrefix=is $@" +ags="generate -t modules/openapi-generator/src/main/resources/Java/libraries/feign -i modules/openapi-generator/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml -g java -c bin/java-petstore-feign-10x.json -o samples/client/petstore/java/feign10x --additional-properties hideGenerationTimestamp=true,booleanGetterPrefix=is $@" echo "Removing files and folders under samples/client/petstore/java/feign10x/src/main" rm -rf samples/client/petstore/java/feign10x/src/main diff --git a/bin/java-petstore-feign.sh b/bin/java-petstore-feign.sh index f6ead964ace2..abac67deb9d2 100755 --- a/bin/java-petstore-feign.sh +++ b/bin/java-petstore-feign.sh @@ -27,7 +27,7 @@ fi # if you've executed sbt assembly previously it will use that instead. export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties" -ags="generate -t modules/openapi-generator/src/main/resources/Java/libraries/feign -i modules/openapi-generator/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml -g java -c bin/java-petstore-feign-9x.json -o samples/client/petstore/java/feign -DhideGenerationTimestamp=true -DbooleanGetterPrefix=is $@" +ags="generate -t modules/openapi-generator/src/main/resources/Java/libraries/feign -i modules/openapi-generator/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml -g java -c bin/java-petstore-feign-9x.json -o samples/client/petstore/java/feign --additional-properties hideGenerationTimestamp=true,booleanGetterPrefix=is $@" echo "Removing files and folders under samples/client/petstore/java/feign/src/main" rm -rf samples/client/petstore/java/feign/src/main diff --git a/bin/java-petstore-google-api-client.sh b/bin/java-petstore-google-api-client.sh index ace4eb43870e..20e3577f1974 100755 --- a/bin/java-petstore-google-api-client.sh +++ b/bin/java-petstore-google-api-client.sh @@ -27,7 +27,7 @@ fi # if you've executed sbt assembly previously it will use that instead. export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties" -ags="generate -t modules/openapi-generator/src/main/resources/Java/libraries/google-api-client -i modules/openapi-generator/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml -g java -c bin/java-petstore-google-api-client.json -o samples/client/petstore/java/google-api-client -DhideGenerationTimestamp=true $@" +ags="generate -t modules/openapi-generator/src/main/resources/Java/libraries/google-api-client -i modules/openapi-generator/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml -g java -c bin/java-petstore-google-api-client.json -o samples/client/petstore/java/google-api-client --additional-properties hideGenerationTimestamp=true $@" echo "Removing files and folders under samples/client/petstore/java/google-api-client/src/main" rm -rf samples/client/petstore/java/google-api-client/src/main diff --git a/bin/java-petstore-jersey1.sh b/bin/java-petstore-jersey1.sh index 2a6e6ab8f711..cb6e0ea3a6b1 100755 --- a/bin/java-petstore-jersey1.sh +++ b/bin/java-petstore-jersey1.sh @@ -27,7 +27,7 @@ fi # if you've executed sbt assembly previously it will use that instead. export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties" -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 -DhideGenerationTimestamp=true --library=jersey1 --additional-properties useNullForUnknownEnumValue=true $@" +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 $@" echo "Removing files and folders under samples/client/petstore/java/jersey1/src/main" rm -rf samples/client/petstore/java/jersey1/src/main diff --git a/bin/java-petstore-jersey2-java6.sh b/bin/java-petstore-jersey2-java6.sh index b0d32f84db6e..4a5b032d0db7 100755 --- a/bin/java-petstore-jersey2-java6.sh +++ b/bin/java-petstore-jersey2-java6.sh @@ -27,7 +27,7 @@ fi # if you've executed sbt assembly previously it will use that instead. export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties" -ags="generate --artifact-id petstore-jersey2-java6 -i modules/openapi-generator/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml -g java -c bin/java-petstore-jersey2.json -o samples/client/petstore/java/jersey2-java6 -DhideGenerationTimestamp=true,supportJava6=true,booleanGetterPrefix=is $@" +ags="generate --artifact-id petstore-jersey2-java6 -i modules/openapi-generator/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml -g java -c bin/java-petstore-jersey2.json -o samples/client/petstore/java/jersey2-java6 --additional-properties hideGenerationTimestamp=true,supportJava6=true,booleanGetterPrefix=is $@" echo "Removing files and folders under samples/client/petstore/java/jersey2-java6/src/main" rm -rf samples/client/petstore/java/jersey2-java6/src/main diff --git a/bin/java-petstore-jersey2.sh b/bin/java-petstore-jersey2.sh index 05fc95fbc9e4..e91dba6ff00d 100755 --- a/bin/java-petstore-jersey2.sh +++ b/bin/java-petstore-jersey2.sh @@ -27,7 +27,7 @@ fi # if you've executed sbt assembly previously it will use that instead. export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties" -ags="generate -i modules/openapi-generator/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml -g java -c bin/java-petstore-jersey2.json -o samples/client/petstore/java/jersey2 -DhideGenerationTimestamp=true $@" +ags="generate -i modules/openapi-generator/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml -g java -c bin/java-petstore-jersey2.json -o samples/client/petstore/java/jersey2 --additional-properties hideGenerationTimestamp=true $@" echo "Removing files and folders under samples/client/petstore/java/jersey2/src/main" rm -rf samples/client/petstore/java/jersey2/src/main diff --git a/bin/java-petstore-okhttp-gson-parcelable.sh b/bin/java-petstore-okhttp-gson-parcelable.sh index 183aa87693ab..ae4fbfd8d2b1 100755 --- a/bin/java-petstore-okhttp-gson-parcelable.sh +++ b/bin/java-petstore-okhttp-gson-parcelable.sh @@ -27,7 +27,7 @@ fi # if you've executed sbt assembly previously it will use that instead. export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties" -ags="generate --artifact-id petstore-okhttp-gson-parcelableModel -t modules/openapi-generator/src/main/resources/Java/libraries/okhttp-gson -i modules/openapi-generator/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml -g java -c bin/java-petstore-okhttp-gson.json -o samples/client/petstore/java/okhttp-gson-parcelableModel -DhideGenerationTimestamp=true,parcelableModel=true $@" +ags="generate --artifact-id petstore-okhttp-gson-parcelableModel -t modules/openapi-generator/src/main/resources/Java/libraries/okhttp-gson -i modules/openapi-generator/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml -g java -c bin/java-petstore-okhttp-gson.json -o samples/client/petstore/java/okhttp-gson-parcelableModel --additional-properties hideGenerationTimestamp=true,parcelableModel=true $@" rm -rf samples/client/petstore/java/okhttp-gson-parcelableModel/src/main find samples/client/petstore/java/okhttp-gson-parcelableModel -maxdepth 1 -type f ! -name "README.md" -exec rm {} + diff --git a/bin/java-petstore-okhttp-gson.sh b/bin/java-petstore-okhttp-gson.sh index 3d7887661229..8e7e7ac84e43 100755 --- a/bin/java-petstore-okhttp-gson.sh +++ b/bin/java-petstore-okhttp-gson.sh @@ -27,7 +27,7 @@ fi # if you've executed sbt assembly previously it will use that instead. export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties" -ags="generate -t modules/openapi-generator/src/main/resources/Java/libraries/okhttp-gson -i modules/openapi-generator/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml -g java -c bin/java-petstore-okhttp-gson.json -o samples/client/petstore/java/okhttp-gson -DhideGenerationTimestamp=true $@" +ags="generate -t modules/openapi-generator/src/main/resources/Java/libraries/okhttp-gson -i modules/openapi-generator/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml -g java -c bin/java-petstore-okhttp-gson.json -o samples/client/petstore/java/okhttp-gson --additional-properties hideGenerationTimestamp=true $@" rm -rf samples/client/petstore/java/okhttp-gson/src/main find samples/client/petstore/java/okhttp-gson -maxdepth 1 -type f ! -name "README.md" -exec rm {} + diff --git a/bin/java-petstore-rest-assured.sh b/bin/java-petstore-rest-assured.sh index 012f2dced087..cacc3cf3c279 100755 --- a/bin/java-petstore-rest-assured.sh +++ b/bin/java-petstore-rest-assured.sh @@ -27,7 +27,7 @@ fi # if you've executed sbt assembly previously it will use that instead. export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties" -ags="generate -t modules/openapi-generator/src/main/resources/Java/libraries/rest-assured -i modules/openapi-generator/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml -g java -c bin/java-petstore-rest-assured.json -o samples/client/petstore/java/rest-assured -DhideGenerationTimestamp=true --additional-properties booleanGetterPrefix=is $@" +ags="generate -t modules/openapi-generator/src/main/resources/Java/libraries/rest-assured -i modules/openapi-generator/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml -g java -c bin/java-petstore-rest-assured.json -o samples/client/petstore/java/rest-assured --additional-properties hideGenerationTimestamp=true --additional-properties booleanGetterPrefix=is $@" echo "Removing files and folders under samples/client/petstore/java/rest-assured/src/main" rm -rf samples/client/petstore/java/rest-assured/src/main diff --git a/bin/java-petstore-resteasy.sh b/bin/java-petstore-resteasy.sh index c0a0b0c188c5..ae6113741313 100755 --- a/bin/java-petstore-resteasy.sh +++ b/bin/java-petstore-resteasy.sh @@ -27,7 +27,7 @@ fi # if you've executed sbt assembly previously it will use that instead. export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties" -ags="generate -i modules/openapi-generator/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml -g java -c bin/java-petstore-resteasy.json -o samples/client/petstore/java/resteasy -DhideGenerationTimestamp=true $@" +ags="generate -i modules/openapi-generator/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml -g java -c bin/java-petstore-resteasy.json -o samples/client/petstore/java/resteasy --additional-properties hideGenerationTimestamp=true $@" echo "Removing files and folders under samples/client/petstore/java/resteasy/src/main" rm -rf samples/client/petstore/java/resteasy/src/main diff --git a/bin/java-petstore-resttemplate-withxml.sh b/bin/java-petstore-resttemplate-withxml.sh index fe44afde84d8..19c142a2d4f9 100755 --- a/bin/java-petstore-resttemplate-withxml.sh +++ b/bin/java-petstore-resttemplate-withxml.sh @@ -27,7 +27,7 @@ fi # if you've executed sbt assembly previously it will use that instead. export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties" -ags="generate -i modules/openapi-generator/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml --artifact-id petstore-resttemplate-withxml -g java -c bin/java-petstore-resttemplate.json -o samples/client/petstore/java/resttemplate-withXml -DhideGenerationTimestamp=true,withXml=true $@" +ags="generate -i modules/openapi-generator/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml --artifact-id petstore-resttemplate-withxml -g java -c bin/java-petstore-resttemplate.json -o samples/client/petstore/java/resttemplate-withXml --additional-properties hideGenerationTimestamp=true,withXml=true $@" echo "Removing files and folders under samples/client/petstore/java/resttemplate/src/main" rm -rf samples/client/petstore/java/resttemplate-withXml/src/main diff --git a/bin/java-petstore-resttemplate.sh b/bin/java-petstore-resttemplate.sh index e1cf8ac27bcd..d37d40059ffe 100755 --- a/bin/java-petstore-resttemplate.sh +++ b/bin/java-petstore-resttemplate.sh @@ -27,7 +27,7 @@ fi # if you've executed sbt assembly previously it will use that instead. export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties" -ags="generate -i modules/openapi-generator/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml -g java -c bin/java-petstore-resttemplate.json -o samples/client/petstore/java/resttemplate -DhideGenerationTimestamp=true $@" +ags="generate -i modules/openapi-generator/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml -g java -c bin/java-petstore-resttemplate.json -o samples/client/petstore/java/resttemplate --additional-properties hideGenerationTimestamp=true $@" echo "Removing files and folders under samples/client/petstore/java/resttemplate/src/main" rm -rf samples/client/petstore/java/resttemplate/src/main diff --git a/bin/java-petstore-retrofit.sh b/bin/java-petstore-retrofit.sh index e368e1b1b3ac..127f16b44eb0 100755 --- a/bin/java-petstore-retrofit.sh +++ b/bin/java-petstore-retrofit.sh @@ -27,7 +27,7 @@ fi # if you've executed sbt assembly previously it will use that instead. export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties" -ags="generate -i modules/openapi-generator/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml -g java -c bin/java-petstore-retrofit.json -o samples/client/petstore/java/retrofit -DhideGenerationTimestamp=true,dateLibrary=joda $@" +ags="generate -i modules/openapi-generator/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml -g java -c bin/java-petstore-retrofit.json -o samples/client/petstore/java/retrofit --additional-properties hideGenerationTimestamp=true,dateLibrary=joda $@" echo "Removing files and folders under samples/client/petstore/java/retrofit/src/main" rm -rf samples/client/petstore/java/retrofit/src/main diff --git a/bin/java-petstore-retrofit2-play24.sh b/bin/java-petstore-retrofit2-play24.sh index fa37a6f0d4ba..4b94855865e8 100755 --- a/bin/java-petstore-retrofit2-play24.sh +++ b/bin/java-petstore-retrofit2-play24.sh @@ -27,7 +27,7 @@ fi # if you've executed sbt assembly previously it will use that instead. export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties" -ags="generate --artifact-id petstore-java-client-retrofit2-play24 -i modules/openapi-generator/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml -g java -c bin/java-petstore-retrofit2-play24.json -o samples/client/petstore/java/retrofit2-play24 -DhideGenerationTimestamp=true $@" +ags="generate --artifact-id petstore-java-client-retrofit2-play24 -i modules/openapi-generator/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml -g java -c bin/java-petstore-retrofit2-play24.json -o samples/client/petstore/java/retrofit2-play24 --additional-properties hideGenerationTimestamp=true $@" echo "Removing files and folders under samples/client/petstore/java/retrofit2-play24/src/main" rm -rf samples/client/petstore/java/retrofit2-play24/src/main diff --git a/bin/java-petstore-retrofit2-play25.sh b/bin/java-petstore-retrofit2-play25.sh index f06506493f64..1954c2e045ee 100755 --- a/bin/java-petstore-retrofit2-play25.sh +++ b/bin/java-petstore-retrofit2-play25.sh @@ -27,7 +27,7 @@ fi # if you've executed sbt assembly previously it will use that instead. export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties" -ags="generate --artifact-id petstore-java-client-retrofit2-play25 -i modules/openapi-generator/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml -g java -c bin/java-petstore-retrofit2-play25.json -o samples/client/petstore/java/retrofit2-play25 -DhideGenerationTimestamp=true $@" +ags="generate --artifact-id petstore-java-client-retrofit2-play25 -i modules/openapi-generator/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml -g java -c bin/java-petstore-retrofit2-play25.json -o samples/client/petstore/java/retrofit2-play25 --additional-properties hideGenerationTimestamp=true $@" echo "Removing files and folders under samples/client/petstore/java/retrofit2-play25/src/main" rm -rf samples/client/petstore/java/retrofit2-play25/src/main diff --git a/bin/java-petstore-retrofit2-play26.sh b/bin/java-petstore-retrofit2-play26.sh index edec7c1d2149..0c582d09af19 100755 --- a/bin/java-petstore-retrofit2-play26.sh +++ b/bin/java-petstore-retrofit2-play26.sh @@ -27,7 +27,7 @@ fi # if you've executed sbt assembly previously it will use that instead. export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties" -ags="generate --artifact-id petstore-java-client-retrofit2-play26 -i modules/openapi-generator/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml -g java -c bin/java-petstore-retrofit2-play26.json -o samples/client/petstore/java/retrofit2-play26 -DhideGenerationTimestamp=true $@" +ags="generate --artifact-id petstore-java-client-retrofit2-play26 -i modules/openapi-generator/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml -g java -c bin/java-petstore-retrofit2-play26.json -o samples/client/petstore/java/retrofit2-play26 --additional-properties hideGenerationTimestamp=true $@" echo "Removing files and folders under samples/client/petstore/java/retrofit2-play26/src/main" rm -rf samples/client/petstore/java/retrofit2-play26/src/main diff --git a/bin/java-petstore-retrofit2.sh b/bin/java-petstore-retrofit2.sh index 18251325cfee..2dce65f27248 100755 --- a/bin/java-petstore-retrofit2.sh +++ b/bin/java-petstore-retrofit2.sh @@ -27,7 +27,7 @@ fi # if you've executed sbt assembly previously it will use that instead. export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties" -ags="generate -t modules/openapi-generator/src/main/resources/Java/libraries/retrofit2 -i modules/openapi-generator/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml -g java -c bin/java-petstore-retrofit2.json -o samples/client/petstore/java/retrofit2 -DhideGenerationTimestamp=true $@" +ags="generate -t modules/openapi-generator/src/main/resources/Java/libraries/retrofit2 -i modules/openapi-generator/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml -g java -c bin/java-petstore-retrofit2.json -o samples/client/petstore/java/retrofit2 --additional-properties hideGenerationTimestamp=true $@" echo "Removing files and folders under samples/client/petstore/java/retrofit2/src/main" rm -rf samples/client/petstore/java/retrofit2/src/main diff --git a/bin/java-petstore-retrofit2rx.sh b/bin/java-petstore-retrofit2rx.sh index fd29f093902e..74729919db17 100755 --- a/bin/java-petstore-retrofit2rx.sh +++ b/bin/java-petstore-retrofit2rx.sh @@ -27,7 +27,7 @@ fi # if you've executed sbt assembly previously it will use that instead. export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties" -ags="generate -t modules/openapi-generator/src/main/resources/Java/libraries/retrofit2 -i modules/openapi-generator/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml -g java -c bin/java-petstore-retrofit2rx.json -o samples/client/petstore/java/retrofit2rx -DuseRxJava=true,hideGenerationTimestamp=true $@" +ags="generate -t modules/openapi-generator/src/main/resources/Java/libraries/retrofit2 -i modules/openapi-generator/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml -g java -c bin/java-petstore-retrofit2rx.json -o samples/client/petstore/java/retrofit2rx --additional-properties useRxJava=true,hideGenerationTimestamp=true $@" echo "Removing files and folders under samples/client/petstore/java/retrofit2rx/src/main" rm -rf samples/client/petstore/java/retrofit2rx/src/main diff --git a/bin/java-petstore-retrofit2rx2.sh b/bin/java-petstore-retrofit2rx2.sh index 33c35a9a6d38..05d6acb7bd0c 100755 --- a/bin/java-petstore-retrofit2rx2.sh +++ b/bin/java-petstore-retrofit2rx2.sh @@ -27,7 +27,7 @@ fi # if you've executed sbt assembly previously it will use that instead. export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties" -ags="generate -t modules/openapi-generator/src/main/resources/Java/libraries/retrofit2 -i modules/openapi-generator/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml -g java -c bin/java-petstore-retrofit2rx2.json -o samples/client/petstore/java/retrofit2rx2 -DuseRxJava2=true,hideGenerationTimestamp=true $@" +ags="generate -t modules/openapi-generator/src/main/resources/Java/libraries/retrofit2 -i modules/openapi-generator/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml -g java -c bin/java-petstore-retrofit2rx2.json -o samples/client/petstore/java/retrofit2rx2 --additional-properties useRxJava2=true,hideGenerationTimestamp=true $@" echo "Removing files and folders under samples/client/petstore/java/retrofit2rx2/src/main" rm -rf samples/client/petstore/java/retrofit2rx2/src/main diff --git a/bin/java-petstore-vertx.sh b/bin/java-petstore-vertx.sh index badb9eff0f60..8eeb623b2785 100755 --- a/bin/java-petstore-vertx.sh +++ b/bin/java-petstore-vertx.sh @@ -27,7 +27,7 @@ fi # if you've executed sbt assembly previously it will use that instead. export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties" -ags="generate -t modules/openapi-generator/src/main/resources/Java/libraries/vertx -i modules/openapi-generator/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml -g java -c bin/java-petstore-vertx.json -o samples/client/petstore/java/vertx -DhideGenerationTimestamp=true $@" +ags="generate -t modules/openapi-generator/src/main/resources/Java/libraries/vertx -i modules/openapi-generator/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml -g java -c bin/java-petstore-vertx.json -o samples/client/petstore/java/vertx --additional-properties hideGenerationTimestamp=true $@" echo "Removing files and folders under samples/client/petstore/java/vertx/src/main" rm -rf samples/client/petstore/java/vertx/src/main diff --git a/bin/java-petstore-webclient.sh b/bin/java-petstore-webclient.sh index 7c7370601927..c9402c60c0aa 100755 --- a/bin/java-petstore-webclient.sh +++ b/bin/java-petstore-webclient.sh @@ -27,7 +27,7 @@ fi # if you've executed sbt assembly previously it will use that instead. export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties" -ags="generate -i modules/openapi-generator/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml -g java -c bin/java-petstore-webclient.json -o samples/client/petstore/java/webclient -DhideGenerationTimestamp=true $@" +ags="generate -i modules/openapi-generator/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml -g java -c bin/java-petstore-webclient.json -o samples/client/petstore/java/webclient --additional-properties hideGenerationTimestamp=true $@" echo "Removing files and folders under samples/client/petstore/java/webclient/src/main" rm -rf samples/client/petstore/java/webclient/src/main diff --git a/bin/java-pkmst-petstore-server.sh b/bin/java-pkmst-petstore-server.sh index 9d98201b6887..25d1c953197a 100755 --- a/bin/java-pkmst-petstore-server.sh +++ b/bin/java-pkmst-petstore-server.sh @@ -27,7 +27,7 @@ fi # if you've executed sbt assembly previously it will use that instead. export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties" -ags="generate -t modules/openapi-generator/src/main/resources/java-pkmst -i modules/openapi-generator/src/test/resources/2_0/petstore.yaml -g java-pkmst -o samples/server/petstore/java-pkmst/ -DhideGenerationTimestamp=true $@" +ags="generate -t modules/openapi-generator/src/main/resources/java-pkmst -i modules/openapi-generator/src/test/resources/2_0/petstore.yaml -g java-pkmst -o samples/server/petstore/java-pkmst/ --additional-properties hideGenerationTimestamp=true $@" echo "Removing files and folders under samples/server/petstore/java-pkmst/src/main" rm -rf samples/server/petstore/java-pkmst/src/main diff --git a/bin/java-play-framework-petstore-server-api-package-override.sh b/bin/java-play-framework-petstore-server-api-package-override.sh index d5069d98257a..cba7507689e0 100755 --- a/bin/java-play-framework-petstore-server-api-package-override.sh +++ b/bin/java-play-framework-petstore-server-api-package-override.sh @@ -27,7 +27,7 @@ fi # if you've executed sbt assembly previously it will use that instead. export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties" -ags="generate -t modules/openapi-generator/src/main/resources/JavaPlayFramework -i modules/openapi-generator/src/test/resources/2_0/petstore.yaml -g java-play-framework -o samples/server/petstore/java-play-framework-api-package-override -DhideGenerationTimestamp=true,apiPackage=com.puppies.store.apis $@" +ags="generate -t modules/openapi-generator/src/main/resources/JavaPlayFramework -i modules/openapi-generator/src/test/resources/2_0/petstore.yaml -g java-play-framework -o samples/server/petstore/java-play-framework-api-package-override --additional-properties hideGenerationTimestamp=true,apiPackage=com.puppies.store.apis $@" java $JAVA_OPTS -jar $executable $ags diff --git a/bin/java-play-framework-petstore-server-async.sh b/bin/java-play-framework-petstore-server-async.sh index 86d5baf77f49..c09f9772fa3c 100755 --- a/bin/java-play-framework-petstore-server-async.sh +++ b/bin/java-play-framework-petstore-server-async.sh @@ -27,6 +27,6 @@ fi # if you've executed sbt assembly previously it will use that instead. export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties" -ags="generate -t modules/openapi-generator/src/main/resources/JavaPlayFramework -i modules/openapi-generator/src/test/resources/2_0/petstore.yaml -g java-play-framework -c bin/java-play-framework-petstore-server-async.json -o samples/server/petstore/java-play-framework-async -DhideGenerationTimestamp=true $@" +ags="generate -t modules/openapi-generator/src/main/resources/JavaPlayFramework -i modules/openapi-generator/src/test/resources/2_0/petstore.yaml -g java-play-framework -c bin/java-play-framework-petstore-server-async.json -o samples/server/petstore/java-play-framework-async --additional-properties hideGenerationTimestamp=true $@" java $JAVA_OPTS -jar $executable $ags diff --git a/bin/java-play-framework-petstore-server-controller-only.sh b/bin/java-play-framework-petstore-server-controller-only.sh index 94bf0b72777e..85a232612216 100755 --- a/bin/java-play-framework-petstore-server-controller-only.sh +++ b/bin/java-play-framework-petstore-server-controller-only.sh @@ -27,7 +27,7 @@ fi # if you've executed sbt assembly previously it will use that instead. export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties" -ags="generate -t modules/openapi-generator/src/main/resources/JavaPlayFramework -i modules/openapi-generator/src/test/resources/2_0/petstore.yaml -g java-play-framework -o samples/server/petstore/java-play-framework-controller-only -DhideGenerationTimestamp=true,controllerOnly=true $@" +ags="generate -t modules/openapi-generator/src/main/resources/JavaPlayFramework -i modules/openapi-generator/src/test/resources/2_0/petstore.yaml -g java-play-framework -o samples/server/petstore/java-play-framework-controller-only --additional-properties hideGenerationTimestamp=true,controllerOnly=true $@" java $JAVA_OPTS -jar $executable $ags diff --git a/bin/java-play-framework-petstore-server-fake-endpoints.sh b/bin/java-play-framework-petstore-server-fake-endpoints.sh index d9c45fca07a8..0ae05412047e 100755 --- a/bin/java-play-framework-petstore-server-fake-endpoints.sh +++ b/bin/java-play-framework-petstore-server-fake-endpoints.sh @@ -27,7 +27,7 @@ fi # if you've executed sbt assembly previously it will use that instead. export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties" -ags="generate -t modules/openapi-generator/src/main/resources/JavaPlayFramework -i modules/openapi-generator/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml -g java-play-framework -o samples/server/petstore/java-play-framework-fake-endpoints -DhideGenerationTimestamp=true $@" +ags="generate -t modules/openapi-generator/src/main/resources/JavaPlayFramework -i modules/openapi-generator/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml -g java-play-framework -o samples/server/petstore/java-play-framework-fake-endpoints --additional-properties hideGenerationTimestamp=true $@" java $JAVA_OPTS -jar $executable $ags diff --git a/bin/java-play-framework-petstore-server-no-bean-validation.sh b/bin/java-play-framework-petstore-server-no-bean-validation.sh index b824bc82fbd2..92b924b73d03 100755 --- a/bin/java-play-framework-petstore-server-no-bean-validation.sh +++ b/bin/java-play-framework-petstore-server-no-bean-validation.sh @@ -27,7 +27,7 @@ fi # if you've executed sbt assembly previously it will use that instead. export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties" -ags="generate -t modules/openapi-generator/src/main/resources/JavaPlayFramework -i modules/openapi-generator/src/test/resources/2_0/petstore.yaml -g java-play-framework -o samples/server/petstore/java-play-framework-no-bean-validation -DhideGenerationTimestamp=true,useBeanValidation=false $@" +ags="generate -t modules/openapi-generator/src/main/resources/JavaPlayFramework -i modules/openapi-generator/src/test/resources/2_0/petstore.yaml -g java-play-framework -o samples/server/petstore/java-play-framework-no-bean-validation --additional-properties hideGenerationTimestamp=true,useBeanValidation=false $@" java $JAVA_OPTS -jar $executable $ags diff --git a/bin/java-play-framework-petstore-server-no-exception-handling.sh b/bin/java-play-framework-petstore-server-no-exception-handling.sh index c798713aacc1..b9fe281c4c1a 100755 --- a/bin/java-play-framework-petstore-server-no-exception-handling.sh +++ b/bin/java-play-framework-petstore-server-no-exception-handling.sh @@ -27,7 +27,7 @@ fi # if you've executed sbt assembly previously it will use that instead. export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties" -ags="generate -t modules/openapi-generator/src/main/resources/JavaPlayFramework -i modules/openapi-generator/src/test/resources/2_0/petstore.yaml -g java-play-framework -o samples/server/petstore/java-play-framework-no-exception-handling -DhideGenerationTimestamp=true,handleExceptions=false $@" +ags="generate -t modules/openapi-generator/src/main/resources/JavaPlayFramework -i modules/openapi-generator/src/test/resources/2_0/petstore.yaml -g java-play-framework -o samples/server/petstore/java-play-framework-no-exception-handling --additional-properties hideGenerationTimestamp=true,handleExceptions=false $@" java $JAVA_OPTS -jar $executable $ags diff --git a/bin/java-play-framework-petstore-server-no-interface.sh b/bin/java-play-framework-petstore-server-no-interface.sh index 42fb56f7a1c3..dbc4b8734ab7 100755 --- a/bin/java-play-framework-petstore-server-no-interface.sh +++ b/bin/java-play-framework-petstore-server-no-interface.sh @@ -27,7 +27,7 @@ fi # if you've executed sbt assembly previously it will use that instead. export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties" -ags="generate -t modules/openapi-generator/src/main/resources/JavaPlayFramework -i modules/openapi-generator/src/test/resources/2_0/petstore.yaml -g java-play-framework -o samples/server/petstore/java-play-framework-no-interface -DhideGenerationTimestamp=true,useInterfaces=false $@" +ags="generate -t modules/openapi-generator/src/main/resources/JavaPlayFramework -i modules/openapi-generator/src/test/resources/2_0/petstore.yaml -g java-play-framework -o samples/server/petstore/java-play-framework-no-interface --additional-properties hideGenerationTimestamp=true,useInterfaces=false $@" java $JAVA_OPTS -jar $executable $ags diff --git a/bin/java-play-framework-petstore-server-no-swagger-ui.sh b/bin/java-play-framework-petstore-server-no-swagger-ui.sh index 09e3936bbbb9..494a0253161b 100755 --- a/bin/java-play-framework-petstore-server-no-swagger-ui.sh +++ b/bin/java-play-framework-petstore-server-no-swagger-ui.sh @@ -27,7 +27,7 @@ fi # if you've executed sbt assembly previously it will use that instead. export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties" -ags="generate -t modules/openapi-generator/src/main/resources/JavaPlayFramework -i modules/openapi-generator/src/test/resources/2_0/petstore.yaml -g java-play-framework -o samples/server/petstore/java-play-framework-no-swagger-ui -DhideGenerationTimestamp=true,useSwaggerUI=false $@" +ags="generate -t modules/openapi-generator/src/main/resources/JavaPlayFramework -i modules/openapi-generator/src/test/resources/2_0/petstore.yaml -g java-play-framework -o samples/server/petstore/java-play-framework-no-swagger-ui --additional-properties hideGenerationTimestamp=true,useSwaggerUI=false $@" java $JAVA_OPTS -jar $executable $ags diff --git a/bin/java-play-framework-petstore-server-no-wrap-calls.sh b/bin/java-play-framework-petstore-server-no-wrap-calls.sh index 215dcf48ea13..7de56cc566e1 100755 --- a/bin/java-play-framework-petstore-server-no-wrap-calls.sh +++ b/bin/java-play-framework-petstore-server-no-wrap-calls.sh @@ -27,7 +27,7 @@ fi # if you've executed sbt assembly previously it will use that instead. export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties" -ags="generate -t modules/openapi-generator/src/main/resources/JavaPlayFramework -i modules/openapi-generator/src/test/resources/2_0/petstore.yaml -g java-play-framework -o samples/server/petstore/java-play-framework-no-wrap-calls -DhideGenerationTimestamp=true,wrapCalls=false $@" +ags="generate -t modules/openapi-generator/src/main/resources/JavaPlayFramework -i modules/openapi-generator/src/test/resources/2_0/petstore.yaml -g java-play-framework -o samples/server/petstore/java-play-framework-no-wrap-calls --additional-properties hideGenerationTimestamp=true,wrapCalls=false $@" java $JAVA_OPTS -jar $executable $ags diff --git a/bin/java-play-framework-petstore-server.sh b/bin/java-play-framework-petstore-server.sh index cb26c3c08363..b187c2e47b9b 100755 --- a/bin/java-play-framework-petstore-server.sh +++ b/bin/java-play-framework-petstore-server.sh @@ -27,7 +27,7 @@ fi # if you've executed sbt assembly previously it will use that instead. export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties" -ags="generate -t modules/openapi-generator/src/main/resources/JavaPlayFramework -i modules/openapi-generator/src/test/resources/2_0/petstore.yaml -g java-play-framework -o samples/server/petstore/java-play-framework -DhideGenerationTimestamp=true $@" +ags="generate -t modules/openapi-generator/src/main/resources/JavaPlayFramework -i modules/openapi-generator/src/test/resources/2_0/petstore.yaml -g java-play-framework -o samples/server/petstore/java-play-framework --additional-properties hideGenerationTimestamp=true $@" java $JAVA_OPTS -jar $executable $ags diff --git a/bin/java-vertx-async-petstore-server.sh b/bin/java-vertx-async-petstore-server.sh index bdedff112700..519dd79c2b31 100755 --- a/bin/java-vertx-async-petstore-server.sh +++ b/bin/java-vertx-async-petstore-server.sh @@ -27,6 +27,6 @@ fi # if you've executed sbt assembly previously it will use that instead. export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties" -ags="generate -i modules/openapi-generator/src/test/resources/2_0/petstore.yaml -g java-vertx -o samples/server/petstore/java-vertx/async -DvertxSwaggerRouterVersion=1.4.0 -DhideGenerationTimestamp=true $@" +ags="generate -i modules/openapi-generator/src/test/resources/2_0/petstore.yaml -g java-vertx -o samples/server/petstore/java-vertx/async --additional-properties vertxSwaggerRouterVersion=1.4.0,hideGenerationTimestamp=true $@" java $JAVA_OPTS -jar $executable $ags diff --git a/bin/java-vertx-rx-petstore-server.sh b/bin/java-vertx-rx-petstore-server.sh index 051798c8d45a..651f03f777dd 100755 --- a/bin/java-vertx-rx-petstore-server.sh +++ b/bin/java-vertx-rx-petstore-server.sh @@ -27,6 +27,6 @@ fi # if you've executed sbt assembly previously it will use that instead. export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties" -ags="generate -i modules/openapi-generator/src/test/resources/2_0/petstore.yaml -g java-vertx --artifact-id java-vertx-rx-server -o samples/server/petstore/java-vertx/rx -DvertxSwaggerRouterVersion=1.4.0,rxInterface=true -DhideGenerationTimestamp=true $@" +ags="generate -i modules/openapi-generator/src/test/resources/2_0/petstore.yaml -g java-vertx --artifact-id java-vertx-rx-server -o samples/server/petstore/java-vertx/rx --additional-properties vertxSwaggerRouterVersion=1.4.0,rxInterface=true --additional-properties hideGenerationTimestamp=true $@" java $JAVA_OPTS -jar $executable $ags diff --git a/bin/java8-petstore-jersey2.sh b/bin/java8-petstore-jersey2.sh index 739f75334e66..488fe202f296 100755 --- a/bin/java8-petstore-jersey2.sh +++ b/bin/java8-petstore-jersey2.sh @@ -27,7 +27,7 @@ fi # if you've executed sbt assembly previously it will use that instead. export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties" -ags="generate --artifact-id petstore-jersey2-java8 -i modules/openapi-generator/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml -g java -c bin/java8-petstore-jersey2.json -o samples/client/petstore/java/jersey2-java8 -DhideGenerationTimestamp=true --additional-properties serverPort=8082 $@" +ags="generate --artifact-id petstore-jersey2-java8 -i modules/openapi-generator/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml -g java -c bin/java8-petstore-jersey2.json -o samples/client/petstore/java/jersey2-java8 --additional-properties hideGenerationTimestamp=true --additional-properties serverPort=8082 $@" echo "Removing files and folders under samples/client/petstore/java/jersey2-java8/src/main" rm -rf samples/client/petstore/java/jersey2-java8/src/main diff --git a/bin/javascript-es6-petstore.sh b/bin/javascript-es6-petstore.sh index 8def380b258d..7c80155bb155 100755 --- a/bin/javascript-es6-petstore.sh +++ b/bin/javascript-es6-petstore.sh @@ -29,6 +29,7 @@ fi export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties" ags="generate -t modules/openapi-generator/src/main/resources/Javascript/es6 \ -i modules/openapi-generator/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml -g javascript \ +--additional-properties appName=PetstoreClient \ -o samples/client/petstore/javascript-es6 $@" -java -DappName=PetstoreClient $JAVA_OPTS -jar $executable $ags +java $JAVA_OPTS -jar $executable $ags diff --git a/bin/javascript-flowtyped-petstore.sh b/bin/javascript-flowtyped-petstore.sh index 92d883198213..061837a63843 100755 --- a/bin/javascript-flowtyped-petstore.sh +++ b/bin/javascript-flowtyped-petstore.sh @@ -27,6 +27,6 @@ fi # if you've executed sbt assembly previously it will use that instead. export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties" -ags="generate -t modules/openapi-generator/src/main/resources/Javascript-Flowtyped -i modules/openapi-generator/src/test/resources/2_0/petstore.yaml -g javascript-flowtyped -o samples/client/petstore/javascript-flowtyped -DappName=PetstoreClient $@" +ags="generate -t modules/openapi-generator/src/main/resources/Javascript-Flowtyped -i modules/openapi-generator/src/test/resources/2_0/petstore.yaml -g javascript-flowtyped -o samples/client/petstore/javascript-flowtyped --additional-properties appName=PetstoreClient $@" java $JAVA_OPTS -jar $executable $ags diff --git a/bin/javascript-petstore.sh b/bin/javascript-petstore.sh index 3b73aa4be6b6..f2313a0c198b 100755 --- a/bin/javascript-petstore.sh +++ b/bin/javascript-petstore.sh @@ -27,6 +27,6 @@ fi # if you've executed sbt assembly previously it will use that instead. export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties" -ags="generate -t modules/openapi-generator/src/main/resources/Javascript -i modules/openapi-generator/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml -g javascript -o samples/client/petstore/javascript -DappName=PetstoreClient --additional-properties useES6=false $@" +ags="generate -t modules/openapi-generator/src/main/resources/Javascript -i modules/openapi-generator/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml -g javascript -o samples/client/petstore/javascript --additional-properties appName=PetstoreClient,useES6=false $@" java $JAVA_OPTS -jar $executable $ags diff --git a/bin/javascript-promise-es6-petstore.sh b/bin/javascript-promise-es6-petstore.sh index 3dd0d7a4fcab..c953eb99dad3 100755 --- a/bin/javascript-promise-es6-petstore.sh +++ b/bin/javascript-promise-es6-petstore.sh @@ -30,6 +30,6 @@ export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties" ags="generate -t modules/openapi-generator/src/main/resources/Javascript/es6 \ -i modules/openapi-generator/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml -g javascript \ -o samples/client/petstore/javascript-promise-es6 \ ---additional-properties usePromises=true,useES6=true $@" +--additional-properties appName=PetstoreClient,usePromises=true,useES6=true $@" -java -DappName=PetstoreClient $JAVA_OPTS -jar $executable $ags +java $JAVA_OPTS -jar $executable $ags diff --git a/bin/javascript-promise-petstore.sh b/bin/javascript-promise-petstore.sh index f6eb25b5c43a..6702e60b2a39 100755 --- a/bin/javascript-promise-petstore.sh +++ b/bin/javascript-promise-petstore.sh @@ -33,6 +33,6 @@ ags="generate \ -g javascript \ -o samples/client/petstore/javascript-promise \ --additional-properties usePromises=true,useES6=false \ --DappName=PetstoreClient $@" +--additional-properties appName=PetstoreClient $@" java $JAVA_OPTS -jar $executable $ags diff --git a/bin/jaxrs-cxf-cdi-petstore-server.sh b/bin/jaxrs-cxf-cdi-petstore-server.sh index ee5d3d29a26e..3d1e538c3944 100755 --- a/bin/jaxrs-cxf-cdi-petstore-server.sh +++ b/bin/jaxrs-cxf-cdi-petstore-server.sh @@ -27,6 +27,6 @@ fi # if you've executed sbt assembly previously it will use that instead. export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties" -ags="generate -t modules/openapi-generator/src/main/resources/JavaJaxRS/cxf-cdi -i modules/openapi-generator/src/test/resources/2_0/petstore.yaml -g jaxrs-cxf-cdi -o samples/server/petstore/jaxrs-cxf-cdi -DhideGenerationTimestamp=true $@" +ags="generate -t modules/openapi-generator/src/main/resources/JavaJaxRS/cxf-cdi -i modules/openapi-generator/src/test/resources/2_0/petstore.yaml -g jaxrs-cxf-cdi -o samples/server/petstore/jaxrs-cxf-cdi --additional-properties hideGenerationTimestamp=true $@" java $JAVA_OPTS -jar $executable $ags diff --git a/bin/jaxrs-cxf-petstore-server-annotated-base-path.sh b/bin/jaxrs-cxf-petstore-server-annotated-base-path.sh index 8eac07795ebd..3c8b96a2e64c 100755 --- a/bin/jaxrs-cxf-petstore-server-annotated-base-path.sh +++ b/bin/jaxrs-cxf-petstore-server-annotated-base-path.sh @@ -27,6 +27,6 @@ fi # if you've executed sbt assembly previously it will use that instead. export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties" -ags="generate --artifact-id cxf-annotated-basepath -t modules/openapi-generator/src/main/resources/JavaJaxRS/cxf -i modules/openapi-generator/src/test/resources/2_0/petstore.yaml -g jaxrs-cxf -o samples/server/petstore/jaxrs-cxf-annotated-base-path -DhideGenerationTimestamp=true,useAnnotatedBasePath=true --additional-properties serverPort=8082 $@" +ags="generate --artifact-id cxf-annotated-basepath -t modules/openapi-generator/src/main/resources/JavaJaxRS/cxf -i modules/openapi-generator/src/test/resources/2_0/petstore.yaml -g jaxrs-cxf -o samples/server/petstore/jaxrs-cxf-annotated-base-path --additional-properties hideGenerationTimestamp=true,useAnnotatedBasePath=true --additional-properties serverPort=8082 $@" java $JAVA_OPTS -jar $executable $ags diff --git a/bin/jaxrs-cxf-petstore-server-non-spring-application.sh b/bin/jaxrs-cxf-petstore-server-non-spring-application.sh index 6ed2e5a05fe2..6db712b74bb8 100755 --- a/bin/jaxrs-cxf-petstore-server-non-spring-application.sh +++ b/bin/jaxrs-cxf-petstore-server-non-spring-application.sh @@ -27,6 +27,6 @@ fi # if you've executed sbt assembly previously it will use that instead. export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties" -ags="generate --artifact-id cxf-server-non-spring -t modules/openapi-generator/src/main/resources/JavaJaxRS/cxf -i modules/openapi-generator/src/test/resources/2_0/petstore.yaml -g jaxrs-cxf -o samples/server/petstore/jaxrs-cxf-non-spring-app -DhideGenerationTimestamp=true,generateNonSpringApplication=true --additional-properties serverPort=8082 $@" +ags="generate --artifact-id cxf-server-non-spring -t modules/openapi-generator/src/main/resources/JavaJaxRS/cxf -i modules/openapi-generator/src/test/resources/2_0/petstore.yaml -g jaxrs-cxf -o samples/server/petstore/jaxrs-cxf-non-spring-app --additional-properties hideGenerationTimestamp=true,generateNonSpringApplication=true --additional-properties serverPort=8082 $@" java $JAVA_OPTS -jar $executable $ags diff --git a/bin/jaxrs-cxf-petstore-server-test-data.sh b/bin/jaxrs-cxf-petstore-server-test-data.sh index 5b187c65fbfb..6844b7bcf847 100755 --- a/bin/jaxrs-cxf-petstore-server-test-data.sh +++ b/bin/jaxrs-cxf-petstore-server-test-data.sh @@ -27,6 +27,6 @@ fi # if you've executed sbt assembly previously it will use that instead. export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties" -ags="generate --artifact-id cxf-test-data -t modules/openapi-generator/src/main/resources/JavaJaxRS/cxf-ext -i modules/openapi-generator/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml -g jaxrs-cxf-extended -o samples/server/petstore/jaxrs-cxf-test-data -DhideGenerationTimestamp=true -DuseAnnotatedBasePath=true --generate-alias-as-model --additional-properties java8=true,generateSpringApplication=true,generateSpringBootApplication=true,generateOperationBody=true,loadTestDataFromFile=true $@" +ags="generate --artifact-id cxf-test-data -t modules/openapi-generator/src/main/resources/JavaJaxRS/cxf-ext -i modules/openapi-generator/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml -g jaxrs-cxf-extended -o samples/server/petstore/jaxrs-cxf-test-data --additional-properties hideGenerationTimestamp=true,useAnnotatedBasePath=true --generate-alias-as-model --additional-properties java8=true,generateSpringApplication=true,generateSpringBootApplication=true,generateOperationBody=true,loadTestDataFromFile=true $@" java $JAVA_OPTS -jar $executable $ags diff --git a/bin/jaxrs-cxf-petstore-server.sh b/bin/jaxrs-cxf-petstore-server.sh index 9efff273fa99..4081b01e8624 100755 --- a/bin/jaxrs-cxf-petstore-server.sh +++ b/bin/jaxrs-cxf-petstore-server.sh @@ -30,6 +30,6 @@ rm -rf samples/server/petstore/jaxrs-cxf # if you've executed sbt assembly previously it will use that instead. export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties" -ags="generate -t modules/openapi-generator/src/main/resources/JavaJaxRS/cxf -i modules/openapi-generator/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml -g jaxrs-cxf -o samples/server/petstore/jaxrs-cxf -DhideGenerationTimestamp=true --additional-properties serverPort=8082 $@" +ags="generate -t modules/openapi-generator/src/main/resources/JavaJaxRS/cxf -i modules/openapi-generator/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml -g jaxrs-cxf -o samples/server/petstore/jaxrs-cxf --additional-properties hideGenerationTimestamp=true --additional-properties serverPort=8082 $@" java $JAVA_OPTS -jar $executable $ags diff --git a/bin/jaxrs-jersey1-petstore-server.sh b/bin/jaxrs-jersey1-petstore-server.sh index 67576239847c..3cc7cc87615a 100755 --- a/bin/jaxrs-jersey1-petstore-server.sh +++ b/bin/jaxrs-jersey1-petstore-server.sh @@ -27,7 +27,7 @@ fi # if you've executed sbt assembly previously it will use that instead. export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties" -ags="generate -t modules/openapi-generator/src/main/resources/JavaJaxRS -i modules/openapi-generator/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml -g jaxrs-jersey -o samples/server/petstore/jaxrs/jersey1 -DhideGenerationTimestamp=true,serverPort=8082 --library=jersey1 --artifact-id=jaxrs-jersey1-server $@" +ags="generate -t modules/openapi-generator/src/main/resources/JavaJaxRS -i modules/openapi-generator/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml -g jaxrs-jersey -o samples/server/petstore/jaxrs/jersey1 --additional-properties hideGenerationTimestamp=true,serverPort=8082 --library=jersey1 --artifact-id=jaxrs-jersey1-server $@" echo "Removing files and folders under samples/server/petstore/jaxrs/jersey1/src/main" rm -rf samples/server/petstore/jaxrs/jersey1/src/main diff --git a/bin/jaxrs-jersey1-usetags-petstore-server.sh b/bin/jaxrs-jersey1-usetags-petstore-server.sh index 3e1c6bf6c065..00746c68db1e 100755 --- a/bin/jaxrs-jersey1-usetags-petstore-server.sh +++ b/bin/jaxrs-jersey1-usetags-petstore-server.sh @@ -27,7 +27,7 @@ fi # if you've executed sbt assembly previously it will use that instead. export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties" -ags="generate -t modules/openapi-generator/src/main/resources/JavaJaxRS -i modules/openapi-generator/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml -g jaxrs-jersey -o samples/server/petstore/jaxrs/jersey1-useTags -DhideGenerationTimestamp=true,serverPort=8082 --library=jersey1 --artifact-id=jaxrs-jersey1-useTags --additional-properties useTags=true $@" +ags="generate -t modules/openapi-generator/src/main/resources/JavaJaxRS -i modules/openapi-generator/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml -g jaxrs-jersey -o samples/server/petstore/jaxrs/jersey1-useTags --additional-properties hideGenerationTimestamp=true,serverPort=8082 --library=jersey1 --artifact-id=jaxrs-jersey1-useTags --additional-properties useTags=true $@" echo "Removing files and folders under samples/server/petstore/jaxrs/jersey1-useTags/src/main" rm -rf samples/server/petstore/jaxrs/jersey1-useTags/src/main diff --git a/bin/jaxrs-petstore-server-datelib-j8.sh b/bin/jaxrs-petstore-server-datelib-j8.sh index ef8e27e98dfa..64e9caff3bf3 100755 --- a/bin/jaxrs-petstore-server-datelib-j8.sh +++ b/bin/jaxrs-petstore-server-datelib-j8.sh @@ -27,6 +27,6 @@ fi # if you've executed sbt assembly previously it will use that instead. export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties" -ags="generate -t modules/openapi-generator/src/main/resources/JavaJaxRS/ -i modules/openapi-generator/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml -g jaxrs-jersey -o samples/server/petstore/jaxrs-datelib-j8/ -c ./bin/jaxrs-datelib-j8.json -DhideGenerationTimestamp=true --additional-properties serverPort=8082 $@" +ags="generate -t modules/openapi-generator/src/main/resources/JavaJaxRS/ -i modules/openapi-generator/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml -g jaxrs-jersey -o samples/server/petstore/jaxrs-datelib-j8/ -c ./bin/jaxrs-datelib-j8.json --additional-properties hideGenerationTimestamp=true --additional-properties serverPort=8082 $@" java $JAVA_OPTS -jar $executable $ags diff --git a/bin/jaxrs-petstore-server.sh b/bin/jaxrs-petstore-server.sh index df248d61288f..a75e5d3e55b0 100755 --- a/bin/jaxrs-petstore-server.sh +++ b/bin/jaxrs-petstore-server.sh @@ -27,7 +27,7 @@ fi # if you've executed sbt assembly previously it will use that instead. export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties" -ags="generate --artifact-id jaxrs-jersey-petstore-server -t modules/openapi-generator/src/main/resources/JavaJaxRS -i modules/openapi-generator/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml -g jaxrs-jersey -o samples/server/petstore/jaxrs/jersey2 -DhideGenerationTimestamp=true,serverPort=8082 $@" +ags="generate --artifact-id jaxrs-jersey-petstore-server -t modules/openapi-generator/src/main/resources/JavaJaxRS -i modules/openapi-generator/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml -g jaxrs-jersey -o samples/server/petstore/jaxrs/jersey2 --additional-properties hideGenerationTimestamp=true,serverPort=8082 $@" echo "Removing files and folders under samples/server/petstore/jaxrs/jersey2/src/main" rm -rf samples/server/petstore/jaxrs/jersey2/src/main diff --git a/bin/jaxrs-resteasy-eap-java8-petstore-server.sh b/bin/jaxrs-resteasy-eap-java8-petstore-server.sh index 4a99e7c8851c..8b85c9037221 100755 --- a/bin/jaxrs-resteasy-eap-java8-petstore-server.sh +++ b/bin/jaxrs-resteasy-eap-java8-petstore-server.sh @@ -27,7 +27,7 @@ fi # if you've executed sbt assembly previously it will use that instead. export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties" -ags="generate --artifact-id jaxrs-resteasy-eap-java8-server -t modules/openapi-generator/src/main/resources/JavaJaxRS/resteasy/eap -i modules/openapi-generator/src/test/resources/2_0/petstore.yaml -g jaxrs-resteasy-eap -o samples/server/petstore/jaxrs-resteasy/eap-java8 -DhideGenerationTimestamp=true -c ./bin/jaxrs-resteasy-eap-java8-petstore-server.json $@" +ags="generate --artifact-id jaxrs-resteasy-eap-java8-server -t modules/openapi-generator/src/main/resources/JavaJaxRS/resteasy/eap -i modules/openapi-generator/src/test/resources/2_0/petstore.yaml -g jaxrs-resteasy-eap -o samples/server/petstore/jaxrs-resteasy/eap-java8 --additional-properties hideGenerationTimestamp=true -c ./bin/jaxrs-resteasy-eap-java8-petstore-server.json $@" echo "Removing files and folders under samples/server/petstore/jaxrs-resteasy/eap-java8/src/main" rm -rf samples/server/petstore/jaxrs-resteasy/eap-java8/src/main diff --git a/bin/jaxrs-resteasy-eap-joda-petstore-server.sh b/bin/jaxrs-resteasy-eap-joda-petstore-server.sh index 656774e441fb..af9885025d66 100755 --- a/bin/jaxrs-resteasy-eap-joda-petstore-server.sh +++ b/bin/jaxrs-resteasy-eap-joda-petstore-server.sh @@ -26,7 +26,7 @@ fi # if you've executed sbt assembly previously it will use that instead. export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties" -ags="generate --artifact-id jaxrs-resteasy-eap-joda-server -t modules/openapi-generator/src/main/resources/JavaJaxRS/resteasy/eap -i modules/openapi-generator/src/test/resources/2_0/petstore.yaml -g jaxrs-resteasy-eap -o samples/server/petstore/jaxrs-resteasy/eap-joda -DhideGenerationTimestamp=true -c ./bin/jaxrs-resteasy-eap-joda-petstore-server.json $@" +ags="generate --artifact-id jaxrs-resteasy-eap-joda-server -t modules/openapi-generator/src/main/resources/JavaJaxRS/resteasy/eap -i modules/openapi-generator/src/test/resources/2_0/petstore.yaml -g jaxrs-resteasy-eap -o samples/server/petstore/jaxrs-resteasy/eap-joda --additional-properties hideGenerationTimestamp=true -c ./bin/jaxrs-resteasy-eap-joda-petstore-server.json $@" echo "Removing files and folders under samples/server/petstore/jaxrs-resteasy/eap-joda/src/main" rm -rf samples/server/petstore/jaxrs-resteasy/eap-joda/src/main diff --git a/bin/jaxrs-resteasy-eap-petstore-server.sh b/bin/jaxrs-resteasy-eap-petstore-server.sh index 39c2bff75d9f..7cc23202f48f 100755 --- a/bin/jaxrs-resteasy-eap-petstore-server.sh +++ b/bin/jaxrs-resteasy-eap-petstore-server.sh @@ -27,7 +27,7 @@ fi # if you've executed sbt assembly previously it will use that instead. export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties" -ags="generate -t modules/openapi-generator/src/main/resources/JavaJaxRS/resteasy/eap -i modules/openapi-generator/src/test/resources/2_0/petstore.yaml -g jaxrs-resteasy-eap -o samples/server/petstore/jaxrs-resteasy/eap -DhideGenerationTimestamp=true $@" +ags="generate -t modules/openapi-generator/src/main/resources/JavaJaxRS/resteasy/eap -i modules/openapi-generator/src/test/resources/2_0/petstore.yaml -g jaxrs-resteasy-eap -o samples/server/petstore/jaxrs-resteasy/eap --additional-properties hideGenerationTimestamp=true $@" echo "Removing files and folders under samples/server/petstore/jaxrs-resteasy/eap/src/main" rm -rf samples/server/petstore/jaxrs-resteasy/eap/src/main diff --git a/bin/jaxrs-resteasy-joda-petstore-server.sh b/bin/jaxrs-resteasy-joda-petstore-server.sh index 086dd81c241a..66bb1c3fffac 100755 --- a/bin/jaxrs-resteasy-joda-petstore-server.sh +++ b/bin/jaxrs-resteasy-joda-petstore-server.sh @@ -27,6 +27,6 @@ fi # if you've executed sbt assembly previously it will use that instead. export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties" -ags="generate --artifact-id jaxrs-resteasy-joda-server -t modules/openapi-generator/src/main/resources/JavaJaxRS/resteasy -i modules/openapi-generator/src/test/resources/2_0/petstore.yaml -g jaxrs-resteasy -o samples/server/petstore/jaxrs-resteasy/joda -DhideGenerationTimestamp=true -c ./bin/jaxrs-resteasy-joda-petstore-server.json $@" +ags="generate --artifact-id jaxrs-resteasy-joda-server -t modules/openapi-generator/src/main/resources/JavaJaxRS/resteasy -i modules/openapi-generator/src/test/resources/2_0/petstore.yaml -g jaxrs-resteasy -o samples/server/petstore/jaxrs-resteasy/joda --additional-properties hideGenerationTimestamp=true -c ./bin/jaxrs-resteasy-joda-petstore-server.json $@" java $JAVA_OPTS -jar $executable $ags diff --git a/bin/jaxrs-resteasy-petstore-server.sh b/bin/jaxrs-resteasy-petstore-server.sh index d6eabb20e759..6b40673aebd5 100755 --- a/bin/jaxrs-resteasy-petstore-server.sh +++ b/bin/jaxrs-resteasy-petstore-server.sh @@ -27,6 +27,6 @@ fi # if you've executed sbt assembly previously it will use that instead. export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties" -ags="generate -t modules/openapi-generator/src/main/resources/JavaJaxRS/resteasy -i modules/openapi-generator/src/test/resources/2_0/petstore.yaml -g jaxrs-resteasy -o samples/server/petstore/jaxrs-resteasy/default -DhideGenerationTimestamp=true $@" +ags="generate -t modules/openapi-generator/src/main/resources/JavaJaxRS/resteasy -i modules/openapi-generator/src/test/resources/2_0/petstore.yaml -g jaxrs-resteasy -o samples/server/petstore/jaxrs-resteasy/default --additional-properties hideGenerationTimestamp=true $@" java $JAVA_OPTS -jar $executable $ags diff --git a/bin/jaxrs-spec-petstore-server-interface-returning-response.sh b/bin/jaxrs-spec-petstore-server-interface-returning-response.sh index d964fa44e59b..c4cc314bb4f5 100755 --- a/bin/jaxrs-spec-petstore-server-interface-returning-response.sh +++ b/bin/jaxrs-spec-petstore-server-interface-returning-response.sh @@ -28,9 +28,9 @@ fi # if you've executed sbt assembly previously it will use that instead. export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties" ags="generate --artifact-id jaxrs-spec-interface-response-petstore-server -i modules/openapi-generator/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml -g jaxrs-spec -o samples/server/petstore/jaxrs-spec-interface-response --DhideGenerationTimestamp=true --DserializableModel=true --DinterfaceOnly=true --DreturnResponse=true $@" +--additional-properties hideGenerationTimestamp=true +--additional-properties serializableModel=true +--additional-properties interfaceOnly=true +--additional-properties returnResponse=true $@" java $JAVA_OPTS -jar $executable $ags diff --git a/bin/jaxrs-spec-petstore-server-interface.sh b/bin/jaxrs-spec-petstore-server-interface.sh index 73c2479977ca..570443e26eee 100755 --- a/bin/jaxrs-spec-petstore-server-interface.sh +++ b/bin/jaxrs-spec-petstore-server-interface.sh @@ -28,8 +28,8 @@ fi # if you've executed sbt assembly previously it will use that instead. export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties" ags="generate --artifact-id jaxrs-spec-interface-petstore-server -i modules/openapi-generator/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml -g jaxrs-spec -o samples/server/petstore/jaxrs-spec-interface --DhideGenerationTimestamp=true --DserializableModel=true --DinterfaceOnly=true $@" +--additional-properties hideGenerationTimestamp=true +--additional-properties serializableModel=true +--additional-properties interfaceOnly=true $@" java $JAVA_OPTS -jar $executable $ags diff --git a/bin/jaxrs-spec-petstore-server.sh b/bin/jaxrs-spec-petstore-server.sh index 296b03b4fab7..9d0c75513bd0 100755 --- a/bin/jaxrs-spec-petstore-server.sh +++ b/bin/jaxrs-spec-petstore-server.sh @@ -28,7 +28,7 @@ fi # if you've executed sbt assembly previously it will use that instead. export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties" ags="generate --artifact-id jaxrs-spec-petstore-server -i modules/openapi-generator/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml -g jaxrs-spec -o samples/server/petstore/jaxrs-spec --DhideGenerationTimestamp=true --DserializableModel=true $@" +--additional-properties hideGenerationTimestamp=true +--additional-properties serializableModel=true $@" java $JAVA_OPTS -jar $executable $ags diff --git a/bin/jaxrs-usetags-petstore-server.sh b/bin/jaxrs-usetags-petstore-server.sh index bd811f3a7e81..1c84b29a033c 100755 --- a/bin/jaxrs-usetags-petstore-server.sh +++ b/bin/jaxrs-usetags-petstore-server.sh @@ -27,7 +27,7 @@ fi # if you've executed sbt assembly previously it will use that instead. export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties" -ags="generate -t modules/openapi-generator/src/main/resources/JavaJaxRS -i modules/openapi-generator/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml -g jaxrs-jersey -o samples/server/petstore/jaxrs/jersey2-useTags -DhideGenerationTimestamp=true,serverPort=8082 --artifact-id=jaxrs-jersey2-useTags --additional-properties useTags=true $@" +ags="generate -t modules/openapi-generator/src/main/resources/JavaJaxRS -i modules/openapi-generator/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml -g jaxrs-jersey -o samples/server/petstore/jaxrs/jersey2-useTags --additional-properties hideGenerationTimestamp=true,serverPort=8082 --artifact-id=jaxrs-jersey2-useTags --additional-properties useTags=true $@" echo "Removing files and folders under samples/server/petstore/jaxrs/jersey2-useTags/src/main" rm -rf samples/server/petstore/jaxrs/jersey2-useTags/src/main diff --git a/bin/kotlin-client-petstore.sh b/bin/kotlin-client-petstore.sh index fdcdb59b1964..cad4be6995e0 100755 --- a/bin/kotlin-client-petstore.sh +++ b/bin/kotlin-client-petstore.sh @@ -27,6 +27,6 @@ fi # if you've executed sbt assembly previously it will use that instead. export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties" -ags="generate -t modules/openapi-generator/src/main/resources/kotlin-client -i modules/openapi-generator/src/test/resources/2_0/petstore.yaml -g kotlin --artifact-id kotlin-petstore-client -D dateLibrary=java8 -o samples/client/petstore/kotlin $@" +ags="generate -t modules/openapi-generator/src/main/resources/kotlin-client -i modules/openapi-generator/src/test/resources/2_0/petstore.yaml -g kotlin --artifact-id kotlin-petstore-client --additional-properties dateLibrary=java8 -o samples/client/petstore/kotlin $@" java ${JAVA_OPTS} -jar ${executable} ${ags} diff --git a/bin/kotlin-client-string.sh b/bin/kotlin-client-string.sh index 2011e52e5e80..410ddbab3999 100755 --- a/bin/kotlin-client-string.sh +++ b/bin/kotlin-client-string.sh @@ -27,7 +27,7 @@ fi # if you've executed sbt assembly previously it will use that instead. export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties" -ags="generate -t modules/openapi-generator/src/main/resources/kotlin-client -i modules/openapi-generator/src/test/resources/2_0/petstore.yaml -g kotlin --artifact-id kotlin-petstore-string -D dateLibrary=string -o samples/client/petstore/kotlin-string $@" +ags="generate -t modules/openapi-generator/src/main/resources/kotlin-client -i modules/openapi-generator/src/test/resources/2_0/petstore.yaml -g kotlin --artifact-id kotlin-petstore-string --additional-properties dateLibrary=string -o samples/client/petstore/kotlin-string $@" java ${JAVA_OPTS} -jar ${executable} ${ags} diff --git a/bin/kotlin-client-threetenbp.sh b/bin/kotlin-client-threetenbp.sh index c207268d8c33..0cb7f27da091 100755 --- a/bin/kotlin-client-threetenbp.sh +++ b/bin/kotlin-client-threetenbp.sh @@ -27,7 +27,7 @@ fi # if you've executed sbt assembly previously it will use that instead. export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties" -ags="generate -t modules/openapi-generator/src/main/resources/kotlin-client -i modules/openapi-generator/src/test/resources/2_0/petstore.yaml -g kotlin --artifact-id kotlin-petstore-threetenbp -D dateLibrary=threetenbp -o samples/client/petstore/kotlin-threetenbp $@" +ags="generate -t modules/openapi-generator/src/main/resources/kotlin-client -i modules/openapi-generator/src/test/resources/2_0/petstore.yaml -g kotlin --artifact-id kotlin-petstore-threetenbp --additional-properties dateLibrary=threetenbp -o samples/client/petstore/kotlin-threetenbp $@" java ${JAVA_OPTS} -jar ${executable} ${ags} diff --git a/bin/kotlin-server-petstore.sh b/bin/kotlin-server-petstore.sh index 43ab67d264c0..dbdf48b2bbd3 100755 --- a/bin/kotlin-server-petstore.sh +++ b/bin/kotlin-server-petstore.sh @@ -27,7 +27,7 @@ fi # if you've executed sbt assembly previously it will use that instead. export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties" -ags="generate -i modules/openapi-generator/src/test/resources/2_0/petstore.yaml -t modules/openapi-generator/src/main/resources/kotlin-server -g kotlin-server --library=ktor -o samples/server/petstore/kotlin-server/ktor -DhideGenerationTimestamp=true $@" +ags="generate -i modules/openapi-generator/src/test/resources/2_0/petstore.yaml -t modules/openapi-generator/src/main/resources/kotlin-server -g kotlin-server --library=ktor -o samples/server/petstore/kotlin-server/ktor --additional-properties hideGenerationTimestamp=true $@" java ${JAVA_OPTS} -jar ${executable} ${ags} diff --git a/bin/lua-petstore.sh b/bin/lua-petstore.sh index b7adaaac4605..44b5cc386375 100755 --- a/bin/lua-petstore.sh +++ b/bin/lua-petstore.sh @@ -27,6 +27,6 @@ fi # if you've executed sbt assembly previously it will use that instead. export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties $@" -ags="generate -t modules/openapi-generator/src/main/resources/lua -i modules/openapi-generator/src/test/resources/2_0/petstore.yaml -g lua -o samples/client/petstore/lua -DpackageName=petstore $@" +ags="generate -t modules/openapi-generator/src/main/resources/lua -i modules/openapi-generator/src/test/resources/2_0/petstore.yaml -g lua -o samples/client/petstore/lua --additional-properties packageName=petstore $@" java $JAVA_OPTS -jar $executable $ags diff --git a/bin/nodejs-petstore-google-cloud-functions.sh b/bin/nodejs-petstore-google-cloud-functions.sh index 80e120270584..c3db5f9bcb17 100755 --- a/bin/nodejs-petstore-google-cloud-functions.sh +++ b/bin/nodejs-petstore-google-cloud-functions.sh @@ -26,7 +26,7 @@ then fi # if you've executed sbt assembly previously it will use that instead. -export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties" -ags="generate -i modules/openapi-generator/src/test/resources/2_0/petstore.yaml -g nodejs-server --additional-properties=googleCloudFunctions=true -o samples/server/petstore/nodejs-google-cloud-functions -Dservice $@" +export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties -Dservice" +ags="generate -i modules/openapi-generator/src/test/resources/2_0/petstore.yaml -g nodejs-server --additional-properties=googleCloudFunctions=true -o samples/server/petstore/nodejs-google-cloud-functions $@" java $JAVA_OPTS -jar $executable $ags diff --git a/bin/nodejs-petstore-server.sh b/bin/nodejs-petstore-server.sh index 2dfc8f327c71..9c8f945116fd 100755 --- a/bin/nodejs-petstore-server.sh +++ b/bin/nodejs-petstore-server.sh @@ -26,7 +26,7 @@ then fi # if you've executed sbt assembly previously it will use that instead. -export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties" -ags="generate -t modules/openapi-generator/src/main/resources/nodejs -i modules/openapi-generator/src/test/resources/2_0/petstore.yaml -g nodejs-server -o samples/server/petstore/nodejs -Dservice $@" +export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties -Dservice" +ags="generate -t modules/openapi-generator/src/main/resources/nodejs -i modules/openapi-generator/src/test/resources/2_0/petstore.yaml -g nodejs-server -o samples/server/petstore/nodejs $@" java $JAVA_OPTS -jar $executable $ags diff --git a/bin/objc-petstore-coredata.sh b/bin/objc-petstore-coredata.sh index 124f800da211..ffa6d1988227 100755 --- a/bin/objc-petstore-coredata.sh +++ b/bin/objc-petstore-coredata.sh @@ -26,7 +26,8 @@ then fi # if you've executed sbt assembly previously it will use that instead. -export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties" -ags="generate -t modules/openapi-generator/src/main/resources/objc -i modules/openapi-generator/src/test/resources/2_0/petstore.json -g objc -D apiDocs=false -D modelDocs=false -o samples/client/petstore/objc/core-data --additional-properties coreData=true -c bin/objc-petstore.json $@" +export GENERATOR_GLOBALS="-DapiDocs=false -DmodelDocs=false" +export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties ${GENERATOR_GLOBALS}" +ags="generate -t modules/openapi-generator/src/main/resources/objc -i modules/openapi-generator/src/test/resources/2_0/petstore.json -g objc -o samples/client/petstore/objc/core-data --additional-properties coreData=true -c bin/objc-petstore.json $@" java $JAVA_OPTS -jar $executable $ags diff --git a/bin/openapi3/android-petstore-httpclient.sh b/bin/openapi3/android-petstore-httpclient.sh index e16162214924..a16ff89917af 100755 --- a/bin/openapi3/android-petstore-httpclient.sh +++ b/bin/openapi3/android-petstore-httpclient.sh @@ -27,6 +27,6 @@ fi # if you've executed sbt assembly previously it will use that instead. export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties" -ags="generate -t modules/openapi-generator/src/main/resources/android -i modules/openapi-generator/src/test/resources/3_0/petstore.yaml -g android -Dlibrary=httpclient -o samples/client/petstore/android/httpclient $@" +ags="generate -t modules/openapi-generator/src/main/resources/android -i modules/openapi-generator/src/test/resources/3_0/petstore.yaml -g android --additional-properties library=httpclient -o samples/client/petstore/android/httpclient $@" java $JAVA_OPTS -jar $executable $ags diff --git a/bin/openapi3/dart-petstore.sh b/bin/openapi3/dart-petstore.sh index f9da99019e03..2bab8d1abac9 100755 --- a/bin/openapi3/dart-petstore.sh +++ b/bin/openapi3/dart-petstore.sh @@ -29,18 +29,18 @@ fi export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties" # Generate non-browserClient -ags="generate -t modules/openapi-generator/src/main/resources/dart -i modules/openapi-generator/src/test/resources/3_0/petstore.yaml -g dart -o samples/client/petstore/dart/openapi -DhideGenerationTimestamp=true -DbrowserClient=false $@" +ags="generate -t modules/openapi-generator/src/main/resources/dart -i modules/openapi-generator/src/test/resources/3_0/petstore.yaml -g dart -o samples/client/petstore/dart/openapi --additional-properties hideGenerationTimestamp=true,browserClient=false $@" # then options to generate the library for vm would be: -#ags="generate -i modules/openapi-generator/src/test/resources/3_0/petstore.yaml -g dart -o samples/client/petstore/dart/openapi_vm -DbrowserClient=false -DpubName=openapi_vm $@" +#ags="generate -i modules/openapi-generator/src/test/resources/3_0/petstore.yaml -g dart -o samples/client/petstore/dart/openapi_vm --additional-properties browserClient=false,pubName=openapi_vm $@" #java $JAVA_OPTS -jar $executable $ags # Generate browserClient -ags="generate -t modules/openapi-generator/src/main/resources/dart -i modules/openapi-generator/src/test/resources/3_0/petstore.yaml -g dart -o samples/client/petstore/dart/openapi-browser-client -DhideGenerationTimestamp=true -DbrowserClient=true $@" +ags="generate -t modules/openapi-generator/src/main/resources/dart -i modules/openapi-generator/src/test/resources/3_0/petstore.yaml -g dart -o samples/client/petstore/dart/openapi-browser-client --additional-properties hideGenerationTimestamp=true,browserClient=true $@" #java $JAVA_OPTS -jar $executable $ags # Generate non-browserClient and put it to the flutter sample app -ags="generate -t modules/openapi-generator/src/main/resources/dart -i modules/openapi-generator/src/test/resources/3_0/petstore.yaml -g dart -o samples/client/petstore/dart/flutter_petstore/openapi -DhideGenerationTimestamp=true -DbrowserClient=false $@" +ags="generate -t modules/openapi-generator/src/main/resources/dart -i modules/openapi-generator/src/test/resources/3_0/petstore.yaml -g dart -o samples/client/petstore/dart/flutter_petstore/openapi --additional-properties hideGenerationTimestamp=true,browserClient=false $@" java $JAVA_OPTS -jar $executable $ags # There is a proposal to allow importing different libraries depending on the environment: diff --git a/bin/openapi3/erlang-petstore-client.sh b/bin/openapi3/erlang-petstore-client.sh index 102cc342d076..fc75014a41e6 100755 --- a/bin/openapi3/erlang-petstore-client.sh +++ b/bin/openapi3/erlang-petstore-client.sh @@ -27,6 +27,6 @@ fi # if you've executed sbt assembly previously it will use that instead. export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties" -ags="generate -t modules/openapi-generator/src/main/resources/erlang-client -DpackageName=petstore -i modules/openapi-generator/src/test/resources/3_0/petstore.yaml -g erlang-client -o samples/client/petstore/erlang-client $@" +ags="generate -t modules/openapi-generator/src/main/resources/erlang-client --additional-properties packageName=petstore -i modules/openapi-generator/src/test/resources/3_0/petstore.yaml -g erlang-client -o samples/client/petstore/erlang-client $@" java $JAVA_OPTS -jar $executable $ags diff --git a/bin/openapi3/go-gin-petstore-server.sh b/bin/openapi3/go-gin-petstore-server.sh index a3f14d4b622c..8ab2b8397e0e 100755 --- a/bin/openapi3/go-gin-petstore-server.sh +++ b/bin/openapi3/go-gin-petstore-server.sh @@ -35,7 +35,7 @@ rm -rf $STUB_DIR # if you've executed sbt assembly previously it will use that instead. export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties" -ags="generate -t modules/openapi-generator/src/main/resources/go-gin-server -i $SPEC -g $GENERATOR -o $STUB_DIR -DpackageName=petstoreserver --additional-properties hideGenerationTimestamp=true -Dservice $@" +ags="generate -t modules/openapi-generator/src/main/resources/go-gin-server -i $SPEC -g $GENERATOR -o $STUB_DIR --additional-properties packageName=petstoreserver --additional-properties hideGenerationTimestamp=true $@" java $JAVA_OPTS -jar $executable $ags #!/usr/bin/env bash \ No newline at end of file diff --git a/bin/openapi3/go-petstore-server.sh b/bin/openapi3/go-petstore-server.sh index bbe46e703830..7909ec7d5db7 100755 --- a/bin/openapi3/go-petstore-server.sh +++ b/bin/openapi3/go-petstore-server.sh @@ -35,6 +35,6 @@ rm -rf $STUB_DIR # if you've executed sbt assembly previously it will use that instead. export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties" -ags="generate -t modules/openapi-generator/src/main/resources/go-server -i $SPEC -g $GENERATOR -o $STUB_DIR -DpackageName=petstoreserver --additional-properties hideGenerationTimestamp=true -Dservice $@" +ags="generate -t modules/openapi-generator/src/main/resources/go-server -i $SPEC -g $GENERATOR -o $STUB_DIR --additional-properties packageName=petstoreserver,hideGenerationTimestamp=true $@" java $JAVA_OPTS -jar $executable $ags diff --git a/bin/openapi3/go-petstore.sh b/bin/openapi3/go-petstore.sh index 872fcb610eb4..ad921deae9cb 100755 --- a/bin/openapi3/go-petstore.sh +++ b/bin/openapi3/go-petstore.sh @@ -34,6 +34,6 @@ rm -rf $STUB_DIR # if you've executed sbt assembly previously it will use that instead. export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties" -ags="generate -t modules/openapi-generator/src/main/resources/go -i $SPEC -g $GENERATOR -o $STUB_DIR -DpackageName=petstore $@" +ags="generate -t modules/openapi-generator/src/main/resources/go -i $SPEC -g $GENERATOR -o $STUB_DIR --additional-properties packageName=petstore $@" java $JAVA_OPTS -jar $executable $ags diff --git a/bin/openapi3/graphql-nodejs-express-server.sh b/bin/openapi3/graphql-nodejs-express-server.sh index 0e1291c8a6dc..41a695116014 100755 --- a/bin/openapi3/graphql-nodejs-express-server.sh +++ b/bin/openapi3/graphql-nodejs-express-server.sh @@ -27,6 +27,6 @@ fi # if you've executed sbt assembly previously it will use that instead. export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties $@" -ags="generate -t modules/openapi-generator/src/main/resources/graphql-nodejs-express-server -i modules/openapi-generator/src/test/resources/3_0/petstore.yaml -g graphql-nodejs-express-server -o samples/server/petstore/graphql-nodejs-express-server -DpackageName=petstore $@" +ags="generate -t modules/openapi-generator/src/main/resources/graphql-nodejs-express-server -i modules/openapi-generator/src/test/resources/3_0/petstore.yaml -g graphql-nodejs-express-server -o samples/server/petstore/graphql-nodejs-express-server --additional-properties packageName=petstore $@" java $JAVA_OPTS -jar $executable $ags diff --git a/bin/openapi3/groovy-petstore.sh b/bin/openapi3/groovy-petstore.sh index 1dd1d9c80216..c0c1ddda0518 100755 --- a/bin/openapi3/groovy-petstore.sh +++ b/bin/openapi3/groovy-petstore.sh @@ -27,5 +27,5 @@ fi # if you've executed sbt assembly previously it will use that instead. export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties" -ags="generate -i modules/openapi-generator/src/test/resources/3_0/petstore.yaml -g groovy -o samples/client/petstore/groovy -DhideGenerationTimestamp=true $@" +ags="generate -i modules/openapi-generator/src/test/resources/3_0/petstore.yaml -g groovy -o samples/client/petstore/groovy --additional-properties hideGenerationTimestamp=true $@" java $JAVA_OPTS -jar $executable $ags diff --git a/bin/openapi3/javascript-es6-petstore.sh b/bin/openapi3/javascript-es6-petstore.sh index fac3a9039f6a..96e45b4b8e74 100755 --- a/bin/openapi3/javascript-es6-petstore.sh +++ b/bin/openapi3/javascript-es6-petstore.sh @@ -29,6 +29,6 @@ fi export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties" ags="generate -t modules/openapi-generator/src/main/resources/Javascript/es6 \ -i modules/openapi-generator/src/test/resources/3_0/petstore-with-fake-endpoints-models-for-testing.yaml -g javascript \ --o samples/openapi3/client/petstore/javascript-es6 $@" +-o samples/openapi3/client/petstore/javascript-es6 --additional-properties appName=PetstoreClient $@" -java -DappName=PetstoreClient $JAVA_OPTS -jar $executable $ags +java $JAVA_OPTS -jar $executable $ags diff --git a/bin/openapi3/jaxrs-jersey-petstore.sh b/bin/openapi3/jaxrs-jersey-petstore.sh index ddb1968cdb39..2b1e71f73e15 100755 --- a/bin/openapi3/jaxrs-jersey-petstore.sh +++ b/bin/openapi3/jaxrs-jersey-petstore.sh @@ -27,6 +27,6 @@ fi # if you've executed sbt assembly previously it will use that instead. export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties" -ags="generate --artifact-id "openapiv3-jaxrs-jersey-petstore-server" -t modules/openapi-generator/src/main/resources/JavaJaxRS/ -i modules/openapi-generator/src/test/resources/3_0/petstore-with-fake-endpoints-models-for-testing.yaml -g jaxrs-jersey -o samples/server/petstore/jaxrs-jersey -DhideGenerationTimestamp=true $@" +ags="generate --artifact-id "openapiv3-jaxrs-jersey-petstore-server" -t modules/openapi-generator/src/main/resources/JavaJaxRS/ -i modules/openapi-generator/src/test/resources/3_0/petstore-with-fake-endpoints-models-for-testing.yaml -g jaxrs-jersey -o samples/server/petstore/jaxrs-jersey --additional-properties hideGenerationTimestamp=true $@" java $JAVA_OPTS -jar $executable $ags diff --git a/bin/openapi3/kotlin-client-petstore.sh b/bin/openapi3/kotlin-client-petstore.sh index cfd443d43e22..5ffd829b05d4 100755 --- a/bin/openapi3/kotlin-client-petstore.sh +++ b/bin/openapi3/kotlin-client-petstore.sh @@ -26,7 +26,7 @@ then fi export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties" -ags="$@ generate -i modules/openapi-generator/src/test/resources/3_0/petstore-with-fake-endpoints-models-for-testing.yaml -t modules/openapi-generator/src/main/resources/kotlin-client -g kotlin --artifact-id kotlin-petstore-client -D dateLibrary=java8 -o samples/openapi3/client/petstore/kotlin $@" +ags="$@ generate -i modules/openapi-generator/src/test/resources/3_0/petstore-with-fake-endpoints-models-for-testing.yaml -t modules/openapi-generator/src/main/resources/kotlin-client -g kotlin --artifact-id kotlin-petstore-client --additional-properties dateLibrary=java8 -o samples/openapi3/client/petstore/kotlin $@" echo "Cleaning previously generated files if any from samples/openapi3/client/petstore/kotlin" rm -rf samples/openapi3/client/petstore/kotlin diff --git a/bin/openapi3/lua-petstore.sh b/bin/openapi3/lua-petstore.sh index aa70c3b06960..f598c67aa022 100755 --- a/bin/openapi3/lua-petstore.sh +++ b/bin/openapi3/lua-petstore.sh @@ -27,6 +27,6 @@ fi # if you've executed sbt assembly previously it will use that instead. export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties" -ags="generate -t modules/openapi-generator/src/main/resources/lua -i modules/openapi-generator/src/test/resources/3_0/petstore.yaml -g lua -o samples/client/petstore/lua -DpackageName=petstore $@" +ags="generate -t modules/openapi-generator/src/main/resources/lua -i modules/openapi-generator/src/test/resources/3_0/petstore.yaml -g lua -o samples/client/petstore/lua --additional-properties packageName=petstore $@" java $JAVA_OPTS -jar $executable $ags diff --git a/bin/openapi3/nodejs-petstore-google-cloud-functions.sh b/bin/openapi3/nodejs-petstore-google-cloud-functions.sh index a11e8da6c5d8..33018310a439 100755 --- a/bin/openapi3/nodejs-petstore-google-cloud-functions.sh +++ b/bin/openapi3/nodejs-petstore-google-cloud-functions.sh @@ -26,7 +26,7 @@ then fi # if you've executed sbt assembly previously it will use that instead. -export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties" -ags="generate -i modules/openapi-generator/src/test/resources/3_0/petstore.yaml -g nodejs-server --additional-properties=googleCloudFunctions=true -o samples/server/petstore/nodejs-google-cloud-functions -Dservice $@" +export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties -Dservice" +ags="generate -i modules/openapi-generator/src/test/resources/3_0/petstore.yaml -g nodejs-server --additional-properties=googleCloudFunctions=true -o samples/server/petstore/nodejs-google-cloud-functions $@" java $JAVA_OPTS -jar $executable $ags diff --git a/bin/openapi3/nodejs-petstore-server.sh b/bin/openapi3/nodejs-petstore-server.sh index df83e4ebfa61..408bd20fba25 100755 --- a/bin/openapi3/nodejs-petstore-server.sh +++ b/bin/openapi3/nodejs-petstore-server.sh @@ -26,7 +26,7 @@ then fi # if you've executed sbt assembly previously it will use that instead. -export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties" -ags="generate -t modules/openapi-generator/src/main/resources/nodejs -i modules/openapi-generator/src/test/resources/3_0/petstore.yaml -g nodejs-server -o samples/server/petstore/nodejs -Dservice $@" +export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties -Dservice" +ags="generate -t modules/openapi-generator/src/main/resources/nodejs -i modules/openapi-generator/src/test/resources/3_0/petstore.yaml -g nodejs-server -o samples/server/petstore/nodejs $@" java $JAVA_OPTS -jar $executable $ags diff --git a/bin/openapi3/objc-petstore-coredata.sh b/bin/openapi3/objc-petstore-coredata.sh index 97fa054794fa..ec36e2f510a4 100755 --- a/bin/openapi3/objc-petstore-coredata.sh +++ b/bin/openapi3/objc-petstore-coredata.sh @@ -26,7 +26,8 @@ then fi # if you've executed sbt assembly previously it will use that instead. -export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties" -ags="generate -t modules/openapi-generator/src/main/resources/objc -i modules/openapi-generator/src/test/resources/3_0/petstore.json -g objc -D apiDocs=false -D modelDocs=false -o samples/client/petstore/objc/core-data --additional-properties coreData=true -D appName=PetstoreClient $@" +export GENERATOR_GLOBALS="-DapiDocs=false -DmodelDocs=false" +export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties ${GENERATOR_GLOBALS}" +ags="generate -t modules/openapi-generator/src/main/resources/objc -i modules/openapi-generator/src/test/resources/3_0/petstore.json -g objc -o samples/client/petstore/objc/core-data --additional-properties coreData=true,appName=PetstoreClient $@" java $JAVA_OPTS -jar $executable $ags diff --git a/bin/openapi3/objc-petstore.sh b/bin/openapi3/objc-petstore.sh index 11313e903d44..5840e39a4507 100755 --- a/bin/openapi3/objc-petstore.sh +++ b/bin/openapi3/objc-petstore.sh @@ -27,6 +27,6 @@ fi # if you've executed sbt assembly previously it will use that instead. export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties" -ags="generate -t modules/openapi-generator/src/main/resources/objc -i modules/openapi-generator/src/test/resources/3_0/petstore.json -g objc -o samples/client/petstore/objc/default -D appName=PetstoreClient $@" +ags="generate -t modules/openapi-generator/src/main/resources/objc -i modules/openapi-generator/src/test/resources/3_0/petstore.json -g objc -o samples/client/petstore/objc/default --additional-properties appName=PetstoreClient $@" java $JAVA_OPTS -jar $executable $ags diff --git a/bin/openapi3/perl-petstore.sh b/bin/openapi3/perl-petstore.sh index 02293ae8b6f2..7707591647b8 100755 --- a/bin/openapi3/perl-petstore.sh +++ b/bin/openapi3/perl-petstore.sh @@ -28,6 +28,6 @@ fi # if you've executed sbt assembly previously it will use that instead. export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties" # complex module name used for testing -ags="generate -t modules/openapi-generator/src/main/resources/perl -i modules/openapi-generator/src/test/resources/3_0/petstore-with-fake-endpoints-models-for-testing.yaml -g perl -o samples/client/petstore/perl -DhideGenerationTimestamp=true $@" +ags="generate -t modules/openapi-generator/src/main/resources/perl -i modules/openapi-generator/src/test/resources/3_0/petstore-with-fake-endpoints-models-for-testing.yaml -g perl -o samples/client/petstore/perl --additional-properties hideGenerationTimestamp=true $@" java $JAVA_OPTS -jar $executable $ags diff --git a/bin/openapi3/python-flask-petstore-python2.sh b/bin/openapi3/python-flask-petstore-python2.sh index c98569d10c4d..2f303a57e3dd 100755 --- a/bin/openapi3/python-flask-petstore-python2.sh +++ b/bin/openapi3/python-flask-petstore-python2.sh @@ -32,7 +32,7 @@ resources=modules/openapi-generator/src/main/resources/python-flask # if you've executed sbt assembly previously it will use that instead. export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties" -ags="generate -t $resources -i $input -g python-flask -o $out_folder -c bin/supportPython2.json -D service $@" +ags="generate -t $resources -i $input -g python-flask -o $out_folder -c bin/supportPython2.json $@" rm -rf $out_folder/.openapi* rm -rf $out_folder/openapi_server diff --git a/bin/openapi3/python-flask-petstore.sh b/bin/openapi3/python-flask-petstore.sh index 473c69a7b2c6..fda1f6a57437 100755 --- a/bin/openapi3/python-flask-petstore.sh +++ b/bin/openapi3/python-flask-petstore.sh @@ -31,8 +31,8 @@ out_folder=samples/server/openapi3/petstore/python-flask resources=modules/openapi-generator/src/main/resources/python-flask # if you've executed sbt assembly previously it will use that instead. -export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties" -ags="generate -t $resources -i $input -g python-flask -o $out_folder -Dservice $@" +export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties -Dservice" +ags="generate -t $resources -i $input -g python-flask -o $out_folder $@" rm -rf $out_folder/.openapi* rm -rf $out_folder/openapi_server diff --git a/bin/openapi3/python-petstore.sh b/bin/openapi3/python-petstore.sh index b1c5144bdfab..c1dce94f9c25 100755 --- a/bin/openapi3/python-petstore.sh +++ b/bin/openapi3/python-petstore.sh @@ -27,6 +27,6 @@ fi # if you've executed sbt assembly previously it will use that instead. export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties" -ags="generate -t modules/openapi-generator/src/main/resources/python -i modules/openapi-generator/src/test/resources/3_0/petstore-with-fake-endpoints-models-for-testing.yaml -g python -o samples/openapi3/client/petstore/python/ -DpackageName=petstore_api $@" +ags="generate -t modules/openapi-generator/src/main/resources/python -i modules/openapi-generator/src/test/resources/3_0/petstore-with-fake-endpoints-models-for-testing.yaml -g python -o samples/openapi3/client/petstore/python/ --additional-properties packageName=petstore_api $@" java $JAVA_OPTS -jar $executable $ags diff --git a/bin/openapi3/r-petstore.sh b/bin/openapi3/r-petstore.sh index cfc0d262acd8..9ca5ed61d004 100755 --- a/bin/openapi3/r-petstore.sh +++ b/bin/openapi3/r-petstore.sh @@ -27,6 +27,6 @@ fi # if you've executed sbt assembly previously it will use that instead. export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties" -ags="generate -t modules/openapi-generator/src/main/resources/r -i modules/openapi-generator/src/test/resources/3_0/petstore.yaml -g r -o samples/client/petstore/R -DpackageName=petstore $@" +ags="generate -t modules/openapi-generator/src/main/resources/r -i modules/openapi-generator/src/test/resources/3_0/petstore.yaml -g r -o samples/client/petstore/R --additional-properties packageName=petstore $@" java $JAVA_OPTS -jar $executable $ags diff --git a/bin/openapi3/ruby-client-petstore.sh b/bin/openapi3/ruby-client-petstore.sh index 237b8ca6ae9c..0be84e7eca84 100755 --- a/bin/openapi3/ruby-client-petstore.sh +++ b/bin/openapi3/ruby-client-petstore.sh @@ -38,6 +38,6 @@ find samples/openapi3/client/petstore/ruby/spec -type f -not -name petstore_help # if you've executed sbt assembly previously it will use that instead. export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties" -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/ruby-petstore.json -o samples/openapi3/client/petstore/ruby -DskipFormModel=true $@" +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/ruby-petstore.json -o samples/openapi3/client/petstore/ruby --additional-properties skipFormModel=true $@" java $JAVA_OPTS -jar $executable $ags diff --git a/bin/openapi3/rust-petstore.sh b/bin/openapi3/rust-petstore.sh index c252daaf1e69..a4812fc9093b 100755 --- a/bin/openapi3/rust-petstore.sh +++ b/bin/openapi3/rust-petstore.sh @@ -27,6 +27,6 @@ fi # if you've executed sbt assembly previously it will use that instead. export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties" -ags="generate -t modules/openapi-generator/src/main/resources/rust -i modules/openapi-generator/src/test/resources/3_0/petstore.yaml -g rust -o samples/client/petstore/rust -DpackageName=petstore_client $@" +ags="generate -t modules/openapi-generator/src/main/resources/rust -i modules/openapi-generator/src/test/resources/3_0/petstore.yaml -g rust -o samples/client/petstore/rust --additional-properties packageName=petstore_client $@" java ${JAVA_OPTS} -jar ${executable} ${ags} diff --git a/bin/openapi3/typescript-angular-petstore-all.sh b/bin/openapi3/typescript-angular-petstore-all.sh index cf0116c6b25b..bb0d6d2479c7 100755 --- a/bin/openapi3/typescript-angular-petstore-all.sh +++ b/bin/openapi3/typescript-angular-petstore-all.sh @@ -37,7 +37,7 @@ ags="generate -i modules/openapi-generator/src/test/resources/3_0/petstore.yaml java $JAVA_OPTS -jar $executable $ags echo "Typescript Petstore API client (with interfaces generated)" -ags="generate -i modules/openapi-generator/src/test/resources/3_0/petstore.yaml -g typescript-angular -o samples/client/petstore/typescript-angular-v2/with-interfaces -D withInterfaces=true --additional-properties ngVersion=2 $@" +ags="generate -i modules/openapi-generator/src/test/resources/3_0/petstore.yaml -g typescript-angular -o samples/client/petstore/typescript-angular-v2/with-interfaces --additional-properties ngVersion=2,withInterfaces=true $@" java $JAVA_OPTS -jar $executable $ags echo "Typescript Petstore API client (v4 { Adding InjectionToken Over OpaqueToken })" diff --git a/bin/openapi3/typescript-angular-v2-petstore-interfaces.sh b/bin/openapi3/typescript-angular-v2-petstore-interfaces.sh index deff9fdba5cb..3d74ccc1a95e 100755 --- a/bin/openapi3/typescript-angular-v2-petstore-interfaces.sh +++ b/bin/openapi3/typescript-angular-v2-petstore-interfaces.sh @@ -27,6 +27,6 @@ fi # if you've executed sbt assembly previously it will use that instead. export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties" -ags="generate -i modules/openapi-generator/src/test/resources/3_0/petstore.yaml -g typescript-angular -o samples/client/petstore/typescript-angular-v2/with-interfaces -D withInterfaces=true --additional-properties ngVersion=2 $@" +ags="generate -i modules/openapi-generator/src/test/resources/3_0/petstore.yaml -g typescript-angular -o samples/client/petstore/typescript-angular-v2/with-interfaces --additional-properties ngVersion=2,withInterfaces=true $@" java $JAVA_OPTS -jar $executable $ags diff --git a/bin/openapi3/typescript-fetch-petstore-interfaces.sh b/bin/openapi3/typescript-fetch-petstore-interfaces.sh index bf56d7ba9e47..d1e21dfbca73 100755 --- a/bin/openapi3/typescript-fetch-petstore-interfaces.sh +++ b/bin/openapi3/typescript-fetch-petstore-interfaces.sh @@ -27,6 +27,6 @@ fi # if you've executed sbt assembly previously it will use that instead. export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties" -ags="generate -i modules/openapi-generator/src/test/resources/3_0/petstore.yaml -g typescript-fetch -o samples/client/petstore/typescript-fetch/builds/with-interfaces -D withInterfaces=true $@" +ags="generate -i modules/openapi-generator/src/test/resources/3_0/petstore.yaml -g typescript-fetch -o samples/client/petstore/typescript-fetch/builds/with-interfaces --additional-properties withInterfaces=true $@" java $JAVA_OPTS -jar $executable $ags diff --git a/bin/perl-deep-module-petstore.sh b/bin/perl-deep-module-petstore.sh index 25837a8fe9d0..8e47a7d3b826 100755 --- a/bin/perl-deep-module-petstore.sh +++ b/bin/perl-deep-module-petstore.sh @@ -27,6 +27,6 @@ fi # if you've executed sbt assembly previously it will use that instead. export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties" # complex module name used for testing -ags="generate -i modules/openapi-generator/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml -g perl -o samples/client/petstore/perl/deep_module_test -DhideGenerationTimestamp=true $@" +ags="generate -i modules/openapi-generator/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml -g perl -o samples/client/petstore/perl/deep_module_test --additional-properties hideGenerationTimestamp=true $@" java $JAVA_OPTS -jar $executable $ags --additional-properties moduleName=Something::Deep -o samples/client/petstore/perl/deep_module_test diff --git a/bin/perl-petstore.sh b/bin/perl-petstore.sh index 36ac10a4ddd6..48974454b731 100755 --- a/bin/perl-petstore.sh +++ b/bin/perl-petstore.sh @@ -28,6 +28,6 @@ fi # if you've executed sbt assembly previously it will use that instead. export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties" # complex module name used for testing -ags="generate -i modules/openapi-generator/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml -g perl -o samples/client/petstore/perl -DhideGenerationTimestamp=true $@" +ags="generate -i modules/openapi-generator/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml -g perl -o samples/client/petstore/perl --additional-properties hideGenerationTimestamp=true $@" java $JAVA_OPTS -jar $executable $ags diff --git a/bin/python-asyncio-petstore.sh b/bin/python-asyncio-petstore.sh index b551a8d43454..4219e51927ef 100755 --- a/bin/python-asyncio-petstore.sh +++ b/bin/python-asyncio-petstore.sh @@ -27,6 +27,6 @@ fi # if you've executed sbt assembly previously it will use that instead. export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties" -ags="generate -t modules/openapi-generator/src/main/resources/python -i modules/openapi-generator/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml -g python -o samples/client/petstore/python-asyncio -DpackageName=petstore_api --library asyncio $@" +ags="generate -t modules/openapi-generator/src/main/resources/python -i modules/openapi-generator/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml -g python -o samples/client/petstore/python-asyncio --additional-properties packageName=petstore_api --library asyncio $@" java $JAVA_OPTS -jar $executable $ags diff --git a/bin/python-petstore.sh b/bin/python-petstore.sh index 96f67e76586d..651fda1e721f 100755 --- a/bin/python-petstore.sh +++ b/bin/python-petstore.sh @@ -27,6 +27,6 @@ fi # if you've executed sbt assembly previously it will use that instead. export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties" -ags="generate -t modules/openapi-generator/src/main/resources/python -i modules/openapi-generator/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml -g python -o samples/client/petstore/python -DpackageName=petstore_api $@" +ags="generate -t modules/openapi-generator/src/main/resources/python -i modules/openapi-generator/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml -g python -o samples/client/petstore/python --additional-properties packageName=petstore_api $@" java $JAVA_OPTS -jar $executable $ags diff --git a/bin/python-server-aiohttp-petstore.sh b/bin/python-server-aiohttp-petstore.sh index 38aae23d5f3c..f5cc9bc711b6 100755 --- a/bin/python-server-aiohttp-petstore.sh +++ b/bin/python-server-aiohttp-petstore.sh @@ -31,8 +31,8 @@ out_folder=samples/server/petstore/$generator resources=modules/openapi-generator/src/main/resources/$generator # if you've executed sbt assembly previously it will use that instead. -export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties" -ags="generate -t $resources -i $input -g $generator -o $out_folder -Dservice $@" +export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties -Dservice" +ags="generate -t $resources -i $input -g $generator -o $out_folder $@" rm -rf $out_folder/.openapi* rm -rf $out_folder/openapi_server diff --git a/bin/python-server-blueplanet-petstore.sh b/bin/python-server-blueplanet-petstore.sh index ece725e1c1b0..074c53f8788d 100755 --- a/bin/python-server-blueplanet-petstore.sh +++ b/bin/python-server-blueplanet-petstore.sh @@ -31,8 +31,8 @@ out_folder=samples/server/petstore/$generator resources=modules/openapi-generator/src/main/resources/$generator # if you've executed sbt assembly previously it will use that instead. -export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties" -ags="generate -t $resources -i $input -g $generator -o $out_folder -Dservice $@" +export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties -Dservice" +ags="generate -t $resources -i $input -g $generator -o $out_folder $@" rm -rf $out_folder/.openapi* rm -rf $out_folder/openapi_server diff --git a/bin/python-server-flask-petstore-python2.sh b/bin/python-server-flask-petstore-python2.sh index debbb458a153..f720fd5d4f48 100755 --- a/bin/python-server-flask-petstore-python2.sh +++ b/bin/python-server-flask-petstore-python2.sh @@ -30,9 +30,8 @@ input=modules/openapi-generator/src/test/resources/2_0/petstore.yaml out_folder=samples/server/petstore/$generator-python2 resources=modules/openapi-generator/src/main/resources/$generator -# if you've executed sbt assembly previously it will use that instead. export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties" -ags="generate -t $resources -i $input -g $generator -o $out_folder -c bin/supportPython2.json -D service $@" +ags="generate -t $resources -i $input -g $generator -o $out_folder -c bin/supportPython2.json $@" rm -rf $out_folder/.openapi* rm -rf $out_folder/openapi_server diff --git a/bin/python-server-flask-petstore.sh b/bin/python-server-flask-petstore.sh index 915aacd540ab..eead0ce0d4fc 100755 --- a/bin/python-server-flask-petstore.sh +++ b/bin/python-server-flask-petstore.sh @@ -31,8 +31,8 @@ out_folder=samples/server/petstore/$generator resources=modules/openapi-generator/src/main/resources/$generator # if you've executed sbt assembly previously it will use that instead. -export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties" -ags="generate -t $resources -i $input -g $generator -o $out_folder -Dservice $@" +export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties -Dservice" +ags="generate -t $resources -i $input -g $generator -o $out_folder $@" rm -rf $out_folder/.openapi* rm -rf $out_folder/openapi_server diff --git a/bin/python-tornado-petstore.sh b/bin/python-tornado-petstore.sh index 5ee9e2cc8bd9..1d51e798fe92 100755 --- a/bin/python-tornado-petstore.sh +++ b/bin/python-tornado-petstore.sh @@ -27,6 +27,6 @@ fi # if you've executed sbt assembly previously it will use that instead. export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties" -ags="generate -t modules/openapi-generator/src/main/resources/python -i modules/openapi-generator/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml -g python -o samples/client/petstore/python-tornado -DpackageName=petstore_api --library tornado $@" +ags="generate -t modules/openapi-generator/src/main/resources/python -i modules/openapi-generator/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml -g python -o samples/client/petstore/python-tornado --additional-properties packageName=petstore_api --library tornado $@" java $JAVA_OPTS -jar $executable $ags diff --git a/bin/r-petstore.sh b/bin/r-petstore.sh index ac9d2427b6a3..4decf28f72f0 100755 --- a/bin/r-petstore.sh +++ b/bin/r-petstore.sh @@ -27,6 +27,6 @@ fi # if you've executed sbt assembly previously it will use that instead. export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties" -ags="generate -t modules/openapi-generator/src/main/resources/r -i modules/openapi-generator/src/test/resources/2_0/petstore.yaml -g r -o samples/client/petstore/R -DpackageName=petstore $@" +ags="generate -t modules/openapi-generator/src/main/resources/r -i modules/openapi-generator/src/test/resources/2_0/petstore.yaml -g r -o samples/client/petstore/R --additional-properties packageName=petstore $@" java $JAVA_OPTS -jar $executable $ags diff --git a/bin/rust-petstore.sh b/bin/rust-petstore.sh index b58d3de7dd67..f80029512085 100755 --- a/bin/rust-petstore.sh +++ b/bin/rust-petstore.sh @@ -27,6 +27,6 @@ fi # if you've executed sbt assembly previously it will use that instead. export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties" -ags="generate -t modules/openapi-generator/src/main/resources/rust -i modules/openapi-generator/src/test/resources/2_0/petstore.yaml -g rust -o samples/client/petstore/rust -DpackageName=petstore_client --library=hyper $@" +ags="generate -t modules/openapi-generator/src/main/resources/rust -i modules/openapi-generator/src/test/resources/2_0/petstore.yaml -g rust -o samples/client/petstore/rust --additional-properties packageName=petstore_client --library=hyper $@" java ${JAVA_OPTS} -jar ${executable} ${ags} diff --git a/bin/rust-reqwest-petstore.sh b/bin/rust-reqwest-petstore.sh index 054a757c5fa3..7a5fc8d8cdd7 100755 --- a/bin/rust-reqwest-petstore.sh +++ b/bin/rust-reqwest-petstore.sh @@ -27,6 +27,6 @@ fi # if you've executed sbt assembly previously it will use that instead. export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties" -ags="generate -t modules/openapi-generator/src/main/resources/rust -i modules/openapi-generator/src/test/resources/2_0/petstore.yaml -g rust -o samples/client/petstore/rust-reqwest -DpackageName=petstore_client --library=reqwest $@" +ags="generate -t modules/openapi-generator/src/main/resources/rust -i modules/openapi-generator/src/test/resources/2_0/petstore.yaml -g rust -o samples/client/petstore/rust-reqwest --additional-properties packageName=petstore_client --library=reqwest $@" java ${JAVA_OPTS} -jar ${executable} ${ags} diff --git a/bin/rust-server-petstore.sh b/bin/rust-server-petstore.sh index 5aa1344766cd..e0a459d59e72 100755 --- a/bin/rust-server-petstore.sh +++ b/bin/rust-server-petstore.sh @@ -32,7 +32,7 @@ for spec_path in modules/openapi-generator/src/test/resources/*/rust-server/* ; --input-spec $spec_path --generator-name rust-server --output samples/server/petstore/rust-server/output/$spec - -DpackageName=$spec + --additional-properties packageName=$spec --additional-properties hideGenerationTimestamp=true --generate-alias-as-model $@" diff --git a/bin/spring-cloud-feign-petstore.sh b/bin/spring-cloud-feign-petstore.sh index 2c0c758e8069..2dfef88064f7 100755 --- a/bin/spring-cloud-feign-petstore.sh +++ b/bin/spring-cloud-feign-petstore.sh @@ -27,7 +27,7 @@ fi # if you've executed sbt assembly previously it will use that instead. export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties" -ags="generate -t modules/openapi-generator/src/main/resources/JavaSpring/libraries/spring-cloud -i modules/openapi-generator/src/test/resources/2_0/petstore.yaml -g spring -c bin/spring-cloud-feign-petstore.json -o samples/client/petstore/spring-cloud -DhideGenerationTimestamp=true,responseWrapper=HystrixCommand $@" +ags="generate -t modules/openapi-generator/src/main/resources/JavaSpring/libraries/spring-cloud -i modules/openapi-generator/src/test/resources/2_0/petstore.yaml -g spring -c bin/spring-cloud-feign-petstore.json -o samples/client/petstore/spring-cloud --additional-properties hideGenerationTimestamp=true,responseWrapper=HystrixCommand $@" echo "Removing files and folders under samples/client/petstore/spring-cloud/src/main" rm -rf samples/client/petstore/spring-cloud/src/main diff --git a/bin/spring-delegate-j8.sh b/bin/spring-delegate-j8.sh index 56146e282ba3..df75a5d169bd 100755 --- a/bin/spring-delegate-j8.sh +++ b/bin/spring-delegate-j8.sh @@ -27,7 +27,7 @@ fi # if you've executed sbt assembly previously it will use that instead. export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties" -ags="generate --artifact-id springboot-delegate-j8 -t modules/openapi-generator/src/main/resources/JavaSpring -i modules/openapi-generator/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml -g spring -o samples/server/petstore/springboot-delegate-j8 -DdelegatePattern=true,hideGenerationTimestamp=true $@" +ags="generate --artifact-id springboot-delegate-j8 -t modules/openapi-generator/src/main/resources/JavaSpring -i modules/openapi-generator/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml -g spring -o samples/server/petstore/springboot-delegate-j8 --additional-properties delegatePattern=true,hideGenerationTimestamp=true $@" echo "Removing files and folders under samples/server/petstore/springboot-delegate-j8/src/main" rm -rf samples/server/petstore/springboot-delegate-j8/src/main diff --git a/bin/spring-delegate.sh b/bin/spring-delegate.sh index 4cf133072c2a..2404c24cedcc 100755 --- a/bin/spring-delegate.sh +++ b/bin/spring-delegate.sh @@ -27,7 +27,7 @@ fi # if you've executed sbt assembly previously it will use that instead. export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties" -ags="generate --artifact-id springboot-delegate -t modules/openapi-generator/src/main/resources/JavaSpring -i modules/openapi-generator/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml -g spring -o samples/server/petstore/springboot-delegate -DdelegatePattern=true,hideGenerationTimestamp=true,java8=false $@" +ags="generate --artifact-id springboot-delegate -t modules/openapi-generator/src/main/resources/JavaSpring -i modules/openapi-generator/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml -g spring -o samples/server/petstore/springboot-delegate --additional-properties delegatePattern=true,hideGenerationTimestamp=true,java8=false $@" echo "Removing files and folders under samples/server/petstore/springboot-delegate/src/main" rm -rf samples/server/petstore/springboot-delegate/src/main diff --git a/bin/spring-mvc-petstore-j8-async-server.sh b/bin/spring-mvc-petstore-j8-async-server.sh index e55cfe647a42..fdbb35d4b415 100755 --- a/bin/spring-mvc-petstore-j8-async-server.sh +++ b/bin/spring-mvc-petstore-j8-async-server.sh @@ -27,6 +27,6 @@ fi # if you've executed sbt assembly previously it will use that instead. export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties" -ags="generate -t modules/openapi-generator/src/main/resources/JavaSpring -i modules/openapi-generator/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml -g spring -o samples/server/petstore/spring-mvc-j8-async -c bin/spring-mvc-petstore-j8-async.json -DhideGenerationTimestamp=true,async=true --additional-properties serverPort=8002 $@" +ags="generate -t modules/openapi-generator/src/main/resources/JavaSpring -i modules/openapi-generator/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml -g spring -o samples/server/petstore/spring-mvc-j8-async -c bin/spring-mvc-petstore-j8-async.json --additional-properties hideGenerationTimestamp=true,async=true --additional-properties serverPort=8002 $@" java $JAVA_OPTS -jar $executable $ags diff --git a/bin/spring-mvc-petstore-j8-localdatetime.sh b/bin/spring-mvc-petstore-j8-localdatetime.sh index e5a32b7dc7a6..ae3b16177af7 100755 --- a/bin/spring-mvc-petstore-j8-localdatetime.sh +++ b/bin/spring-mvc-petstore-j8-localdatetime.sh @@ -27,6 +27,6 @@ fi # if you've executed sbt assembly previously it will use that instead. export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties" -ags="generate -t modules/openapi-generator/src/main/resources/JavaSpring -i modules/openapi-generator/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml -g spring -c bin/spring-mvc-petstore-j8-localdatetime.json -o samples/server/petstore/spring-mvc-j8-localdatetime -DhideGenerationTimestamp=true -DbooleanGetterPrefix=get --additional-properties serverPort=8002 $@" +ags="generate -t modules/openapi-generator/src/main/resources/JavaSpring -i modules/openapi-generator/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml -g spring -c bin/spring-mvc-petstore-j8-localdatetime.json -o samples/server/petstore/spring-mvc-j8-localdatetime --additional-properties hideGenerationTimestamp=true,booleanGetterPrefix=get,serverPort=8002 $@" java $JAVA_OPTS -jar $executable $ags diff --git a/bin/spring-mvc-petstore-server.sh b/bin/spring-mvc-petstore-server.sh index 71e6d73fac3b..ddbb1b4d64f4 100755 --- a/bin/spring-mvc-petstore-server.sh +++ b/bin/spring-mvc-petstore-server.sh @@ -27,6 +27,6 @@ fi # if you've executed sbt assembly previously it will use that instead. export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties" -ags="generate -t modules/openapi-generator/src/main/resources/JavaSpring -i modules/openapi-generator/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml -g spring -c bin/spring-mvc-petstore-server.json -o samples/server/petstore/spring-mvc -DhideGenerationTimestamp=true,java8=false --additional-properties serverPort=8002 --additional-properties booleanGetterPrefix=get $@" +ags="generate -t modules/openapi-generator/src/main/resources/JavaSpring -i modules/openapi-generator/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml -g spring -c bin/spring-mvc-petstore-server.json -o samples/server/petstore/spring-mvc --additional-properties hideGenerationTimestamp=true,java8=false --additional-properties serverPort=8002 --additional-properties booleanGetterPrefix=get $@" java $JAVA_OPTS -jar $executable $ags diff --git a/bin/spring-stubs.sh b/bin/spring-stubs.sh index 1586459d3aad..79edfa1820e2 100755 --- a/bin/spring-stubs.sh +++ b/bin/spring-stubs.sh @@ -27,6 +27,6 @@ fi # if you've executed sbt assembly previously it will use that instead. export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties" -ags="generate --artifact-id spring-stubs -i modules/openapi-generator/src/test/resources/2_0/petstore.yaml -g spring -o samples/client/petstore/spring-stubs -DinterfaceOnly=true,singleContentTypes=true,hideGenerationTimestamp=true $@" +ags="generate --artifact-id spring-stubs -i modules/openapi-generator/src/test/resources/2_0/petstore.yaml -g spring -o samples/client/petstore/spring-stubs --additional-properties interfaceOnly=true,singleContentTypes=true,hideGenerationTimestamp=true $@" java $JAVA_OPTS -jar $executable $ags diff --git a/bin/springboot-petstore-server-beanvalidation.sh b/bin/springboot-petstore-server-beanvalidation.sh index 18f232ef6bd6..33b1fdce58b3 100755 --- a/bin/springboot-petstore-server-beanvalidation.sh +++ b/bin/springboot-petstore-server-beanvalidation.sh @@ -27,7 +27,7 @@ fi # if you've executed sbt assembly previously it will use that instead. export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties" -ags="generate -t modules/openapi-generator/src/main/resources/JavaSpring -i modules/openapi-generator/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml -g spring -o samples/server/petstore/springboot-beanvalidation -c bin/springboot-petstore-server-beanvalidation.json -DhideGenerationTimestamp=true,java8=false $@" +ags="generate -t modules/openapi-generator/src/main/resources/JavaSpring -i modules/openapi-generator/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml -g spring -o samples/server/petstore/springboot-beanvalidation -c bin/springboot-petstore-server-beanvalidation.json --additional-properties hideGenerationTimestamp=true,java8=false $@" echo "Removing files and folders under samples/server/petstore/springboot-beanvalidation/src/main" rm -rf samples/server/petstore/springboot-beanvalidation/src/main diff --git a/bin/springboot-petstore-server-implicitHeaders.sh b/bin/springboot-petstore-server-implicitHeaders.sh index 8c56ade82ce2..277c57fcbddf 100755 --- a/bin/springboot-petstore-server-implicitHeaders.sh +++ b/bin/springboot-petstore-server-implicitHeaders.sh @@ -27,7 +27,7 @@ fi # if you've executed sbt assembly previously it will use that instead. export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties" -ags="generate --artifact-id springboot-implicitHeaders -t modules/openapi-generator/src/main/resources/JavaSpring -i modules/openapi-generator/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml -g spring -c bin/springboot-petstore-server-implicitHeaders.json -o samples/server/petstore/springboot-implicitHeaders -DhideGenerationTimestamp=true $@" +ags="generate --artifact-id springboot-implicitHeaders -t modules/openapi-generator/src/main/resources/JavaSpring -i modules/openapi-generator/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml -g spring -c bin/springboot-petstore-server-implicitHeaders.json -o samples/server/petstore/springboot-implicitHeaders --additional-properties hideGenerationTimestamp=true $@" echo "Removing files and folders under samples/server/petstore/springboot-implicitHeaders/src/main" rm -rf samples/server/petstore/springboot-implicitHeaders/src/main diff --git a/bin/springboot-petstore-server-reactive.sh b/bin/springboot-petstore-server-reactive.sh index 9938be6aba57..6cc531e66e2c 100755 --- a/bin/springboot-petstore-server-reactive.sh +++ b/bin/springboot-petstore-server-reactive.sh @@ -26,7 +26,7 @@ fi # if you've executed sbt assembly previously it will use that instead. export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties" -ags="generate --artifact-id springboot-reactive -t modules/openapi-generator/src/main/resources/JavaSpring -i modules/openapi-generator/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml -g spring -o samples/server/petstore/springboot-reactive -Dreactive=true,delegatePattern=true,hideGenerationTimestamp=true $@" +ags="generate --artifact-id springboot-reactive -t modules/openapi-generator/src/main/resources/JavaSpring -i modules/openapi-generator/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml -g spring -o samples/server/petstore/springboot-reactive --additional-properties reactive=true,delegatePattern=true,hideGenerationTimestamp=true $@" echo "Removing files and folders under samples/server/petstore/springboot-reactive/src/main" rm -rf samples/server/petstore/springboot-reactive/src/main diff --git a/bin/springboot-petstore-server-useOptional.sh b/bin/springboot-petstore-server-useOptional.sh index 35336dce7523..029f923862ac 100755 --- a/bin/springboot-petstore-server-useOptional.sh +++ b/bin/springboot-petstore-server-useOptional.sh @@ -27,7 +27,7 @@ fi # if you've executed sbt assembly previously it will use that instead. export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties" -ags="generate -t modules/openapi-generator/src/main/resources/JavaSpring -i modules/openapi-generator/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml -g spring -c bin/springboot-petstore-server-useOptional.json -o samples/server/petstore/springboot-useoptional -DhideGenerationTimestamp=true $@" +ags="generate -t modules/openapi-generator/src/main/resources/JavaSpring -i modules/openapi-generator/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml -g spring -c bin/springboot-petstore-server-useOptional.json -o samples/server/petstore/springboot-useoptional --additional-properties hideGenerationTimestamp=true $@" echo "Removing files and folders under samples/server/petstore/springboot-useoptional/src/main" rm -rf samples/server/petstore/springboot-useoptional/src/main diff --git a/bin/springboot-petstore-server.sh b/bin/springboot-petstore-server.sh index 725ac3890077..9b34934163d4 100755 --- a/bin/springboot-petstore-server.sh +++ b/bin/springboot-petstore-server.sh @@ -27,7 +27,7 @@ fi # if you've executed sbt assembly previously it will use that instead. export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties" -ags="generate --artifact-id springboot -t modules/openapi-generator/src/main/resources/JavaSpring -i modules/openapi-generator/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml -g spring -o samples/server/petstore/springboot -DhideGenerationTimestamp=true $@" +ags="generate --artifact-id springboot -t modules/openapi-generator/src/main/resources/JavaSpring -i modules/openapi-generator/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml -g spring -o samples/server/petstore/springboot --additional-properties hideGenerationTimestamp=true $@" echo "Removing files and folders under samples/server/petstore/springboot/src/main" rm -rf samples/server/petstore/springboot/src/main diff --git a/bin/springboot-virtualan-petstore-server.sh b/bin/springboot-virtualan-petstore-server.sh index a55eea9fafb9..a8471cf19984 100755 --- a/bin/springboot-virtualan-petstore-server.sh +++ b/bin/springboot-virtualan-petstore-server.sh @@ -27,7 +27,7 @@ fi # if you've executed sbt assembly previously it will use that instead. export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties" -ags="generate --artifact-id springboot-virtualan -t modules/openapi-generator/src/main/resources/JavaSpring -i modules/openapi-generator/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml -g spring -o samples/server/petstore/springboot-virtualan -c bin/springboot-virtualan-petstore-server.json -DhideGenerationTimestamp=true $@" +ags="generate --artifact-id springboot-virtualan -t modules/openapi-generator/src/main/resources/JavaSpring -i modules/openapi-generator/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml -g spring -o samples/server/petstore/springboot-virtualan -c bin/springboot-virtualan-petstore-server.json --additional-properties hideGenerationTimestamp=true $@" echo "Removing files and folders under samples/server/petstore/springboot-virtualan/src/main" rm -rf samples/server/petstore/springboot-virtualan/src/main diff --git a/bin/tests/test-debug-supporting-files.sh b/bin/tests/test-debug-supporting-files.sh index 3d6a2e86967c..cd130225b4ab 100755 --- a/bin/tests/test-debug-supporting-files.sh +++ b/bin/tests/test-debug-supporting-files.sh @@ -26,8 +26,8 @@ then fi # if you've executed sbt assembly previously it will use that instead. -export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties" -ags="generate -t modules/openapi-generator/src/main/resources/python -i modules/openapi-generator/src/test/resources/3_0/issue_241.yaml -g python -o /tmp/test-debug-supporting-files/ -DpackageName=petstore_api -DdebugSupportingFiles=true $@" +export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties -DdebugSupportingFiles=true" +ags="generate -t modules/openapi-generator/src/main/resources/python -i modules/openapi-generator/src/test/resources/3_0/issue_241.yaml -g python -o /tmp/test-debug-supporting-files/ --additional-properties packageName=petstore_api $@" if [[ $(java $JAVA_OPTS -jar $executable $ags 2>&1 | grep "StackOverflowError") ]]; then echo "There are StackOverflowError. Please check the result." diff --git a/bin/typescript-angular-v2-petstore-interfaces.sh b/bin/typescript-angular-v2-petstore-interfaces.sh index 6db2f6e11d69..18f638f4dfe9 100755 --- a/bin/typescript-angular-v2-petstore-interfaces.sh +++ b/bin/typescript-angular-v2-petstore-interfaces.sh @@ -27,6 +27,6 @@ fi # if you've executed sbt assembly previously it will use that instead. export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties" -ags="generate -i modules/openapi-generator/src/test/resources/2_0/petstore.yaml -g typescript-angular -o samples/client/petstore/typescript-angular-v2/with-interfaces -D withInterfaces=true --additional-properties ngVersion=2 $@" +ags="generate -i modules/openapi-generator/src/test/resources/2_0/petstore.yaml -g typescript-angular -o samples/client/petstore/typescript-angular-v2/with-interfaces --additional-properties ngVersion=2,withInterfaces=true $@" java $JAVA_OPTS -jar $executable $ags diff --git a/bin/typescript-angular-v6-petstore-not-provided-in-root-with-npm.sh b/bin/typescript-angular-v6-petstore-not-provided-in-root-with-npm.sh index 082f197a716c..981e55dbc28a 100755 --- a/bin/typescript-angular-v6-petstore-not-provided-in-root-with-npm.sh +++ b/bin/typescript-angular-v6-petstore-not-provided-in-root-with-npm.sh @@ -27,6 +27,6 @@ fi # if you've executed sbt assembly previously it will use that instead. export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties" -ags="generate -i modules/openapi-generator/src/test/resources/2_0/petstore.yaml -g typescript-angular -c bin/typescript-angular-v6-petstore-not-provided-in-root-with-npm.json -o samples/client/petstore/typescript-angular-v6-not-provided-in-root/builds/with-npm -D providedInRoot=false --additional-properties ngVersion=6.0.0 $@" +ags="generate -i modules/openapi-generator/src/test/resources/2_0/petstore.yaml -g typescript-angular -c bin/typescript-angular-v6-petstore-not-provided-in-root-with-npm.json -o samples/client/petstore/typescript-angular-v6-not-provided-in-root/builds/with-npm --additional-properties ngVersion=6.0.0,providedInRoot=false $@" java $JAVA_OPTS -jar $executable $ags diff --git a/bin/typescript-angular-v6-petstore-not-provided-in-root.sh b/bin/typescript-angular-v6-petstore-not-provided-in-root.sh index deddf8d536f7..f00826e050f7 100755 --- a/bin/typescript-angular-v6-petstore-not-provided-in-root.sh +++ b/bin/typescript-angular-v6-petstore-not-provided-in-root.sh @@ -27,6 +27,6 @@ fi # if you've executed sbt assembly previously it will use that instead. export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties" -ags="generate -i modules/openapi-generator/src/test/resources/2_0/petstore.yaml -g typescript-angular -o samples/client/petstore/typescript-angular-v6-not-provided-in-root/builds/default -D providedInRoot=false --additional-properties ngVersion=6.0.0 $@" +ags="generate -i modules/openapi-generator/src/test/resources/2_0/petstore.yaml -g typescript-angular -o samples/client/petstore/typescript-angular-v6-not-provided-in-root/builds/default --additional-properties ngVersion=6.0.0,providedInRoot=false $@" java $JAVA_OPTS -jar $executable $ags diff --git a/bin/typescript-angular-v7-petstore-not-provided-in-root-with-npm.sh b/bin/typescript-angular-v7-petstore-not-provided-in-root-with-npm.sh index 4cb66477ee89..f74cb16b02a8 100755 --- a/bin/typescript-angular-v7-petstore-not-provided-in-root-with-npm.sh +++ b/bin/typescript-angular-v7-petstore-not-provided-in-root-with-npm.sh @@ -27,6 +27,6 @@ fi # if you've executed sbt assembly previously it will use that instead. export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties" -ags="generate -i modules/openapi-generator/src/test/resources/2_0/petstore.yaml -g typescript-angular -c bin/typescript-angular-v7-petstore-not-provided-in-root-with-npm.json -o samples/client/petstore/typescript-angular-v7-not-provided-in-root/builds/with-npm -D providedInRoot=false --additional-properties ngVersion=7.0.0 $@" +ags="generate -i modules/openapi-generator/src/test/resources/2_0/petstore.yaml -g typescript-angular -c bin/typescript-angular-v7-petstore-not-provided-in-root-with-npm.json -o samples/client/petstore/typescript-angular-v7-not-provided-in-root/builds/with-npm --additional-properties ngVersion=7.0.0,providedInRoot=false $@" java $JAVA_OPTS -jar $executable $ags diff --git a/bin/typescript-angular-v7-petstore-not-provided-in-root.sh b/bin/typescript-angular-v7-petstore-not-provided-in-root.sh index d790a67c67b4..46eb22cbc4d8 100755 --- a/bin/typescript-angular-v7-petstore-not-provided-in-root.sh +++ b/bin/typescript-angular-v7-petstore-not-provided-in-root.sh @@ -27,6 +27,6 @@ fi # if you've executed sbt assembly previously it will use that instead. export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties" -ags="generate -i modules/openapi-generator/src/test/resources/2_0/petstore.yaml -g typescript-angular -o samples/client/petstore/typescript-angular-v7-not-provided-in-root/builds/default -D providedInRoot=false --additional-properties ngVersion=7.0.0 $@" +ags="generate -i modules/openapi-generator/src/test/resources/2_0/petstore.yaml -g typescript-angular -o samples/client/petstore/typescript-angular-v7-not-provided-in-root/builds/default --additional-properties ngVersion=7.0.0,providedInRoot=false $@" java $JAVA_OPTS -jar $executable $ags diff --git a/bin/typescript-axios-petstore-interfaces.sh b/bin/typescript-axios-petstore-interfaces.sh index 6ba5985126ae..84a65e0aba3b 100755 --- a/bin/typescript-axios-petstore-interfaces.sh +++ b/bin/typescript-axios-petstore-interfaces.sh @@ -27,6 +27,6 @@ fi # if you've executed sbt assembly previously it will use that instead. export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties" -ags="generate -i modules/openapi-generator/src/test/resources/2_0/petstore.yaml -g typescript-axios -o samples/client/petstore/typescript-axios/builds/with-interfaces -D withInterfaces=true $@" +ags="generate -i modules/openapi-generator/src/test/resources/2_0/petstore.yaml -g typescript-axios -o samples/client/petstore/typescript-axios/builds/with-interfaces --additional-properties withInterfaces=true $@" java $JAVA_OPTS -jar $executable $ags diff --git a/bin/typescript-fetch-petstore-interfaces.sh b/bin/typescript-fetch-petstore-interfaces.sh index 58a9137820d4..412d778b4f9c 100755 --- a/bin/typescript-fetch-petstore-interfaces.sh +++ b/bin/typescript-fetch-petstore-interfaces.sh @@ -27,6 +27,6 @@ fi # if you've executed sbt assembly previously it will use that instead. export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties" -ags="generate -i modules/openapi-generator/src/test/resources/2_0/petstore.yaml -g typescript-fetch -o samples/client/petstore/typescript-fetch/builds/with-interfaces -D withInterfaces=true $@" +ags="generate -i modules/openapi-generator/src/test/resources/2_0/petstore.yaml -g typescript-fetch -o samples/client/petstore/typescript-fetch/builds/with-interfaces --additional-properties withInterfaces=true $@" java $JAVA_OPTS -jar $executable $ags diff --git a/bin/typescript-rxjs-petstore-interfaces.sh b/bin/typescript-rxjs-petstore-interfaces.sh index 92f6e8f328e6..c7b52aca5265 100755 --- a/bin/typescript-rxjs-petstore-interfaces.sh +++ b/bin/typescript-rxjs-petstore-interfaces.sh @@ -27,6 +27,6 @@ fi # if you've executed sbt assembly previously it will use that instead. export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties" -ags="generate -i modules/openapi-generator/src/test/resources/2_0/petstore.yaml -g typescript-rxjs -o samples/client/petstore/typescript-rxjs/builds/with-interfaces -D withInterfaces=true $@" +ags="generate -i modules/openapi-generator/src/test/resources/2_0/petstore.yaml -g typescript-rxjs -o samples/client/petstore/typescript-rxjs/builds/with-interfaces --additional-properties withInterfaces=true $@" java $JAVA_OPTS -jar $executable $ags diff --git a/bin/windows/dart-client-petstore.bat b/bin/windows/dart-client-petstore.bat index 18ebdb6fc405..ad44ce96c330 100755 --- a/bin/windows/dart-client-petstore.bat +++ b/bin/windows/dart-client-petstore.bat @@ -5,8 +5,8 @@ If Not Exist %executable% ( ) REM set JAVA_OPTS=%JAVA_OPTS% -Xmx1024M -DloggerPath=conf/log4j.properties -set ags=generate -i modules\swagger-codegen\src\test\resources\2_0\petstore.yaml -g dart-jaguar -o samples\client\petstore\dart-jaguar\swagger -DhideGenerationTimestamp=true -DbrowserClient=false +set ags=generate -i modules\swagger-codegen\src\test\resources\2_0\petstore.yaml -g dart-jaguar -o samples\client\petstore\dart-jaguar\swagger --additional-properties hideGenerationTimestamp=true,browserClient=false java %JAVA_OPTS% -jar %executable% %ags% -set ags=generate -i modules\swagger-codegen\src\test\resources\2_0\petstore.yaml -g dart-jaguar -o samples\client\petstore\dart-jaguar\flutter_petstore\swagger -DhideGenerationTimestamp=true +set ags=generate -i modules\swagger-codegen\src\test\resources\2_0\petstore.yaml -g dart-jaguar -o samples\client\petstore\dart-jaguar\flutter_petstore\swagger --additional-properties hideGenerationTimestamp=true java %JAVA_OPTS% -jar %executable% %ags% diff --git a/bin/windows/dart-petstore.bat b/bin/windows/dart-petstore.bat index d35039c148f4..155911529f68 100755 --- a/bin/windows/dart-petstore.bat +++ b/bin/windows/dart-petstore.bat @@ -5,11 +5,11 @@ If Not Exist %executable% ( ) REM set JAVA_OPTS=%JAVA_OPTS% -Xmx1024M -DloggerPath=conf/log4j.properties -set ags=generate -i modules\openapi-generator\src\test\resources\2_0\petstore.yaml -g dart -o samples\client\petstore\dart\swagger -DhideGenerationTimestamp=true -DbrowserClient=false +set ags=generate -i modules\openapi-generator\src\test\resources\2_0\petstore.yaml -g dart -o samples\client\petstore\dart\swagger --additional-properties hideGenerationTimestamp=true,browserClient=false java %JAVA_OPTS% -jar %executable% %ags% -set ags=generate -i modules\openapi-generator\src\test\resources\2_0\petstore.yaml -g dart -o samples\client\petstore\dart\swagger-browser-client -DhideGenerationTimestamp=true -DbrowserClient=true +set ags=generate -i modules\openapi-generator\src\test\resources\2_0\petstore.yaml -g dart -o samples\client\petstore\dart\swagger-browser-client --additional-properties hideGenerationTimestamp=true,browserClient=true java %JAVA_OPTS% -jar %executable% %ags% -set ags=generate -i modules\openapi-generator\src\test\resources\2_0\petstore.yaml -g dart -o samples\client\petstore\dart\flutter_petstore\swagger -DhideGenerationTimestamp=true -DbrowserClient=false +set ags=generate -i modules\openapi-generator\src\test\resources\2_0\petstore.yaml -g dart -o samples\client\petstore\dart\flutter_petstore\swagger --additional-properties hideGenerationTimestamp=true,browserClient=false java %JAVA_OPTS% -jar %executable% %ags% diff --git a/bin/windows/go-gin-petstore-server.bat b/bin/windows/go-gin-petstore-server.bat index 05b75b17e2ed..f46a0482b22a 100644 --- a/bin/windows/go-gin-petstore-server.bat +++ b/bin/windows/go-gin-petstore-server.bat @@ -14,7 +14,7 @@ echo Removing files and folders under %STUB_DIR% del /F /S /Q %STUB_DIR% REM set JAVA_OPTS=%JAVA_OPTS% -Xmx1024M -DloggerPath=conf/log4j.properties -set ags=generate -i %SPEC% -g %GENERATOR% -o %STUB_DIR% -DpackageName=petstoreserver -Dservice +set ags=generate -i %SPEC% -g %GENERATOR% -o %STUB_DIR% --additional-properties packageName=petstoreserver java %JAVA_OPTS% -jar %executable% %ags% diff --git a/bin/windows/go-petstore-server.bat b/bin/windows/go-petstore-server.bat index bfa21fa0fcd1..c4eb17284aec 100644 --- a/bin/windows/go-petstore-server.bat +++ b/bin/windows/go-petstore-server.bat @@ -14,7 +14,7 @@ echo Removing files and folders under %STUB_DIR% del /F /S /Q %STUB_DIR% REM set JAVA_OPTS=%JAVA_OPTS% -Xmx1024M -DloggerPath=conf/log4j.properties -set ags=generate -i %SPEC% -g %GENERATOR% -o %STUB_DIR% -DpackageName=petstoreserver -Dservice +set ags=generate -i %SPEC% -g %GENERATOR% -o %STUB_DIR% --additional-properties packageName=petstoreserver java %JAVA_OPTS% -jar %executable% %ags% diff --git a/bin/windows/go-petstore-withxml.bat b/bin/windows/go-petstore-withxml.bat index 514a214041c2..e24f3798f8f9 100644 --- a/bin/windows/go-petstore-withxml.bat +++ b/bin/windows/go-petstore-withxml.bat @@ -14,7 +14,7 @@ echo Removing files and folders under %STUB_DIR% del /F /S /Q %STUB_DIR% REM set JAVA_OPTS=%JAVA_OPTS% -Xmx1024M -DloggerPath=conf/log4j.properties -set ags=generate -t modules\openapi-generator\src\main\resources\go -i %SPEC% -g %GENERATOR% -o %STUB_DIR% -DpackageName=petstore,withXml=true +set ags=generate -t modules\openapi-generator\src\main\resources\go -i %SPEC% -g %GENERATOR% -o %STUB_DIR% --additional-properties packageName=petstore,withXml=true java %JAVA_OPTS% -jar %executable% %ags% diff --git a/bin/windows/go-petstore.bat b/bin/windows/go-petstore.bat index c023f088d9b4..8f00f7070a17 100755 --- a/bin/windows/go-petstore.bat +++ b/bin/windows/go-petstore.bat @@ -14,7 +14,7 @@ echo Removing files and folders under %STUB_DIR% del /F /S /Q %STUB_DIR% REM set JAVA_OPTS=%JAVA_OPTS% -Xmx1024M -DloggerPath=conf/log4j.properties -set ags=generate -t modules\openapi-generator\src\main\resources\go -i %SPEC% -g %GENERATOR% -o %STUB_DIR% -DpackageName=petstore +set ags=generate -t modules\openapi-generator\src\main\resources\go -i %SPEC% -g %GENERATOR% -o %STUB_DIR% --additional-properties packageName=petstore java %JAVA_OPTS% -jar %executable% %ags% diff --git a/bin/windows/java-petstore-feign-10x.bat b/bin/windows/java-petstore-feign-10x.bat index af2f71f8729f..d9163fdac993 100644 --- a/bin/windows/java-petstore-feign-10x.bat +++ b/bin/windows/java-petstore-feign-10x.bat @@ -5,6 +5,6 @@ If Not Exist %executable% ( ) REM set JAVA_OPTS=%JAVA_OPTS% -Xmx1024M -set ags=generate -t modules\openapi-generator\src\main\resources\Java\libraries\feign -i modules\openapi-generator\src\test\resources\2_0\petstore-with-fake-endpoints-models-for-testing.yaml -g java -c bin\java-petstore-feign-10x.json -o samples\client\petstore\java\feign10x -DhideGenerationTimestamp=true -DbooleanGetterPrefix=is +set ags=generate -t modules\openapi-generator\src\main\resources\Java\libraries\feign -i modules\openapi-generator\src\test\resources\2_0\petstore-with-fake-endpoints-models-for-testing.yaml -g java -c bin\java-petstore-feign-10x.json -o samples\client\petstore\java\feign10x --additional-properties hideGenerationTimestamp=true,booleanGetterPrefix=is java %JAVA_OPTS% -jar %executable% %ags% diff --git a/bin/windows/java-petstore-feign.bat b/bin/windows/java-petstore-feign.bat index 41c817d33b67..e68e2d818f7b 100644 --- a/bin/windows/java-petstore-feign.bat +++ b/bin/windows/java-petstore-feign.bat @@ -5,6 +5,6 @@ If Not Exist %executable% ( ) REM set JAVA_OPTS=%JAVA_OPTS% -Xmx1024M -set ags=generate -t modules\openapi-generator\src\main\resources\Java\libraries\feign -i modules\openapi-generator\src\test\resources\2_0\petstore-with-fake-endpoints-models-for-testing.yaml -g java -c bin\java-petstore-feign-9x.json -o samples\client\petstore\java\feign -DhideGenerationTimestamp=true -DbooleanGetterPrefix=is +set ags=generate -t modules\openapi-generator\src\main\resources\Java\libraries\feign -i modules\openapi-generator\src\test\resources\2_0\petstore-with-fake-endpoints-models-for-testing.yaml -g java -c bin\java-petstore-feign-9x.json -o samples\client\petstore\java\feign --additional-properties hideGenerationTimestamp=true,booleanGetterPrefix=is java %JAVA_OPTS% -jar %executable% %ags% diff --git a/bin/windows/java-petstore-google-api-client.bat b/bin/windows/java-petstore-google-api-client.bat index 2b68ebd5814e..c9d2d761b663 100644 --- a/bin/windows/java-petstore-google-api-client.bat +++ b/bin/windows/java-petstore-google-api-client.bat @@ -5,6 +5,6 @@ If Not Exist %executable% ( ) REM set JAVA_OPTS=%JAVA_OPTS% -Xmx1024M -set ags=generate -t modules\openapi-generator\src\main\resources\Java\libraries\google-api-client -i modules\openapi-generator\src\test\resources\2_0\petstore-with-fake-endpoints-models-for-testing.yaml -g java -c bin\java-petstore-google-api-client.json -o samples\client\petstore\java\google-api-client -DhideGenerationTimestamp=true +set ags=generate -t modules\openapi-generator\src\main\resources\Java\libraries\google-api-client -i modules\openapi-generator\src\test\resources\2_0\petstore-with-fake-endpoints-models-for-testing.yaml -g java -c bin\java-petstore-google-api-client.json -o samples\client\petstore\java\google-api-client --additional-properties hideGenerationTimestamp=true java %JAVA_OPTS% -jar %executable% %ags% diff --git a/bin/windows/java-petstore-jersey1.bat b/bin/windows/java-petstore-jersey1.bat index c1908e329a53..a65093cce346 100644 --- a/bin/windows/java-petstore-jersey1.bat +++ b/bin/windows/java-petstore-jersey1.bat @@ -5,6 +5,6 @@ If Not Exist %executable% ( ) REM set JAVA_OPTS=%JAVA_OPTS% -Xmx1024M -set 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 -DhideGenerationTimestamp=true --library=jersey1 --additional-properties useNullForUnknownEnumValue=true +set 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 java %JAVA_OPTS% -jar %executable% %ags% diff --git a/bin/windows/java-petstore-jersey2-java6.bat b/bin/windows/java-petstore-jersey2-java6.bat index 9de22c9890c2..e41cf3964691 100644 --- a/bin/windows/java-petstore-jersey2-java6.bat +++ b/bin/windows/java-petstore-jersey2-java6.bat @@ -5,6 +5,6 @@ If Not Exist %executable% ( ) REM set JAVA_OPTS=%JAVA_OPTS% -Xmx1024M -set ags=generate --artifact-id petstore-jersey2-java6 -i modules\openapi-generator\src\test\resources\2_0\petstore-with-fake-endpoints-models-for-testing.yaml -g java -c bin\java-petstore-jersey2.json -o samples\client\petstore\java\jersey2-java6 -DhideGenerationTimestamp=true,supportJava6=true,booleanGetterPrefix=is +set ags=generate --artifact-id petstore-jersey2-java6 -i modules\openapi-generator\src\test\resources\2_0\petstore-with-fake-endpoints-models-for-testing.yaml -g java -c bin\java-petstore-jersey2.json -o samples\client\petstore\java\jersey2-java6 --additional-properties hideGenerationTimestamp=true,supportJava6=true,booleanGetterPrefix=is java %JAVA_OPTS% -jar %executable% %ags% diff --git a/bin/windows/java-petstore-jersey2.bat b/bin/windows/java-petstore-jersey2.bat index 8525d7b11fcc..f0f5ea9e2d5b 100644 --- a/bin/windows/java-petstore-jersey2.bat +++ b/bin/windows/java-petstore-jersey2.bat @@ -5,6 +5,6 @@ If Not Exist %executable% ( ) REM set JAVA_OPTS=%JAVA_OPTS% -Xmx1024M -set ags=generate -i modules\openapi-generator\src\test\resources\2_0\petstore-with-fake-endpoints-models-for-testing.yaml -g java -c bin\java-petstore-jersey2.json -o samples\client\petstore\java\jersey2 -DhideGenerationTimestamp=true +set ags=generate -i modules\openapi-generator\src\test\resources\2_0\petstore-with-fake-endpoints-models-for-testing.yaml -g java -c bin\java-petstore-jersey2.json -o samples\client\petstore\java\jersey2 --additional-properties hideGenerationTimestamp=true java %JAVA_OPTS% -jar %executable% %ags% diff --git a/bin/windows/java-petstore-okhttp-gson-parcelable.bat b/bin/windows/java-petstore-okhttp-gson-parcelable.bat index 1a5504314908..402a3cda7f95 100644 --- a/bin/windows/java-petstore-okhttp-gson-parcelable.bat +++ b/bin/windows/java-petstore-okhttp-gson-parcelable.bat @@ -5,6 +5,6 @@ If Not Exist %executable% ( ) REM set JAVA_OPTS=%JAVA_OPTS% -Xmx1024M -set ags=generate --artifact-id petstore-okhttp-gson-parcelableModel -t modules\openapi-generator\src\main\resources\Java\libraries\okhttp-gson -i modules\openapi-generator\src\test\resources\2_0\petstore-with-fake-endpoints-models-for-testing.yaml -g java -c bin\java-petstore-okhttp-gson.json -o samples\client\petstore\java\okhttp-gson-parcelableModel -DhideGenerationTimestamp=true,parcelableModel=true +set ags=generate --artifact-id petstore-okhttp-gson-parcelableModel -t modules\openapi-generator\src\main\resources\Java\libraries\okhttp-gson -i modules\openapi-generator\src\test\resources\2_0\petstore-with-fake-endpoints-models-for-testing.yaml -g java -c bin\java-petstore-okhttp-gson.json -o samples\client\petstore\java\okhttp-gson-parcelableModel --additional-properties hideGenerationTimestamp=true,parcelableModel=true java %JAVA_OPTS% -jar %executable% %ags% diff --git a/bin/windows/java-petstore-okhttp-gson.bat b/bin/windows/java-petstore-okhttp-gson.bat index 031d5ec813eb..80581ca14d44 100755 --- a/bin/windows/java-petstore-okhttp-gson.bat +++ b/bin/windows/java-petstore-okhttp-gson.bat @@ -5,6 +5,6 @@ If Not Exist %executable% ( ) REM set JAVA_OPTS=%JAVA_OPTS% -Xmx1024M -set ags=generate -t modules\openapi-generator\src\main\resources\Java\libraries\okhttp-gson -i modules\openapi-generator\src\test\resources\2_0\petstore-with-fake-endpoints-models-for-testing.yaml -g java -c bin\java-petstore-okhttp-gson.json -o samples\client\petstore\java\okhttp-gson -DhideGenerationTimestamp=true +set ags=generate -t modules\openapi-generator\src\main\resources\Java\libraries\okhttp-gson -i modules\openapi-generator\src\test\resources\2_0\petstore-with-fake-endpoints-models-for-testing.yaml -g java -c bin\java-petstore-okhttp-gson.json -o samples\client\petstore\java\okhttp-gson --additional-properties hideGenerationTimestamp=true java %JAVA_OPTS% -jar %executable% %ags% diff --git a/bin/windows/java-petstore-rest-assured.bat b/bin/windows/java-petstore-rest-assured.bat index b74f99b853ed..d7c05416262a 100644 --- a/bin/windows/java-petstore-rest-assured.bat +++ b/bin/windows/java-petstore-rest-assured.bat @@ -5,6 +5,6 @@ If Not Exist %executable% ( ) REM set JAVA_OPTS=%JAVA_OPTS% -Xmx1024M -set ags=generate -t modules\openapi-generator\src\main\resources\Java\libraries\rest-assured -i modules\openapi-generator\src\test\resources\2_0\petstore-with-fake-endpoints-models-for-testing.yaml -g java -c bin\java-petstore-rest-assured.json -o samples\client\petstore\java\rest-assured -DhideGenerationTimestamp=true --additional-properties booleanGetterPrefix=is +set ags=generate -t modules\openapi-generator\src\main\resources\Java\libraries\rest-assured -i modules\openapi-generator\src\test\resources\2_0\petstore-with-fake-endpoints-models-for-testing.yaml -g java -c bin\java-petstore-rest-assured.json -o samples\client\petstore\java\rest-assured --additional-properties hideGenerationTimestamp=true,booleanGetterPrefix=is java %JAVA_OPTS% -jar %executable% %ags% diff --git a/bin/windows/java-petstore-resttemplate-resteasy.bat b/bin/windows/java-petstore-resttemplate-resteasy.bat index 8ccda43717ba..9cf81f4e1098 100644 --- a/bin/windows/java-petstore-resttemplate-resteasy.bat +++ b/bin/windows/java-petstore-resttemplate-resteasy.bat @@ -5,6 +5,6 @@ If Not Exist %executable% ( ) REM set JAVA_OPTS=%JAVA_OPTS% -Xmx1024M -set ags=generate -i modules\openapi-generator\src\test\resources\2_0\petstore-with-fake-endpoints-models-for-testing.yaml -g java -c bin\java-petstore-resteasy.json -o samples\client\petstore\java\resteasy -DhideGenerationTimestamp=true +set ags=generate -i modules\openapi-generator\src\test\resources\2_0\petstore-with-fake-endpoints-models-for-testing.yaml -g java -c bin\java-petstore-resteasy.json -o samples\client\petstore\java\resteasy --additional-properties hideGenerationTimestamp=true java %JAVA_OPTS% -jar %executable% %ags% diff --git a/bin/windows/java-petstore-resttemplate-webclient.bat b/bin/windows/java-petstore-resttemplate-webclient.bat index 68ef1493f626..3330fc590abc 100644 --- a/bin/windows/java-petstore-resttemplate-webclient.bat +++ b/bin/windows/java-petstore-resttemplate-webclient.bat @@ -5,6 +5,6 @@ If Not Exist %executable% ( ) REM set JAVA_OPTS=%JAVA_OPTS% -Xmx1024M -set ags=generate -i modules\openapi-generator\src\test\resources\2_0\petstore-with-fake-endpoints-models-for-testing.yaml -g java -c bin\java-petstore-webclient.json -o samples\client\petstore\java\webclient -DhideGenerationTimestamp=true +set ags=generate -i modules\openapi-generator\src\test\resources\2_0\petstore-with-fake-endpoints-models-for-testing.yaml -g java -c bin\java-petstore-webclient.json -o samples\client\petstore\java\webclient --additional-properties hideGenerationTimestamp=true java %JAVA_OPTS% -jar %executable% %ags% diff --git a/bin/windows/java-petstore-resttemplate-withxml.bat b/bin/windows/java-petstore-resttemplate-withxml.bat index c99182b1fffe..ee67b4cd43f5 100644 --- a/bin/windows/java-petstore-resttemplate-withxml.bat +++ b/bin/windows/java-petstore-resttemplate-withxml.bat @@ -5,6 +5,6 @@ If Not Exist %executable% ( ) REM set JAVA_OPTS=%JAVA_OPTS% -Xmx1024M -set ags=generate --artifact-id petstore-resttemplate-withxml -i modules\openapi-generator\src\test\resources\2_0\petstore-with-fake-endpoints-models-for-testing.yaml -g java -c bin\java-petstore-resttemplate.json -o samples\client\petstore\java\resttemplate-withXml -DhideGenerationTimestamp=true,withXml=true +set ags=generate --artifact-id petstore-resttemplate-withxml -i modules\openapi-generator\src\test\resources\2_0\petstore-with-fake-endpoints-models-for-testing.yaml -g java -c bin\java-petstore-resttemplate.json -o samples\client\petstore\java\resttemplate-withXml --additional-properties hideGenerationTimestamp=true,withXml=true java %JAVA_OPTS% -jar %executable% %ags% diff --git a/bin/windows/java-petstore-resttemplate.bat b/bin/windows/java-petstore-resttemplate.bat index 76d1f7a21954..50de951c1293 100644 --- a/bin/windows/java-petstore-resttemplate.bat +++ b/bin/windows/java-petstore-resttemplate.bat @@ -5,6 +5,6 @@ If Not Exist %executable% ( ) REM set JAVA_OPTS=%JAVA_OPTS% -Xmx1024M -set ags=generate -i modules\openapi-generator\src\test\resources\2_0\petstore-with-fake-endpoints-models-for-testing.yaml -g java -c bin\java-petstore-resttemplate.json -o samples\client\petstore\java\resttemplate -DhideGenerationTimestamp=true +set ags=generate -i modules\openapi-generator\src\test\resources\2_0\petstore-with-fake-endpoints-models-for-testing.yaml -g java -c bin\java-petstore-resttemplate.json -o samples\client\petstore\java\resttemplate --additional-properties hideGenerationTimestamp=true java %JAVA_OPTS% -jar %executable% %ags% diff --git a/bin/windows/java-petstore-retrofit.bat b/bin/windows/java-petstore-retrofit.bat index 46b435a43f8f..970393a34e67 100644 --- a/bin/windows/java-petstore-retrofit.bat +++ b/bin/windows/java-petstore-retrofit.bat @@ -5,6 +5,6 @@ If Not Exist %executable% ( ) REM set JAVA_OPTS=%JAVA_OPTS% -Xmx1024M -set ags=generate -i modules\openapi-generator\src\test\resources\2_0\petstore-with-fake-endpoints-models-for-testing.yaml -g java -c bin\java-petstore-retrofit.json -o samples\client\petstore\java\retrofit -DhideGenerationTimestamp=true,dateLibrary=joda +set ags=generate -i modules\openapi-generator\src\test\resources\2_0\petstore-with-fake-endpoints-models-for-testing.yaml -g java -c bin\java-petstore-retrofit.json -o samples\client\petstore\java\retrofit --additional-properties hideGenerationTimestamp=true,dateLibrary=joda java %JAVA_OPTS% -jar %executable% %ags% diff --git a/bin/windows/java-petstore-retrofit2-play24.bat b/bin/windows/java-petstore-retrofit2-play24.bat index 3ebf62f5af51..bfb57e1bb6f6 100644 --- a/bin/windows/java-petstore-retrofit2-play24.bat +++ b/bin/windows/java-petstore-retrofit2-play24.bat @@ -5,6 +5,6 @@ If Not Exist %executable% ( ) REM set JAVA_OPTS=%JAVA_OPTS% -Xmx1024M -set ags=generate --artifact-id petstore-java-client-retrofit2-play24 -i modules\openapi-generator\src\test\resources\2_0\petstore-with-fake-endpoints-models-for-testing.yaml -g java -c bin\java-petstore-retrofit2-play24.json -o samples\client\petstore\java\retrofit2-play24 -DhideGenerationTimestamp=true +set ags=generate --artifact-id petstore-java-client-retrofit2-play24 -i modules\openapi-generator\src\test\resources\2_0\petstore-with-fake-endpoints-models-for-testing.yaml -g java -c bin\java-petstore-retrofit2-play24.json -o samples\client\petstore\java\retrofit2-play24 --additional-properties hideGenerationTimestamp=true java %JAVA_OPTS% -jar %executable% %ags% diff --git a/bin/windows/java-petstore-retrofit2-play25.bat b/bin/windows/java-petstore-retrofit2-play25.bat index cd785cf3ae18..d76bb00e1ea0 100644 --- a/bin/windows/java-petstore-retrofit2-play25.bat +++ b/bin/windows/java-petstore-retrofit2-play25.bat @@ -5,6 +5,6 @@ If Not Exist %executable% ( ) REM set JAVA_OPTS=%JAVA_OPTS% -Xmx1024M -set ags=generate --artifact-id petstore-java-client-retrofit2-play25 -i modules\openapi-generator\src\test\resources\2_0\petstore-with-fake-endpoints-models-for-testing.yaml -g java -c bin\java-petstore-retrofit2-play25.json -o samples\client\petstore\java\retrofit2-play25 -DhideGenerationTimestamp=true +set ags=generate --artifact-id petstore-java-client-retrofit2-play25 -i modules\openapi-generator\src\test\resources\2_0\petstore-with-fake-endpoints-models-for-testing.yaml -g java -c bin\java-petstore-retrofit2-play25.json -o samples\client\petstore\java\retrofit2-play25 --additional-properties hideGenerationTimestamp=true java %JAVA_OPTS% -jar %executable% %ags% diff --git a/bin/windows/java-petstore-retrofit2-play26.bat b/bin/windows/java-petstore-retrofit2-play26.bat index aa51f1bdf173..2e740ac67d75 100644 --- a/bin/windows/java-petstore-retrofit2-play26.bat +++ b/bin/windows/java-petstore-retrofit2-play26.bat @@ -5,6 +5,6 @@ If Not Exist %executable% ( ) REM set JAVA_OPTS=%JAVA_OPTS% -Xmx1024M -set ags=generate --artifact-id petstore-java-client-retrofit2-play26 -i modules\openapi-generator\src\test\resources\2_0\petstore-with-fake-endpoints-models-for-testing.yaml -g java -c bin\java-petstore-retrofit2-play26.json -o samples\client\petstore\java\retrofit2-play26 -DhideGenerationTimestamp=true +set ags=generate --artifact-id petstore-java-client-retrofit2-play26 -i modules\openapi-generator\src\test\resources\2_0\petstore-with-fake-endpoints-models-for-testing.yaml -g java -c bin\java-petstore-retrofit2-play26.json -o samples\client\petstore\java\retrofit2-play26 --additional-properties hideGenerationTimestamp=true java %JAVA_OPTS% -jar %executable% %ags% diff --git a/bin/windows/java-petstore-retrofit2.bat b/bin/windows/java-petstore-retrofit2.bat index 8a34d37af96b..e0d57dfdaa25 100644 --- a/bin/windows/java-petstore-retrofit2.bat +++ b/bin/windows/java-petstore-retrofit2.bat @@ -5,6 +5,6 @@ If Not Exist %executable% ( ) REM set JAVA_OPTS=%JAVA_OPTS% -Xmx1024M -set ags=generate -t modules\openapi-generator\src\main\resources\Java\libraries\retrofit2 -i modules\openapi-generator\src\test\resources\2_0\petstore-with-fake-endpoints-models-for-testing.yaml -g java -c bin\java-petstore-retrofit2.json -o samples\client\petstore\java\retrofit2 -DhideGenerationTimestamp=true +set ags=generate -t modules\openapi-generator\src\main\resources\Java\libraries\retrofit2 -i modules\openapi-generator\src\test\resources\2_0\petstore-with-fake-endpoints-models-for-testing.yaml -g java -c bin\java-petstore-retrofit2.json -o samples\client\petstore\java\retrofit2 --additional-properties hideGenerationTimestamp=true java %JAVA_OPTS% -jar %executable% %ags% diff --git a/bin/windows/java-petstore-retrofit2rx.bat b/bin/windows/java-petstore-retrofit2rx.bat index 1ab4b7c25fb0..e3801c9b7cd0 100644 --- a/bin/windows/java-petstore-retrofit2rx.bat +++ b/bin/windows/java-petstore-retrofit2rx.bat @@ -5,6 +5,6 @@ If Not Exist %executable% ( ) REM set JAVA_OPTS=%JAVA_OPTS% -Xmx1024M -set ags=generate -t modules\openapi-generator\src\main\resources\Java\libraries\retrofit2 -i modules\openapi-generator\src\test\resources\2_0\petstore-with-fake-endpoints-models-for-testing.yaml -g java -c bin\java-petstore-retrofit2rx.json -o samples\client\petstore\java\retrofit2rx -DuseRxJava=true,hideGenerationTimestamp=true +set ags=generate -t modules\openapi-generator\src\main\resources\Java\libraries\retrofit2 -i modules\openapi-generator\src\test\resources\2_0\petstore-with-fake-endpoints-models-for-testing.yaml -g java -c bin\java-petstore-retrofit2rx.json -o samples\client\petstore\java\retrofit2rx --additional-properties useRxJava=true,hideGenerationTimestamp=true java %JAVA_OPTS% -jar %executable% %ags% diff --git a/bin/windows/java-petstore-retrofit2rx2.bat b/bin/windows/java-petstore-retrofit2rx2.bat index 3640765a1b1a..29899b369604 100644 --- a/bin/windows/java-petstore-retrofit2rx2.bat +++ b/bin/windows/java-petstore-retrofit2rx2.bat @@ -5,6 +5,6 @@ If Not Exist %executable% ( ) REM set JAVA_OPTS=%JAVA_OPTS% -Xmx1024M -set ags=generate -t modules\openapi-generator\src\main\resources\Java\libraries\retrofit2 -i modules\openapi-generator\src\test\resources\2_0\petstore-with-fake-endpoints-models-for-testing.yaml -g java -c bin\java-petstore-retrofit2rx2.json -o samples\client\petstore\java\retrofit2rx2 -DuseRxJava2=true,hideGenerationTimestamp=true +set ags=generate -t modules\openapi-generator\src\main\resources\Java\libraries\retrofit2 -i modules\openapi-generator\src\test\resources\2_0\petstore-with-fake-endpoints-models-for-testing.yaml -g java -c bin\java-petstore-retrofit2rx2.json -o samples\client\petstore\java\retrofit2rx2 --additional-properties useRxJava2=true,hideGenerationTimestamp=true java %JAVA_OPTS% -jar %executable% %ags% diff --git a/bin/windows/java-petstore-vertx.bat b/bin/windows/java-petstore-vertx.bat index 06e7253fca51..151d1ac1fb3d 100644 --- a/bin/windows/java-petstore-vertx.bat +++ b/bin/windows/java-petstore-vertx.bat @@ -5,6 +5,6 @@ If Not Exist %executable% ( ) REM set JAVA_OPTS=%JAVA_OPTS% -Xmx1024M -set ags=generate -t modules\openapi-generator\src\main\resources\Java\libraries\vertx -i modules\openapi-generator\src\test\resources\2_0\petstore-with-fake-endpoints-models-for-testing.yaml -g java -c bin\java-petstore-vertx.json -o samples\client\petstore\java\vertx -DhideGenerationTimestamp=true +set ags=generate -t modules\openapi-generator\src\main\resources\Java\libraries\vertx -i modules\openapi-generator\src\test\resources\2_0\petstore-with-fake-endpoints-models-for-testing.yaml -g java -c bin\java-petstore-vertx.json -o samples\client\petstore\java\vertx --additional-properties hideGenerationTimestamp=true java %JAVA_OPTS% -jar %executable% %ags% diff --git a/bin/windows/java-pkmst-petstore-server.bat b/bin/windows/java-pkmst-petstore-server.bat index 59323fbfcddf..ace44650ed40 100644 --- a/bin/windows/java-pkmst-petstore-server.bat +++ b/bin/windows/java-pkmst-petstore-server.bat @@ -5,6 +5,6 @@ If Not Exist %executable% ( ) REM set JAVA_OPTS=%JAVA_OPTS% -Xmx1024M -set ags=generate -i modules\openapi-generator\src\test\resources\2_0\petstore.yaml -g java-pkmst -o samples\server\petstore\java-pkmst -DhideGenerationTimestamp=true +set ags=generate -i modules\openapi-generator\src\test\resources\2_0\petstore.yaml -g java-pkmst -o samples\server\petstore\java-pkmst --additional-properties hideGenerationTimestamp=true java %JAVA_OPTS% -jar %executable% %ags% diff --git a/bin/windows/java-play-framework-petstore-server.bat b/bin/windows/java-play-framework-petstore-server.bat index 294953856629..887fdd257097 100644 --- a/bin/windows/java-play-framework-petstore-server.bat +++ b/bin/windows/java-play-framework-petstore-server.bat @@ -5,6 +5,6 @@ If Not Exist %executable% ( ) REM set JAVA_OPTS=%JAVA_OPTS% -Xmx1024M -set ags=generate -i modules\openapi-generator\src\test\resources\2_0\petstore.yaml -g java-play-framework -o samples\server\petstore\java-play-framework -DhideGenerationTimestamp=true +set ags=generate -i modules\openapi-generator\src\test\resources\2_0\petstore.yaml -g java-play-framework -o samples\server\petstore\java-play-framework --additional-properties hideGenerationTimestamp=true java %JAVA_OPTS% -jar %executable% %ags% diff --git a/bin/windows/java-vertx-async-petstore-server.bat b/bin/windows/java-vertx-async-petstore-server.bat index 90ef1dfc56b1..5200b705a5df 100644 --- a/bin/windows/java-vertx-async-petstore-server.bat +++ b/bin/windows/java-vertx-async-petstore-server.bat @@ -5,6 +5,6 @@ If Not Exist %executable% ( ) REM set JAVA_OPTS=%JAVA_OPTS% -Xmx1024M -set ags=generate -i modules\openapi-generator\src\test\resources\2_0\petstore.yaml -g java-vertx -o samples\server\petstore\java-vertx\async -DvertxSwaggerRouterVersion=1.2.0 -DhideGenerationTimestamp=true +set ags=generate -i modules\openapi-generator\src\test\resources\2_0\petstore.yaml -g java-vertx -o samples\server\petstore\java-vertx\async --additional-properties vertxSwaggerRouterVersion=1.2.0,hideGenerationTimestamp=true java %JAVA_OPTS% -jar %executable% %ags% diff --git a/bin/windows/java-vertx-rx-petstore-server.bat b/bin/windows/java-vertx-rx-petstore-server.bat index 9bfa068c5579..b107bd837e3e 100644 --- a/bin/windows/java-vertx-rx-petstore-server.bat +++ b/bin/windows/java-vertx-rx-petstore-server.bat @@ -5,6 +5,6 @@ If Not Exist %executable% ( ) REM set JAVA_OPTS=%JAVA_OPTS% -Xmx1024M -set ags=generate -i modules\openapi-generator\src\test\resources\2_0\petstore.yaml -g java-vertx -o samples\server\petstore\java-vertx\rx -DvertxSwaggerRouterVersion=1.2.0 -DrxInterface=true +set ags=generate -i modules\openapi-generator\src\test\resources\2_0\petstore.yaml -g java-vertx -o samples\server\petstore\java-vertx\rx --additional-properties vertxSwaggerRouterVersion=1.2.0,rxInterface=true java %JAVA_OPTS% -jar %executable% %ags% diff --git a/bin/windows/javascript-es6-petstore.bat b/bin/windows/javascript-es6-petstore.bat index 4348e7add210..6ae6e93550c0 100644 --- a/bin/windows/javascript-es6-petstore.bat +++ b/bin/windows/javascript-es6-petstore.bat @@ -7,4 +7,4 @@ If Not Exist %executable% ( REM set JAVA_OPTS=%JAVA_OPTS% -Xmx1024M set ags=generate -i modules\openapi-generator\src\test\resources\2_0\petstore-with-fake-endpoints-models-for-testing.yaml -g javascript -o samples\client\petstore\javascript-es6 --additional-properties useES6=true -java -DappName=PetstoreClient %JAVA_OPTS% -jar %executable% %ags% +java %JAVA_OPTS% -jar %executable% %ags% --additional-properties appName=PetstoreClient diff --git a/bin/windows/javascript-petstore.bat b/bin/windows/javascript-petstore.bat index 400e61b6e6c6..04abbd1837dc 100755 --- a/bin/windows/javascript-petstore.bat +++ b/bin/windows/javascript-petstore.bat @@ -5,6 +5,6 @@ If Not Exist %executable% ( ) REM set JAVA_OPTS=%JAVA_OPTS% -Xmx1024M -set ags=generate -i modules\openapi-generator\src\test\resources\2_0\petstore-with-fake-endpoints-models-for-testing.yaml -g javascript -o samples\client\petstore\javascript -DappName=PetstoreClient --additional-properties useES6=false +set ags=generate -i modules\openapi-generator\src\test\resources\2_0\petstore-with-fake-endpoints-models-for-testing.yaml -g javascript -o samples\client\petstore\javascript --additional-properties appName=PetstoreClient,useES6=false java %JAVA_OPTS% -jar %executable% %ags% diff --git a/bin/windows/javascript-promise-es6-petstore.bat b/bin/windows/javascript-promise-es6-petstore.bat index bf952759aef2..41959932277b 100644 --- a/bin/windows/javascript-promise-es6-petstore.bat +++ b/bin/windows/javascript-promise-es6-petstore.bat @@ -7,4 +7,4 @@ If Not Exist %executable% ( REM set JAVA_OPTS=%JAVA_OPTS% -Xmx1024M set ags=generate -i modules\openapi-generator\src\test\resources\2_0\petstore-with-fake-endpoints-models-for-testing.yaml -g javascript -o samples\client\petstore\javascript-promise-es6 --additional-properties useES6=true,usePromises=true -java -DappName=PetstoreClient %JAVA_OPTS% -jar %executable% %ags% +java %JAVA_OPTS% -jar %executable% %ags% --additional-properties appName=PetstoreClient diff --git a/bin/windows/javascript-promise-petstore.bat b/bin/windows/javascript-promise-petstore.bat index a695b0a70e18..57756146e652 100755 --- a/bin/windows/javascript-promise-petstore.bat +++ b/bin/windows/javascript-promise-petstore.bat @@ -5,6 +5,6 @@ If Not Exist %executable% ( ) REM set JAVA_OPTS=%JAVA_OPTS% -Xmx1024M -set ags=generate -i modules\openapi-generator\src\test\resources\2_0\petstore-with-fake-endpoints-models-for-testing.yaml -g javascript -o samples\client\petstore\javascript-promise --additional-properties usePromises=true,useES6=false -DappName=PetstoreClient +set ags=generate -i modules\openapi-generator\src\test\resources\2_0\petstore-with-fake-endpoints-models-for-testing.yaml -g javascript -o samples\client\petstore\javascript-promise --additional-properties usePromises=true,useES6=false,appName=PetstoreClient java %JAVA_OPTS% -jar %executable% %ags% diff --git a/bin/windows/jaxrs-cxf-cdi-petstore-server.bat b/bin/windows/jaxrs-cxf-cdi-petstore-server.bat index 54e5b6768f79..48aadc36fec3 100644 --- a/bin/windows/jaxrs-cxf-cdi-petstore-server.bat +++ b/bin/windows/jaxrs-cxf-cdi-petstore-server.bat @@ -5,6 +5,6 @@ If Not Exist %executable% ( ) REM set JAVA_OPTS=%JAVA_OPTS% -Xmx1024M -DloggerPath=conf\log4j.properties -set ags=generate -t modules\openapi-generator\src\main\resources\JavaJaxRS\cxf-cdi -i modules\openapi-generator\src\test\resources\2_0\petstore.yaml -g jaxrs-cxf-cdi -o samples\server\petstore\jaxrs-cxf-cdi -DhideGenerationTimestamp=true %* +set ags=generate -t modules\openapi-generator\src\main\resources\JavaJaxRS\cxf-cdi -i modules\openapi-generator\src\test\resources\2_0\petstore.yaml -g jaxrs-cxf-cdi -o samples\server\petstore\jaxrs-cxf-cdi --additional-properties hideGenerationTimestamp=true %* java %JAVA_OPTS% -jar %executable% %ags% diff --git a/bin/windows/jaxrs-cxf-petstore-server-annotated-base-path.bat b/bin/windows/jaxrs-cxf-petstore-server-annotated-base-path.bat index 92fea43aaa8a..6df7234a2397 100644 --- a/bin/windows/jaxrs-cxf-petstore-server-annotated-base-path.bat +++ b/bin/windows/jaxrs-cxf-petstore-server-annotated-base-path.bat @@ -5,6 +5,6 @@ If Not Exist %executable% ( ) REM set JAVA_OPTS=%JAVA_OPTS% -Xmx1024M -DloggerPath=conf/log4j.properties -set ags=generate --artifact-id cxf-annotated-basepath -t modules\openapi-generator\src\main\resources\JavaJaxRS\cxf -i modules\openapi-generator\src\test\resources\2_0\petstore.yaml -g jaxrs-cxf -o samples\server\petstore\jaxrs-cxf-annotated-base-path -DhideGenerationTimestamp=true,useAnnotatedBasePath=true --additional-properties serverPort=8082 %* +set ags=generate --artifact-id cxf-annotated-basepath -t modules\openapi-generator\src\main\resources\JavaJaxRS\cxf -i modules\openapi-generator\src\test\resources\2_0\petstore.yaml -g jaxrs-cxf -o samples\server\petstore\jaxrs-cxf-annotated-base-path --additional-properties hideGenerationTimestamp=true,useAnnotatedBasePath=true,serverPort=8082 %* java %JAVA_OPTS% -jar %executable% %ags% diff --git a/bin/windows/jaxrs-cxf-petstore-server-non-spring-application.bat b/bin/windows/jaxrs-cxf-petstore-server-non-spring-application.bat index 9df7780484fb..b239011963bf 100644 --- a/bin/windows/jaxrs-cxf-petstore-server-non-spring-application.bat +++ b/bin/windows/jaxrs-cxf-petstore-server-non-spring-application.bat @@ -5,6 +5,6 @@ If Not Exist %executable% ( ) REM set JAVA_OPTS=%JAVA_OPTS% -Xmx1024M -DloggerPath=conf/log4j.properties -set ags=generate --artifact-id cxf-server-non-spring -t modules\openapi-generator\src\main\resources\JavaJaxRS\cxf -i modules\openapi-generator\src\test\resources\2_0\petstore.yaml -g jaxrs-cxf -o samples\server\petstore\jaxrs-cxf-non-spring-app -DhideGenerationTimestamp=true,generateNonSpringApplication=true --additional-properties serverPort=8082 %* +set ags=generate --artifact-id cxf-server-non-spring -t modules\openapi-generator\src\main\resources\JavaJaxRS\cxf -i modules\openapi-generator\src\test\resources\2_0\petstore.yaml -g jaxrs-cxf -o samples\server\petstore\jaxrs-cxf-non-spring-app --additional-properties hideGenerationTimestamp=true,generateNonSpringApplication=true,serverPort=8082 %* java %JAVA_OPTS% -jar %executable% %ags% diff --git a/bin/windows/jaxrs-cxf-petstore-server-test-data.bat b/bin/windows/jaxrs-cxf-petstore-server-test-data.bat index 47c249ce0cf8..ac42b6c04741 100644 --- a/bin/windows/jaxrs-cxf-petstore-server-test-data.bat +++ b/bin/windows/jaxrs-cxf-petstore-server-test-data.bat @@ -5,6 +5,6 @@ If Not Exist %executable% ( ) REM set JAVA_OPTS=%JAVA_OPTS% -Xmx1024M -DloggerPath=conf/log4j.properties -set ags=generate --artifact-id cxf-test-data -t modules\openapi-generator\src\main\resources\JavaJaxRS\cxf-ext -i modules\openapi-generator\src\test\resources\2_0\petstore-with-fake-endpoints-models-for-testing.yaml -g jaxrs-cxf-extended -o samples\server\petstore\jaxrs-cxf-test-data -DhideGenerationTimestamp=true -DuseAnnotatedBasePath=true --generate-alias-as-model --additional-properties java8=true,generateSpringApplication=true,generateSpringBootApplication=true,generateOperationBody=true,loadTestDataFromFile=true %* +set ags=generate --artifact-id cxf-test-data -t modules\openapi-generator\src\main\resources\JavaJaxRS\cxf-ext -i modules\openapi-generator\src\test\resources\2_0\petstore-with-fake-endpoints-models-for-testing.yaml -g jaxrs-cxf-extended -o samples\server\petstore\jaxrs-cxf-test-data --additional-properties hideGenerationTimestamp=true,useAnnotatedBasePath=true --generate-alias-as-model --additional-properties java8=true,generateSpringApplication=true,generateSpringBootApplication=true,generateOperationBody=true,loadTestDataFromFile=true %* java %JAVA_OPTS% -jar %executable% %ags% diff --git a/bin/windows/jaxrs-cxf-petstore-server.bat b/bin/windows/jaxrs-cxf-petstore-server.bat index d64116025f93..82880f59590f 100644 --- a/bin/windows/jaxrs-cxf-petstore-server.bat +++ b/bin/windows/jaxrs-cxf-petstore-server.bat @@ -5,6 +5,6 @@ If Not Exist %executable% ( ) REM set JAVA_OPTS=%JAVA_OPTS% -Xmx1024M -DloggerPath=conf/log4j.properties -set ags=generate -t modules\openapi-generator\src\main\resources\JavaJaxRS\cxf -i modules\openapi-generator\src\test\resources\2_0\petstore-with-fake-endpoints-models-for-testing.yaml -g jaxrs-cxf -o samples\server\petstore\jaxrs-cxf -DhideGenerationTimestamp=true %* +set ags=generate -t modules\openapi-generator\src\main\resources\JavaJaxRS\cxf -i modules\openapi-generator\src\test\resources\2_0\petstore-with-fake-endpoints-models-for-testing.yaml -g jaxrs-cxf -o samples\server\petstore\jaxrs-cxf --additional-properties hideGenerationTimestamp=true %* java %JAVA_OPTS% -jar %executable% %ags% diff --git a/bin/windows/jaxrs-spec-petstore-server-interface.bat b/bin/windows/jaxrs-spec-petstore-server-interface.bat index 84307a12dfaa..41c29d41cc4b 100644 --- a/bin/windows/jaxrs-spec-petstore-server-interface.bat +++ b/bin/windows/jaxrs-spec-petstore-server-interface.bat @@ -5,6 +5,6 @@ If Not Exist %executable% ( ) REM set JAVA_OPTS=%JAVA_OPTS% -Xmx1024M -DloggerPath=conf/log4j.properties -set ags=generate --artifact-id "jaxrs-cxf-client-petstore-client" -i modules\openapi-generator\src\test\resources\2_0\petstore-with-fake-endpoints-models-for-testing.yaml -g jaxrs-spec -o samples\server\petstore\jaxrs-spec-interface -DhideGenerationTimestamp=true,serializableModel=true,interfaceOnly=true +set ags=generate --artifact-id "jaxrs-cxf-client-petstore-client" -i modules\openapi-generator\src\test\resources\2_0\petstore-with-fake-endpoints-models-for-testing.yaml -g jaxrs-spec -o samples\server\petstore\jaxrs-spec-interface --additional-properties hideGenerationTimestamp=true,serializableModel=true,interfaceOnly=true java %JAVA_OPTS% -jar %executable% %ags% diff --git a/bin/windows/jaxrs-spec-petstore-server.bat b/bin/windows/jaxrs-spec-petstore-server.bat index 7172d579e343..eeb11da17fa8 100644 --- a/bin/windows/jaxrs-spec-petstore-server.bat +++ b/bin/windows/jaxrs-spec-petstore-server.bat @@ -5,6 +5,6 @@ If Not Exist %executable% ( ) REM set JAVA_OPTS=%JAVA_OPTS% -Xmx1024M -DloggerPath=conf/log4j.properties -set ags=generate --artifact-id "jaxrs-cxf-client-petstore-client" -i modules\openapi-generator\src\test\resources\2_0\petstore-with-fake-endpoints-models-for-testing.yaml -g jaxrs-spec -o samples\server\petstore\jaxrs-spec -DhideGenerationTimestamp=true,serializableModel=true +set ags=generate --artifact-id "jaxrs-cxf-client-petstore-client" -i modules\openapi-generator\src\test\resources\2_0\petstore-with-fake-endpoints-models-for-testing.yaml -g jaxrs-spec -o samples\server\petstore\jaxrs-spec --additional-properties hideGenerationTimestamp=true,serializableModel=true java %JAVA_OPTS% -jar %executable% %ags% diff --git a/bin/windows/objc-petstore.bat b/bin/windows/objc-petstore.bat index d75eeb2b7b0d..d5264e33c376 100755 --- a/bin/windows/objc-petstore.bat +++ b/bin/windows/objc-petstore.bat @@ -5,6 +5,6 @@ If Not Exist %executable% ( ) REM set JAVA_OPTS=%JAVA_OPTS% -Xmx1024M -set ags=generate -i modules\openapi-generator\src\test\resources\2_0\petstore.yaml -g objc -o samples\client\petstore\objc\default -DappName=PetstoreClient +set ags=generate -i modules\openapi-generator\src\test\resources\2_0\petstore.yaml -g objc -o samples\client\petstore\objc\default --additional-properties appName=PetstoreClient java %JAVA_OPTS% -jar %executable% %ags% diff --git a/bin/windows/python-petstore.bat b/bin/windows/python-petstore.bat index 9c5ea9c75121..c09fd3a44b06 100755 --- a/bin/windows/python-petstore.bat +++ b/bin/windows/python-petstore.bat @@ -5,6 +5,6 @@ If Not Exist %executable% ( ) REM set JAVA_OPTS=%JAVA_OPTS% -Xmx1024M -set ags=generate -i modules\openapi-generator\src\test\resources\2_0\petstore-with-fake-endpoints-models-for-testing.yaml -g python -o samples\client\petstore\python -DpackageName=petstore_api +set ags=generate -i modules\openapi-generator\src\test\resources\2_0\petstore-with-fake-endpoints-models-for-testing.yaml -g python -o samples\client\petstore\python --additional-properties packageName=petstore_api java %JAVA_OPTS% -jar %executable% %ags% diff --git a/bin/windows/python2-flask-petstore.bat b/bin/windows/python2-flask-petstore.bat index cc77dfcd5fc5..54189a7d1934 100755 --- a/bin/windows/python2-flask-petstore.bat +++ b/bin/windows/python2-flask-petstore.bat @@ -5,6 +5,6 @@ If Not Exist %executable% ( ) REM set JAVA_OPTS=%JAVA_OPTS% -Xmx1024M -set ags=generate -i modules\openapi-generator\src\test\resources\2_0\petstore.yaml -g python-flask -o samples\server\petstore\python-flask-python2 -c bin\supportPython2.json -D service +set ags=generate -i modules\openapi-generator\src\test\resources\2_0\petstore.yaml -g python-flask -o samples\server\petstore\python-flask-python2 -c bin\supportPython2.json java %JAVA_OPTS% -jar %executable% %ags% diff --git a/bin/windows/python3-flask-petstore.bat b/bin/windows/python3-flask-petstore.bat index c1677662bd0f..56205cf151a9 100755 --- a/bin/windows/python3-flask-petstore.bat +++ b/bin/windows/python3-flask-petstore.bat @@ -5,6 +5,6 @@ If Not Exist %executable% ( ) REM set JAVA_OPTS=%JAVA_OPTS% -Xmx1024M -set ags=generate -i modules\openapi-generator\src\test\resources\2_0\petstore.yaml -g python-flask -o samples\server\petstore\python-flask -D service +set ags=generate -i modules\openapi-generator\src\test\resources\2_0\petstore.yaml -g python-flask -o samples\server\petstore\python-flask java %JAVA_OPTS% -jar %executable% %ags% diff --git a/bin/windows/spring-mvc-petstore-j8-async-server.bat b/bin/windows/spring-mvc-petstore-j8-async-server.bat index a9a2cc4797de..e87ba8ed7deb 100644 --- a/bin/windows/spring-mvc-petstore-j8-async-server.bat +++ b/bin/windows/spring-mvc-petstore-j8-async-server.bat @@ -5,6 +5,6 @@ If Not Exist %executable% ( ) REM set JAVA_OPTS=%JAVA_OPTS% -Xmx1024M -set ags=generate -i modules\openapi-generator\src\test\resources\2_0\petstore-with-fake-endpoints-models-for-testing.yaml -g spring --library=spring-mvc -o samples\server\petstore\spring-mvc-j8-async -c bin\spring-mvc-petstore-j8-async.json -DhideGenerationTimestamp=true +set ags=generate -i modules\openapi-generator\src\test\resources\2_0\petstore-with-fake-endpoints-models-for-testing.yaml -g spring --library=spring-mvc -o samples\server\petstore\spring-mvc-j8-async -c bin\spring-mvc-petstore-j8-async.json --additional-properties hideGenerationTimestamp=true java %JAVA_OPTS% -jar %executable% %ags% diff --git a/bin/windows/spring-mvc-petstore-server.bat b/bin/windows/spring-mvc-petstore-server.bat index 202de357718d..02783f339cfa 100644 --- a/bin/windows/spring-mvc-petstore-server.bat +++ b/bin/windows/spring-mvc-petstore-server.bat @@ -5,6 +5,6 @@ If Not Exist %executable% ( ) REM set JAVA_OPTS=%JAVA_OPTS% -Xmx1024M -set ags=generate -i modules\openapi-generator\src\test\resources\2_0\petstore-with-fake-endpoints-models-for-testing.yaml -c bin\spring-mvc-petstore-server.json -g spring --library=spring-mvc -o samples\server\petstore\spring-mvc -DhideGenerationTimestamp=true +set ags=generate -i modules\openapi-generator\src\test\resources\2_0\petstore-with-fake-endpoints-models-for-testing.yaml -c bin\spring-mvc-petstore-server.json -g spring --library=spring-mvc -o samples\server\petstore\spring-mvc --additional-properties hideGenerationTimestamp=true java %JAVA_OPTS% -jar %executable% %ags% diff --git a/bin/windows/springboot-petstore-server.bat b/bin/windows/springboot-petstore-server.bat index 9790ce15b393..af0e4c2ba10b 100644 --- a/bin/windows/springboot-petstore-server.bat +++ b/bin/windows/springboot-petstore-server.bat @@ -5,6 +5,6 @@ If Not Exist %executable% ( ) REM set JAVA_OPTS=%JAVA_OPTS% -Xmx1024M -set ags=generate -i modules\openapi-generator\src\test\resources\2_0\petstore-with-fake-endpoints-models-for-testing.yaml -g spring -o samples\server\petstore\springboot -DhideGenerationTimestamp=true +set ags=generate -i modules\openapi-generator\src\test\resources\2_0\petstore-with-fake-endpoints-models-for-testing.yaml -g spring -o samples\server\petstore\springboot --additional-properties hideGenerationTimestamp=true java %JAVA_OPTS% -jar %executable% %ags% diff --git a/bin/windows/typescript-angular-v2-interfaces.bat b/bin/windows/typescript-angular-v2-interfaces.bat index 443d8eb53cdc..881810e729fb 100644 --- a/bin/windows/typescript-angular-v2-interfaces.bat +++ b/bin/windows/typescript-angular-v2-interfaces.bat @@ -5,6 +5,6 @@ If Not Exist %executable% ( ) REM set JAVA_OPTS=%JAVA_OPTS% -Xmx1024M -set ags=generate -i modules\openapi-generator\src\test\resources\2_0\petstore.yaml -g typescript-angular -o samples\client\petstore\typescript-angular-v2\with-interfaces -D withInterfaces=true --additional-properties ngVersion=2 +set ags=generate -i modules\openapi-generator\src\test\resources\2_0\petstore.yaml -g typescript-angular -o samples\client\petstore\typescript-angular-v2\with-interfaces --additional-properties withInterfaces=true --additional-properties ngVersion=2 java %JAVA_OPTS% -jar %executable% %ags% diff --git a/bin/windows/typescript-angular-v6-not-provided-in-root-with-npm.bat b/bin/windows/typescript-angular-v6-not-provided-in-root-with-npm.bat index 5d7ace44e2c9..4e3e38dff452 100644 --- a/bin/windows/typescript-angular-v6-not-provided-in-root-with-npm.bat +++ b/bin/windows/typescript-angular-v6-not-provided-in-root-with-npm.bat @@ -5,6 +5,6 @@ If Not Exist %executable% ( ) REM set JAVA_OPTS=%JAVA_OPTS% -Xmx1024M -set ags=generate -i modules\openapi-generator\src\test\resources\2_0\petstore.yaml -g typescript-angular -c bin\typescript-angular-v6-petstore-not-provided-in-root-with-npm.json -o samples\client\petstore\typescript-angular-v6-not-provided-in-root\builds\with-npm -D providedInRoot=false --additional-properties ngVersion=6.0.0 +set ags=generate -i modules\openapi-generator\src\test\resources\2_0\petstore.yaml -g typescript-angular -c bin\typescript-angular-v6-petstore-not-provided-in-root-with-npm.json -o samples\client\petstore\typescript-angular-v6-not-provided-in-root\builds\with-npm --additional-properties providedInRoot=false --additional-properties ngVersion=6.0.0 java %JAVA_OPTS% -jar %executable% %ags% diff --git a/bin/windows/typescript-angular-v6-not-provided-in-root.bat b/bin/windows/typescript-angular-v6-not-provided-in-root.bat index 3cddf6e19264..d5550355dff7 100644 --- a/bin/windows/typescript-angular-v6-not-provided-in-root.bat +++ b/bin/windows/typescript-angular-v6-not-provided-in-root.bat @@ -5,6 +5,6 @@ If Not Exist %executable% ( ) REM set JAVA_OPTS=%JAVA_OPTS% -Xmx1024M -set ags=generate -i modules\openapi-generator\src\test\resources\2_0\petstore.yaml -g typescript-angular -o samples\client\petstore\typescript-angular-v6-not-provided-in-root\builds\default -D providedInRoot=false --additional-properties ngVersion=6.0.0 +set ags=generate -i modules\openapi-generator\src\test\resources\2_0\petstore.yaml -g typescript-angular -o samples\client\petstore\typescript-angular-v6-not-provided-in-root\builds\default --additional-properties providedInRoot=false --additional-properties ngVersion=6.0.0 java %JAVA_OPTS% -jar %executable% %ags% diff --git a/bin/windows/typescript-angular-v7-not-provided-in-root-with-npm.bat b/bin/windows/typescript-angular-v7-not-provided-in-root-with-npm.bat index b95ce1fbdb7b..5a133e102658 100644 --- a/bin/windows/typescript-angular-v7-not-provided-in-root-with-npm.bat +++ b/bin/windows/typescript-angular-v7-not-provided-in-root-with-npm.bat @@ -5,6 +5,6 @@ If Not Exist %executable% ( ) REM set JAVA_OPTS=%JAVA_OPTS% -Xmx1024M -set ags=generate -i modules\openapi-generator\src\test\resources\2_0\petstore.yaml -g typescript-angular -c bin\typescript-angular-v7-petstore-not-provided-in-root-with-npm.json -o samples\client\petstore\typescript-angular-v7-not-provided-in-root\builds\with-npm -D providedInRoot=false --additional-properties ngVersion=7.0.0 +set ags=generate -i modules\openapi-generator\src\test\resources\2_0\petstore.yaml -g typescript-angular -c bin\typescript-angular-v7-petstore-not-provided-in-root-with-npm.json -o samples\client\petstore\typescript-angular-v7-not-provided-in-root\builds\with-npm --additional-properties providedInRoot=false --additional-properties ngVersion=7.0.0 java %JAVA_OPTS% -jar %executable% %ags% diff --git a/bin/windows/typescript-angular-v7-not-provided-in-root.bat b/bin/windows/typescript-angular-v7-not-provided-in-root.bat index 3522fae151e2..b9a18244d0f7 100644 --- a/bin/windows/typescript-angular-v7-not-provided-in-root.bat +++ b/bin/windows/typescript-angular-v7-not-provided-in-root.bat @@ -5,6 +5,6 @@ If Not Exist %executable% ( ) REM set JAVA_OPTS=%JAVA_OPTS% -Xmx1024M -set ags=generate -i modules\openapi-generator\src\test\resources\2_0\petstore.yaml -g typescript-angular -o samples\client\petstore\typescript-angular-v7-not-provided-in-root\builds\default -D providedInRoot=false --additional-properties ngVersion=7.0.0 +set ags=generate -i modules\openapi-generator\src\test\resources\2_0\petstore.yaml -g typescript-angular -o samples\client\petstore\typescript-angular-v7-not-provided-in-root\builds\default --additional-properties ngVersion=7.0.0 --additional-properties providedInRoot=false java %JAVA_OPTS% -jar %executable% %ags% diff --git a/bin/windows/typescript-axios-petstore-interfaces.bat b/bin/windows/typescript-axios-petstore-interfaces.bat index b92c34a9f8bb..2c34eba5c7af 100644 --- a/bin/windows/typescript-axios-petstore-interfaces.bat +++ b/bin/windows/typescript-axios-petstore-interfaces.bat @@ -7,6 +7,6 @@ If Not Exist %executable% ( ) REM set JAVA_OPTS=%JAVA_OPTS% -Xmx1024M -set ags=generate -i modules\openapi-generator\src\test\resources\2_0\petstore.yaml -g typescript-axios -o samples\client\petstore\typescript-axios\builds\with-interfaces -D withInterfaces=true +set ags=generate -i modules\openapi-generator\src\test\resources\2_0\petstore.yaml -g typescript-axios -o samples\client\petstore\typescript-axios\builds\with-interfaces --additional-properties withInterfaces=true java %JAVA_OPTS% -jar %executable% %ags% diff --git a/bin/windows/typescript-fetch-petstore-interfaces.bat b/bin/windows/typescript-fetch-petstore-interfaces.bat index e41be6112982..e25d23badb7d 100644 --- a/bin/windows/typescript-fetch-petstore-interfaces.bat +++ b/bin/windows/typescript-fetch-petstore-interfaces.bat @@ -7,6 +7,6 @@ If Not Exist %executable% ( ) REM set JAVA_OPTS=%JAVA_OPTS% -Xmx1024M -set ags=generate -i modules\openapi-generator\src\test\resources\2_0\petstore.yaml -g typescript-fetch -o samples\client\petstore\typescript-fetch\builds\with-interfaces -D withInterfaces=true +set ags=generate -i modules\openapi-generator\src\test\resources\2_0\petstore.yaml -g typescript-fetch -o samples\client\petstore\typescript-fetch\builds\with-interfaces --additional-properties withInterfaces=true java %JAVA_OPTS% -jar %executable% %ags% diff --git a/bin/windows/typescript-rxjs-petstore-interfaces.bat b/bin/windows/typescript-rxjs-petstore-interfaces.bat index 401ccb7b3761..b2232e82cd34 100644 --- a/bin/windows/typescript-rxjs-petstore-interfaces.bat +++ b/bin/windows/typescript-rxjs-petstore-interfaces.bat @@ -7,6 +7,6 @@ If Not Exist %executable% ( ) REM set JAVA_OPTS=%JAVA_OPTS% -Xmx1024M -set ags=generate -i modules\openapi-generator\src\test\resources\2_0\petstore.yaml -g typescript-rxjs -o samples\client\petstore\typescript-rxjs\builds\with-interfaces -D withInterfaces=true +set ags=generate -i modules\openapi-generator\src\test\resources\2_0\petstore.yaml -g typescript-rxjs -o samples\client\petstore\typescript-rxjs\builds\with-interfaces --additional-properties withInterfaces=true java %JAVA_OPTS% -jar %executable% %ags% diff --git a/modules/openapi-generator-cli/src/main/java/org/openapitools/codegen/cmd/Generate.java b/modules/openapi-generator-cli/src/main/java/org/openapitools/codegen/cmd/Generate.java index 62924e2b6ab9..00a7f5334869 100644 --- a/modules/openapi-generator-cli/src/main/java/org/openapitools/codegen/cmd/Generate.java +++ b/modules/openapi-generator-cli/src/main/java/org/openapitools/codegen/cmd/Generate.java @@ -140,7 +140,7 @@ public class Generate implements Runnable { private List typeMappings = new ArrayList<>(); @Option( - name = {"--additional-properties"}, + name = {"-p", "--additional-properties"}, title = "additional properties", description = "sets additional properties that can be referenced by the mustache templates in the format of name=value,name=value." + " You can also have multiple occurrences of this option.") @@ -383,7 +383,10 @@ public void run() { configurator.setStrictSpecBehavior(strictSpecBehavior); } - applySystemPropertiesKvpList(systemProperties, configurator); + if (systemProperties != null && !systemProperties.isEmpty()) { + System.err.println("[DEPRECATED] -D arguments after 'generate' are application arguments and not Java System Properties, please consider changing to -p, or apply your options to JAVA_OPTS, or move the -D arguments before the jar option."); + applySystemPropertiesKvpList(systemProperties, configurator); + } applyInstantiationTypesKvpList(instantiationTypes, configurator); applyImportMappingsKvpList(importMappings, configurator); applyTypeMappingsKvpList(typeMappings, configurator); diff --git a/modules/openapi-generator-cli/src/test/java/org/openapitools/codegen/cmd/GenerateTest.java b/modules/openapi-generator-cli/src/test/java/org/openapitools/codegen/cmd/GenerateTest.java index d8812b5c8d1f..a2304283d682 100644 --- a/modules/openapi-generator-cli/src/test/java/org/openapitools/codegen/cmd/GenerateTest.java +++ b/modules/openapi-generator-cli/src/test/java/org/openapitools/codegen/cmd/GenerateTest.java @@ -64,9 +64,11 @@ public void testVerbose() throws Exception { @Test public void testRequiredArgs_ShortArgs() throws Exception { - setupAndRunTest("-i", "src/test/resources/swagger.yaml", "-g", "java", "-o", "src/main/java", false, null); + setupAndRunTest("-i", "src/test/resources/swagger.yaml", "-g", "java", "-o", "src/main/java", false, null, "-p", "foo=bar"); new FullVerifications() { { + configurator.addAdditionalProperty("foo", "bar"); + times = 1; } }; } @@ -138,85 +140,6 @@ public void testAuth() throws Exception { }; } - @Test - public void testSystemProperties() throws Exception { - - setupAndRunGenericTest("-D", "hello=world,foo=bar"); - - new FullVerifications() { - { - configurator.addSystemProperty("hello", "world"); - times = 1; - configurator.addSystemProperty("foo", "bar"); - times = 1; - } - }; - - setupAndRunGenericTest("-Dhello=world,foo=bar"); - - new FullVerifications() { - { - configurator.addSystemProperty("hello", "world"); - times = 1; - configurator.addSystemProperty("foo", "bar"); - times = 1; - } - }; - - setupAndRunGenericTest("-D", "hello=world,key=,foo=bar"); - - new FullVerifications() { - { - configurator.addSystemProperty("hello", "world"); - times = 1; - configurator.addSystemProperty("foo", "bar"); - times = 1; - configurator.addSystemProperty("key", ""); - times = 1; - } - }; - - setupAndRunGenericTest("-D", "hello=world,key,foo=bar"); - - new FullVerifications() { - { - configurator.addSystemProperty("hello", "world"); - times = 1; - configurator.addSystemProperty("foo", "bar"); - times = 1; - configurator.addSystemProperty("key", ""); - times = 1; - } - }; - - setupAndRunGenericTest("-D", "hello=world", "-D", "key", "-D", "foo=bar"); - - new FullVerifications() { - { - configurator.addSystemProperty("hello", "world"); - times = 1; - configurator.addSystemProperty("foo", "bar"); - times = 1; - configurator.addSystemProperty("key", ""); - times = 1; - } - }; - - setupAndRunGenericTest("-Dhello=world", "-Dkey", "-Dfoo=bar"); - - new FullVerifications() { - { - configurator.addSystemProperty("hello", "world"); - times = 1; - configurator.addSystemProperty("foo", "bar"); - times = 1; - configurator.addSystemProperty("key", ""); - times = 1; - } - }; - } - - @Test public void testConfigJson() throws Exception { diff --git a/modules/openapi-generator-core/pom.xml b/modules/openapi-generator-core/pom.xml index e63b7dac541d..0c9c469df45e 100644 --- a/modules/openapi-generator-core/pom.xml +++ b/modules/openapi-generator-core/pom.xml @@ -13,4 +13,22 @@ openapi-generator-core openapi-generator-core https://github.com/openapitools/openapi-generator + + + + com.google.guava + guava + ${guava-version} + + + org.slf4j + slf4j-api + ${slf4j-version} + + + + + 1.7.12 + 26.0-jre + diff --git a/modules/openapi-generator-core/src/main/java/org/openapitools/codegen/config/Context.java b/modules/openapi-generator-core/src/main/java/org/openapitools/codegen/config/Context.java new file mode 100644 index 000000000000..6bd2588ae19e --- /dev/null +++ b/modules/openapi-generator-core/src/main/java/org/openapitools/codegen/config/Context.java @@ -0,0 +1,68 @@ +/* + * Copyright 2019 OpenAPI-Generator Contributors (https://openapi-generator.tech) + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.openapitools.codegen.config; + +/** + * The Context used for generation. + * + * @param the type of the input spec document. + */ +public class Context { + private TSpecDocument specDocument; + private GeneratorSettings generatorSettings; + private WorkflowSettings workflowSettings; + + /** + * Instantiates a new Context. + * + * @param specDocument the spec document + * @param generatorSettings the generator settings + * @param workflowSettings the workflow settings + */ + public Context(TSpecDocument specDocument, GeneratorSettings generatorSettings, WorkflowSettings workflowSettings) { + this.specDocument = specDocument; + this.generatorSettings = generatorSettings; + this.workflowSettings = workflowSettings; + } + + /** + * Gets the generator settings. These options are specific to "what" gets generated (language, framework). + * + * @return the generator settings + */ + public GeneratorSettings getGeneratorSettings() { + return generatorSettings; + } + + /** + * Gets the spec document. + * + * @return the spec document + */ + public TSpecDocument getSpecDocument() { + return specDocument; + } + + /** + * Gets the workflow settings. These options are specific to "how" code gets generated (input, output directory, ignore files, template engine, etc). + * + * @return the workflow settings + */ + public WorkflowSettings getWorkflowSettings() { + return workflowSettings; + } +} diff --git a/modules/openapi-generator-core/src/main/java/org/openapitools/codegen/config/GeneratorSettings.java b/modules/openapi-generator-core/src/main/java/org/openapitools/codegen/config/GeneratorSettings.java new file mode 100644 index 000000000000..565539c7ca34 --- /dev/null +++ b/modules/openapi-generator-core/src/main/java/org/openapitools/codegen/config/GeneratorSettings.java @@ -0,0 +1,872 @@ +/* + * Copyright 2019 OpenAPI-Generator Contributors (https://openapi-generator.tech) + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.openapitools.codegen.config; + +import com.google.common.collect.ImmutableMap; +import com.google.common.collect.ImmutableSet; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import java.io.Serializable; +import java.util.*; + +/** + * Represents those settings applied to a generator. + */ +public final class GeneratorSettings implements Serializable { + + private static final Logger LOGGER = LoggerFactory.getLogger(GeneratorSettings.class); + private static String DEFAULT_GIT_USER_ID = "GIT_USER_ID"; + private static String DEFAULT_GIT_REPO_ID = "GIT_REPO_ID"; + private static String DEFAULT_RELEASE_NOTE = "Minor update"; + + private String generatorName; + private String apiPackage; + private String modelPackage; + private String invokerPackage; + private String packageName; + private String modelNamePrefix; + private String modelNameSuffix; + private String groupId; + private String artifactId; + private String artifactVersion; + private String library; + + private ImmutableMap instantiationTypes; + private ImmutableMap typeMappings; + private ImmutableMap additionalProperties; + private ImmutableMap importMappings; + private ImmutableSet languageSpecificPrimitives; + private ImmutableMap reservedWordMappings; + + private String gitUserId; + private String gitRepoId; + private String releaseNote; + private String httpUserAgent; + + /** + * Gets the name of the generator to use. + * + * @return the generator name + */ + public String getGeneratorName() { + return generatorName; + } + + /** + * Gets the api package name for generated sources. + * + * @return the api package + */ + public String getApiPackage() { + return apiPackage; + } + + /** + * Gets the model package name for generated sources + * + * @return the model package + */ + public String getModelPackage() { + return modelPackage; + } + + /** + * Gets the invoker package name for generated sources. + * + * @return the invoker package + */ + public String getInvokerPackage() { + return invokerPackage; + } + + /** + * Gets the overall package name for generated sources. + * + * @return the package name + */ + public String getPackageName() { + return packageName; + } + + /** + * Gets a model name prefix for generated models. This name will be prefixed to a model name. + *

+ * This option is often used to circumvent compilation issues where models match keywords. + *

+ * Example: + *

+ * Prefix My applied to Object results in a generated class named MyObject. + * + * @return the model name prefix + */ + public String getModelNamePrefix() { + return modelNamePrefix; + } + + /** + * Gets a model name suffix for generated models. This name will be appended to a model name. + *

+ * This option is often used to circumvent compilation issues where models match keywords. + *

+ * Example: + *

+ * Suffix Gen applied to Object results in a generated class named ObjectGen. + * + * @return the model name suffix + */ + public String getModelNameSuffix() { + return modelNameSuffix; + } + + /** + * Gets the group id for generated sources which support this concept (e.g. Java and pom.xml, Scala and SBT/Gradle/pom). + * + * @return the group id + */ + public String getGroupId() { + return groupId; + } + + /** + * Gets artifact id for generated sources which support this concept (e.g. Java and pom.xml, Scala and SBT/Gradle/pom). + * + * @return the artifact id + */ + public String getArtifactId() { + return artifactId; + } + + /** + * Gets artifact version for generated sources which support this concept (e.g. Java and pom.xml, Scala and SBT/Gradle/pom). + * + * @return the artifact version + */ + public String getArtifactVersion() { + return artifactVersion; + } + + /** + * Gets library (sub-template) for the target generated. + * + * @return the library + */ + public String getLibrary() { + return library; + } + + + /** + * Gets instantiation types mappings. These allow for customizing the defaults provided by a built-in generator. + *

+ * For example, "array" to "ArrayList" applied to the Java generator will cause all array properties to be instantiated as ArrayList. + *

+ * This option differs from {@link GeneratorSettings#getTypeMappings()} in that values provided here are generally used for type construction (what is applied to "new"). + * + * @return the instantiation types + */ + public Map getInstantiationTypes() { + return instantiationTypes; + } + + /** + * Gets type mappings. These allow for customizing type definitions. + *

+ * For example, "array" to "List" applied to the Java generator will cause all variable assignments for array properties to be of type List. + *

+ * This option differs from {@link GeneratorSettings#getInstantiationTypes()} in that values provided here are variable reference types rather than concrete instantiation types. + * + * @return the type mappings + */ + public Map getTypeMappings() { + return typeMappings; + } + + /** + * Gets additional properties which will be passed to template as dynamic properties. + * + * @return the additional properties + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Gets import mappings between a given class and the import that should be used for that class. + *

+ * Use import mappings, for example, when you want to "bring your own models" from another location. + * + * @return the import mappings + * @see Bringing your own models + */ + public Map getImportMappings() { + return importMappings; + } + + /** + * Gets language specific primitives. These are in addition to the "base" primitives defined in a generator. + *

+ * In general, a primitive defined here will indicate to the generator: + *

+ * - models with these types don't require an import + * - model names not included here require imports and likely indicate a model reference + *

+ * There may be generator-specific implementation details which differ slightly. + * + * @return the language specific primitives + */ + public Set getLanguageSpecificPrimitives() { + return languageSpecificPrimitives; + } + + /** + * Gets reserved word mappings. Values defined here define how a reserved word should be escaped. + *

+ * If no mapping is present, the mapping is generally automatically applied to a default with prefixed underscore (_name). Note that + * some languages don't support identifiers beginning with a prefix, in which case the generator applies a more appropriate prefix. + * + * @return the reserved word mappings + */ + public Map getReservedWordMappings() { + return reservedWordMappings; + } + + /** + * Gets git user id. e.g. openapitools. + *

+ * Generally used by git_push.sh in generated sources which support it. + * This value may also be used by templates in maven style references, READMEs, or other documentation. + * + * @return the git user id + */ + public String getGitUserId() { + return gitUserId; + } + + /** + * Gets git repo id. e.g. openapi-generator. + *

+ * Generally used by git_push.sh in generated sources which support it. + * This value may also be used by templates in maven style references, READMEs, or other documentation. + * + * @return the git repo id + */ + public String getGitRepoId() { + return gitRepoId; + } + + /** + * Gets release note for the generated instance. + *

+ * Generally used by git_push.sh in generated sources which support it. + * This value may also be used by templates in maven style references, READMEs, or other documentation. + * + * @return the release note + */ + public String getReleaseNote() { + return releaseNote; + } + + /** + * Gets the http user agent to be used by client generators which support setting this value. + *

+ * e.g. codegen_csharp_api_client, defaults to 'OpenAPI-Generator/{packageVersion}}/{language}' + * + * @return the http user agent + */ + public String getHttpUserAgent() { + return httpUserAgent; + } + + private GeneratorSettings(Builder builder) { + setDefaults(); + + generatorName = builder.generatorName; + apiPackage = builder.apiPackage; + modelPackage = builder.modelPackage; + invokerPackage = builder.invokerPackage; + packageName = builder.packageName; + modelNamePrefix = builder.modelNamePrefix; + modelNameSuffix = builder.modelNameSuffix; + groupId = builder.groupId; + artifactId = builder.artifactId; + artifactVersion = builder.artifactVersion; + library = builder.library; + instantiationTypes = ImmutableMap.copyOf(builder.instantiationTypes); + typeMappings = ImmutableMap.copyOf(builder.typeMappings); + importMappings = ImmutableMap.copyOf(builder.importMappings); + languageSpecificPrimitives = ImmutableSet.copyOf(builder.languageSpecificPrimitives); + reservedWordMappings = ImmutableMap.copyOf(builder.reservedWordMappings); + gitUserId = builder.gitUserId; + gitRepoId = builder.gitRepoId; + releaseNote = builder.releaseNote; + httpUserAgent = builder.httpUserAgent; + + Map additional = new HashMap<>(builder.additionalProperties); + + if (isNotEmpty(apiPackage)) { + additional.put("apiPackage", apiPackage); + } + if (isNotEmpty(modelPackage)) { + additional.put("modelPackage", modelPackage); + } + if (isNotEmpty(invokerPackage)) { + additional.put("invokerPackage", invokerPackage); + } + if (isNotEmpty(packageName)) { + additional.put("packageName", packageName); + } + if (isNotEmpty(groupId)) { + additional.put("groupId", groupId); + } + if (isNotEmpty(artifactId)) { + additional.put("artifactId", artifactId); + } + if (isNotEmpty(artifactVersion)) { + additional.put("artifactVersion", artifactVersion); + } + if (isNotEmpty(modelNamePrefix)) { + additional.put("modelNamePrefix", modelNamePrefix); + } + if (isNotEmpty(modelNameSuffix)) { + additional.put("modelNameSuffix", modelNameSuffix); + } + if (isNotEmpty(gitUserId)) { + additional.put("gitUserId", gitUserId); + } + if (isNotEmpty(gitRepoId)) { + additional.put("gitRepoId", gitRepoId); + } + if (isNotEmpty(releaseNote)) { + additional.put("releaseNote", releaseNote); + } + if (isNotEmpty(httpUserAgent)) { + additional.put("httpUserAgent", httpUserAgent); + } + + additionalProperties = ImmutableMap.copyOf(additional); + } + + /** + * Instantiates a new Generator settings. + */ + @SuppressWarnings("unused") + public GeneratorSettings() { + setDefaults(); + instantiationTypes = ImmutableMap.of(); + typeMappings = ImmutableMap.of(); + additionalProperties = ImmutableMap.of(); + importMappings = ImmutableMap.of(); + languageSpecificPrimitives = ImmutableSet.of(); + reservedWordMappings = ImmutableMap.of(); + } + + private void setDefaults() { + gitUserId = DEFAULT_GIT_USER_ID; + gitRepoId = DEFAULT_GIT_REPO_ID; + releaseNote = DEFAULT_RELEASE_NOTE; + } + + private boolean isNotEmpty(String value) { + return value != null && value.length() > 0; + } + + /** + * New builder builder. + * + * @return the builder + */ + public static Builder newBuilder() { + return new Builder(); + } + + /** + * New builder builder. + * + * @param copy the copy + * @return the builder + */ + public static Builder newBuilder(GeneratorSettings copy) { + Builder builder = new Builder(); + builder.generatorName = copy.getGeneratorName(); + builder.apiPackage = copy.getApiPackage(); + builder.modelPackage = copy.getModelPackage(); + builder.invokerPackage = copy.getInvokerPackage(); + builder.packageName = copy.getPackageName(); + builder.modelNamePrefix = copy.getModelNamePrefix(); + builder.modelNameSuffix = copy.getModelNameSuffix(); + builder.groupId = copy.getGroupId(); + builder.artifactId = copy.getArtifactId(); + builder.artifactVersion = copy.getArtifactVersion(); + builder.library = copy.getLibrary(); + builder.instantiationTypes = new HashMap<>(copy.getInstantiationTypes()); + builder.typeMappings = new HashMap<>(copy.getTypeMappings()); + builder.additionalProperties = new HashMap<>(copy.getAdditionalProperties()); + builder.importMappings = new HashMap<>(copy.getImportMappings()); + builder.languageSpecificPrimitives = new HashSet<>(copy.getLanguageSpecificPrimitives()); + builder.reservedWordMappings = new HashMap<>(copy.getReservedWordMappings()); + builder.gitUserId = copy.getGitUserId(); + builder.gitRepoId = copy.getGitRepoId(); + builder.releaseNote = copy.getReleaseNote(); + builder.httpUserAgent = copy.getHttpUserAgent(); + + return builder; + } + + /** + * {@code GeneratorSettings} builder static inner class. + */ + @SuppressWarnings("UnusedReturnValue") + public static final class Builder { + private String generatorName; + private String apiPackage; + private String modelPackage; + private String invokerPackage; + private String packageName; + private String modelNamePrefix; + private String modelNameSuffix; + private String groupId; + private String artifactId; + private String artifactVersion; + private String library; + private Map instantiationTypes; + private Map typeMappings; + private Map additionalProperties; + private Map importMappings; + private Set languageSpecificPrimitives; + private Map reservedWordMappings; + private String gitUserId; + private String gitRepoId; + private String releaseNote; + private String httpUserAgent; + + /** + * Instantiates a new Builder. + */ + public Builder() { + instantiationTypes = new HashMap<>(); + typeMappings = new HashMap<>(); + additionalProperties = new HashMap<>(); + importMappings = new HashMap<>(); + languageSpecificPrimitives = new HashSet<>(); + reservedWordMappings = new HashMap<>(); + + gitUserId = DEFAULT_GIT_USER_ID; + gitRepoId = DEFAULT_GIT_REPO_ID; + releaseNote = DEFAULT_RELEASE_NOTE; + } + + /** + * Sets the {@code generatorName} and returns a reference to this Builder so that the methods can be chained together. + * + * @param generatorName the {@code generatorName} to set + * @return a reference to this Builder + */ + public Builder withGeneratorName(String generatorName) { + this.generatorName = generatorName; + return this; + } + + /** + * Sets the {@code apiPackage} and returns a reference to this Builder so that the methods can be chained together. + * + * @param apiPackage the {@code apiPackage} to set + * @return a reference to this Builder + */ + public Builder withApiPackage(String apiPackage) { + this.apiPackage = apiPackage; + return this; + } + + /** + * Sets the {@code modelPackage} and returns a reference to this Builder so that the methods can be chained together. + * + * @param modelPackage the {@code modelPackage} to set + * @return a reference to this Builder + */ + public Builder withModelPackage(String modelPackage) { + this.modelPackage = modelPackage; + return this; + } + + /** + * Sets the {@code invokerPackage} and returns a reference to this Builder so that the methods can be chained together. + * + * @param invokerPackage the {@code invokerPackage} to set + * @return a reference to this Builder + */ + public Builder withInvokerPackage(String invokerPackage) { + this.invokerPackage = invokerPackage; + return this; + } + + /** + * Sets the {@code packageName} and returns a reference to this Builder so that the methods can be chained together. + * + * @param packageName the {@code packageName} to set + * @return a reference to this Builder + */ + public Builder withPackageName(String packageName) { + this.packageName = packageName; + return this; + } + + /** + * Sets the {@code modelNamePrefix} and returns a reference to this Builder so that the methods can be chained together. + * + * @param modelNamePrefix the {@code modelNamePrefix} to set + * @return a reference to this Builder + */ + public Builder withModelNamePrefix(String modelNamePrefix) { + this.modelNamePrefix = modelNamePrefix; + return this; + } + + /** + * Sets the {@code modelNameSuffix} and returns a reference to this Builder so that the methods can be chained together. + * + * @param modelNameSuffix the {@code modelNameSuffix} to set + * @return a reference to this Builder + */ + public Builder withModelNameSuffix(String modelNameSuffix) { + this.modelNameSuffix = modelNameSuffix; + return this; + } + + /** + * Sets the {@code groupId} and returns a reference to this Builder so that the methods can be chained together. + * + * @param groupId the {@code groupId} to set + * @return a reference to this Builder + */ + public Builder withGroupId(String groupId) { + this.groupId = groupId; + return this; + } + + /** + * Sets the {@code artifactId} and returns a reference to this Builder so that the methods can be chained together. + * + * @param artifactId the {@code artifactId} to set + * @return a reference to this Builder + */ + public Builder withArtifactId(String artifactId) { + this.artifactId = artifactId; + return this; + } + + /** + * Sets the {@code artifactVersion} and returns a reference to this Builder so that the methods can be chained together. + * + * @param artifactVersion the {@code artifactVersion} to set + * @return a reference to this Builder + */ + public Builder withArtifactVersion(String artifactVersion) { + this.artifactVersion = artifactVersion; + return this; + } + + /** + * Sets the {@code library} and returns a reference to this Builder so that the methods can be chained together. + * + * @param library the {@code library} to set + * @return a reference to this Builder + */ + public Builder withLibrary(String library) { + this.library = library; + return this; + } + + /** + * Sets the {@code instantiationTypes} and returns a reference to this Builder so that the methods can be chained together. + * + * @param instantiationTypes the {@code instantiationTypes} to set + * @return a reference to this Builder + */ + public Builder withInstantiationTypes(Map instantiationTypes) { + this.instantiationTypes = instantiationTypes; + return this; + } + + /** + * Sets a single {@code instantiationTypes} and returns a reference to this Builder so that the methods can be chained together. + * + * @param key A key for some instantiation type + * @param value The value of some instantiation type + * @return a reference to this Builder + */ + public Builder withInstantiationType(String key, String value) { + if (this.instantiationTypes == null) { + this.instantiationTypes = new HashMap<>(); + } + this.instantiationTypes.put(key, value); + return this; + } + + /** + * Sets the {@code typeMappings} and returns a reference to this Builder so that the methods can be chained together. + * + * @param typeMappings the {@code typeMappings} to set + * @return a reference to this Builder + */ + public Builder withTypeMappings(Map typeMappings) { + this.typeMappings = typeMappings; + return this; + } + + /** + * Sets the {@code additionalProperties} and returns a reference to this Builder so that the methods can be chained together. + * + * @param additionalProperties the {@code additionalProperties} to set + * @return a reference to this Builder + */ + public Builder withAdditionalProperties(Map additionalProperties) { + this.additionalProperties = additionalProperties; + return this; + } + + /** + * Sets the {@code additionalProperties} and returns a reference to this Builder so that the methods can be chained together. + * + * @param key A key for some additional property + * @param value The value of some additional property + * @return a reference to this Builder + */ + public Builder withAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap<>(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Sets the {@code importMappings} and returns a reference to this Builder so that the methods can be chained together. + * + * @param importMappings the {@code importMappings} to set + * @return a reference to this Builder + */ + public Builder withImportMappings(Map importMappings) { + this.importMappings = importMappings; + return this; + } + + /** + * Sets a single {@code importMappings} and returns a reference to this Builder so that the methods can be chained together. + * + * @param key A key for some import mapping + * @param value The value of some import mapping + * @return a reference to this Builder + */ + public Builder withImportMapping(String key, String value) { + if (this.importMappings == null) { + this.importMappings = new HashMap<>(); + } + this.importMappings.put(key, value); + return this; + } + + /** + * Sets the {@code languageSpecificPrimitives} and returns a reference to this Builder so that the methods can be chained together. + * + * @param languageSpecificPrimitives the {@code languageSpecificPrimitives} to set + * @return a reference to this Builder + */ + public Builder withLanguageSpecificPrimitives(Set languageSpecificPrimitives) { + this.languageSpecificPrimitives = languageSpecificPrimitives; + return this; + } + + /** + * Sets a single {@code languageSpecificPrimitives} and returns a reference to this Builder so that the methods can be chained together. + * + * @param value The value of some primitive to set + * @return a reference to this Builder + */ + public Builder withLanguageSpecificPrimitive(String value) { + if (this.languageSpecificPrimitives == null) { + this.languageSpecificPrimitives = new HashSet<>(); + } + this.languageSpecificPrimitives.add(value); + return this; + } + + /** + * Sets the {@code reservedWordMappings} and returns a reference to this Builder so that the methods can be chained together. + * + * @param reservedWordMappings the {@code reservedWordMappings} to set + * @return a reference to this Builder + */ + public Builder withReservedWordMappings(Map reservedWordMappings) { + this.reservedWordMappings = reservedWordMappings; + return this; + } + + /** + * Sets a single {@code reservedWordMappings} and returns a reference to this Builder so that the methods can be chained together. + * + * @param key A key for some reserved word mapping + * @param value The value of some reserved word mapping + * @return a reference to this Builder + */ + public Builder withReservedWordMapping(String key, String value) { + if (this.reservedWordMappings == null) { + this.reservedWordMappings = new HashMap<>(); + } + this.reservedWordMappings.put(key, value); + return this; + } + + /** + * Sets the {@code gitUserId} and returns a reference to this Builder so that the methods can be chained together. + * + * @param gitUserId the {@code gitUserId} to set + * @return a reference to this Builder + */ + public Builder withGitUserId(String gitUserId) { + this.gitUserId = gitUserId; + return this; + } + + /** + * Sets the {@code gitRepoId} and returns a reference to this Builder so that the methods can be chained together. + * + * @param gitRepoId the {@code gitRepoId} to set + * @return a reference to this Builder + */ + public Builder withGitRepoId(String gitRepoId) { + this.gitRepoId = gitRepoId; + return this; + } + + /** + * Sets the {@code releaseNote} and returns a reference to this Builder so that the methods can be chained together. + * + * @param releaseNote the {@code releaseNote} to set + * @return a reference to this Builder + */ + public Builder withReleaseNote(String releaseNote) { + this.releaseNote = releaseNote; + return this; + } + + /** + * Sets the {@code httpUserAgent} and returns a reference to this Builder so that the methods can be chained together. + * + * @param httpUserAgent the {@code httpUserAgent} to set + * @return a reference to this Builder + */ + public Builder withHttpUserAgent(String httpUserAgent) { + this.httpUserAgent = httpUserAgent; + return this; + } + + /** + * Returns a {@code GeneratorSettings} built from the parameters previously set. + * + * @return a {@code GeneratorSettings} built with parameters of this {@code GeneratorSettings.Builder} + */ + public GeneratorSettings build() { + GeneratorSettings instance = new GeneratorSettings(this); + //noinspection PlaceholderCountMatchesArgumentCount + LOGGER.debug("GeneratorSettings#build: %s", instance.toString()); + return instance; + } + } + + @Override + public String toString() { + return "GeneratorSettings{" + + "generatorName='" + generatorName + '\'' + + ", apiPackage='" + apiPackage + '\'' + + ", modelPackage='" + modelPackage + '\'' + + ", invokerPackage='" + invokerPackage + '\'' + + ", packageName='" + packageName + '\'' + + ", modelNamePrefix='" + modelNamePrefix + '\'' + + ", modelNameSuffix='" + modelNameSuffix + '\'' + + ", groupId='" + groupId + '\'' + + ", artifactId='" + artifactId + '\'' + + ", artifactVersion='" + artifactVersion + '\'' + + ", library='" + library + '\'' + + ", instantiationTypes=" + instantiationTypes + + ", typeMappings=" + typeMappings + + ", additionalProperties=" + additionalProperties + + ", importMappings=" + importMappings + + ", languageSpecificPrimitives=" + languageSpecificPrimitives + + ", reservedWordMappings=" + reservedWordMappings + + ", gitUserId='" + gitUserId + '\'' + + ", gitRepoId='" + gitRepoId + '\'' + + ", releaseNote='" + releaseNote + '\'' + + ", httpUserAgent='" + httpUserAgent + '\'' + + '}'; + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (!(o instanceof GeneratorSettings)) return false; + GeneratorSettings that = (GeneratorSettings) o; + return Objects.equals(getGeneratorName(), that.getGeneratorName()) && + Objects.equals(getApiPackage(), that.getApiPackage()) && + Objects.equals(getModelPackage(), that.getModelPackage()) && + Objects.equals(getInvokerPackage(), that.getInvokerPackage()) && + Objects.equals(getPackageName(), that.getPackageName()) && + Objects.equals(getModelNamePrefix(), that.getModelNamePrefix()) && + Objects.equals(getModelNameSuffix(), that.getModelNameSuffix()) && + Objects.equals(getGroupId(), that.getGroupId()) && + Objects.equals(getArtifactId(), that.getArtifactId()) && + Objects.equals(getArtifactVersion(), that.getArtifactVersion()) && + Objects.equals(getLibrary(), that.getLibrary()) && + Objects.equals(getInstantiationTypes(), that.getInstantiationTypes()) && + Objects.equals(getTypeMappings(), that.getTypeMappings()) && + Objects.equals(getAdditionalProperties(), that.getAdditionalProperties()) && + Objects.equals(getImportMappings(), that.getImportMappings()) && + Objects.equals(getLanguageSpecificPrimitives(), that.getLanguageSpecificPrimitives()) && + Objects.equals(getReservedWordMappings(), that.getReservedWordMappings()) && + Objects.equals(getGitUserId(), that.getGitUserId()) && + Objects.equals(getGitRepoId(), that.getGitRepoId()) && + Objects.equals(getReleaseNote(), that.getReleaseNote()) && + Objects.equals(getHttpUserAgent(), that.getHttpUserAgent()); + } + + @Override + public int hashCode() { + return Objects.hash( + getGeneratorName(), + getApiPackage(), + getModelPackage(), + getInvokerPackage(), + getPackageName(), + getModelNamePrefix(), + getModelNameSuffix(), + getGroupId(), + getArtifactId(), + getArtifactVersion(), + getLibrary(), + getInstantiationTypes(), + getTypeMappings(), + getAdditionalProperties(), + getImportMappings(), + getLanguageSpecificPrimitives(), + getReservedWordMappings(), + getGitUserId(), + getGitRepoId(), + getReleaseNote(), + getHttpUserAgent() + ); + } +} diff --git a/modules/openapi-generator-core/src/main/java/org/openapitools/codegen/config/WorkflowSettings.java b/modules/openapi-generator-core/src/main/java/org/openapitools/codegen/config/WorkflowSettings.java new file mode 100644 index 000000000000..2f506ac15ff2 --- /dev/null +++ b/modules/openapi-generator-core/src/main/java/org/openapitools/codegen/config/WorkflowSettings.java @@ -0,0 +1,534 @@ +/* + * Copyright 2019 OpenAPI-Generator Contributors (https://openapi-generator.tech) + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.openapitools.codegen.config; + +import com.google.common.collect.ImmutableMap; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import java.io.File; +import java.nio.file.Paths; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; + +/** + * Represents those settings applied to a generation workflow. + */ +@SuppressWarnings("WeakerAccess") +public class WorkflowSettings { + + private static final Logger LOGGER = LoggerFactory.getLogger(WorkflowSettings.class); + + private String inputSpec; + private String outputDir; + private boolean verbose; + private boolean skipOverwrite; + private boolean removeOperationIdPrefix; + private boolean logToStderr; + private boolean validateSpec; + private boolean enablePostProcessFile; + private boolean enableMinimalUpdate; + private boolean strictSpecBehavior; + private String templateDir; + private String templatingEngineName; + private String ignoreFileOverride; + private ImmutableMap systemProperties; + + private WorkflowSettings(Builder builder) { + setDefaults(); + inputSpec = builder.inputSpec; + outputDir = builder.outputDir; + verbose = builder.verbose; + skipOverwrite = builder.skipOverwrite; + removeOperationIdPrefix = builder.removeOperationIdPrefix; + logToStderr = builder.logToStderr; + validateSpec = builder.validateSpec; + enablePostProcessFile = builder.enablePostProcessFile; + enableMinimalUpdate = builder.enableMinimalUpdate; + strictSpecBehavior = builder.strictSpecBehavior; + templateDir = builder.templateDir; + templatingEngineName = builder.templatingEngineName; + ignoreFileOverride = builder.ignoreFileOverride; + systemProperties = ImmutableMap.copyOf(builder.systemProperties); + } + + /** + * Instantiates a new workflow settings. + */ + @SuppressWarnings("unused") + public WorkflowSettings() { + setDefaults(); + systemProperties = ImmutableMap.of(); + } + + private void setDefaults(){ + validateSpec = true; + strictSpecBehavior = true; + outputDir = "."; + } + + public static Builder newBuilder() { + return new Builder(); + } + + public static Builder newBuilder(WorkflowSettings copy) { + Builder builder = new Builder(); + builder.inputSpec = copy.getInputSpec(); + builder.outputDir = copy.getOutputDir(); + builder.verbose = copy.isVerbose(); + builder.skipOverwrite = copy.isSkipOverwrite(); + builder.removeOperationIdPrefix = copy.isRemoveOperationIdPrefix(); + builder.logToStderr = copy.isLogToStderr(); + builder.validateSpec = copy.isValidateSpec(); + builder.enablePostProcessFile = copy.isEnablePostProcessFile(); + builder.enableMinimalUpdate = copy.isEnableMinimalUpdate(); + builder.strictSpecBehavior = copy.isStrictSpecBehavior(); + builder.templatingEngineName = copy.getTemplatingEngineName(); + builder.ignoreFileOverride = copy.getIgnoreFileOverride(); + builder.systemProperties = ImmutableMap.copyOf(copy.getSystemProperties()); + + // force builder "with" methods to invoke side effects + builder.withTemplateDir(copy.getTemplateDir()); + + return builder; + } + + /** + * Gets input spec's location, as URL or file + * + * @return the input spec + */ + public String getInputSpec() { + return inputSpec; + } + + /** + * Gets the output dir (where we write generated files). Defaults to the current directory. + * + * @return the output dir + */ + public String getOutputDir() { + return outputDir; + } + + /** + * Configures verbosity of generation. When true, more messages will be printed during generation. + * + * @return true if verbose mode, false otherwise. + */ + public boolean isVerbose() { + return verbose; + } + + /** + * Indicates whether or not the existing files should be overwritten during the generation. This option is more rudimentary than + * defining patterns in .openapi-generator-ignore or {@link WorkflowSettings#isEnableMinimalUpdate()}. + * + * @return true if defaulting to overwriting files, false otherwise. + * @see Ignore File Format + */ + public boolean isSkipOverwrite() { + return skipOverwrite; + } + + /** + * Indicates whether or not to remove the prefix of operationId, e.g. config_getId to getId. + * + * @return true if the operation id prefix should be removed during generation, false otherwise. + */ + public boolean isRemoveOperationIdPrefix() { + return removeOperationIdPrefix; + } + + /** + * Indicates whether or not the generator's executor will write all log messages (not just errors) to STDOUT. Useful for + * piping the JSON output of debug options (e.g. -DdebugOperations) to an external parser directly while testing a generator. + * + * @return true if the executor should attempt to write all messages to stderr, + * false otherwise (which defaults to logging configuration, not necessarily stdout). + */ + public boolean isLogToStderr() { + return logToStderr; + } + + /** + * Indicates whether or not generation should also validate an input specification. + *

+ * NOTE: Invalid specs may result in a generation error, disabling may cause unexpected results. + * + * @return true if spec document validation is enabled, otherwise false. Default: true. + */ + public boolean isValidateSpec() { + return validateSpec; + } + + /** + * Indicates whether or not file post-processing is enabled for generators which support it. Refer to individual generator documentation for details. + *

+ * In general, once enabled, a generator will evaluate a command stored in LANG_POST_PROCESS_FILE. + *

+ * For example: + * + * export SCALA_POST_PROCESS_FILE=/usr/local/bin/scalafmt + *

+ * Here, a Scala generator which supports file post-processing will run scalafmt for each generated file. + * + * @return true if file post-processing is enabled, otherwise false. + */ + public boolean isEnablePostProcessFile() { + return enablePostProcessFile; + } + + /** + * Indicates whether or not the generation should update only those files which have changed. + * + * @return true if minimal updates are enabled, otherwise false. + */ + public boolean isEnableMinimalUpdate() { + return enableMinimalUpdate; + } + + /** + * Indicates whether or not 'MUST' and 'SHALL' wording in the api specification is strictly adhered to. + * For example, when false, no automatic 'fixes' will be applied to documents which pass validation but don't follow the spec. + * + * @return true if the generator should attempt to strictly follow rules in the specification, otherwise false. + */ + public boolean isStrictSpecBehavior() { + return strictSpecBehavior; + } + + /** + * Gets the directory holding templates used in generation. This option allows users to extend or modify built-in templates, or to write their own. + * + * @return the template dir + */ + public String getTemplateDir() { + return templateDir; + } + + /** + * Gets the name of the templating engine to target. This option allows a user to target an engine which differs from the generator default, or to + * refer to their own fully qualified type name of a custom template engine adapter. + * + * @return the templating engine name + * @see Custom Engines + */ + public String getTemplatingEngineName() { + return templatingEngineName; + } + + /** + * Gets the override location for the .openapi-generator-ignore file. Most useful on initial generation. + * + * @return the ignore file override + */ + public String getIgnoreFileOverride() { + return ignoreFileOverride; + } + + /** + * Gets system properties applied to the generator. + * + * @return the system properties + */ + public Map getSystemProperties() { + return systemProperties; + } + + /** + * {@code WorkflowSettings} builder static inner class. + */ + @SuppressWarnings("unused") + public static final class Builder { + private String inputSpec; + private String outputDir; + private boolean verbose; + private boolean skipOverwrite; + private boolean removeOperationIdPrefix; + private boolean logToStderr; + private boolean validateSpec; + private boolean enablePostProcessFile; + private boolean enableMinimalUpdate; + private boolean strictSpecBehavior; + private String templateDir; + private String templatingEngineName; + private String ignoreFileOverride; + private Map systemProperties; + + private Builder() { + systemProperties = new HashMap<>(); + } + + /** + * Sets the {@code inputSpec} and returns a reference to this Builder so that the methods can be chained together. + * + * @param inputSpec the {@code inputSpec} to set + * @return a reference to this Builder + */ + public Builder withInputSpec(String inputSpec) { + this.inputSpec = inputSpec; + return this; + } + + /** + * Sets the {@code outputDir} and returns a reference to this Builder so that the methods can be chained together. + * + * @param outputDir the {@code outputDir} to set + * @return a reference to this Builder + */ + public Builder withOutputDir(String outputDir) { + this.outputDir = Paths.get(outputDir).toAbsolutePath().toString();; + return this; + } + + /** + * Sets the {@code verbose} and returns a reference to this Builder so that the methods can be chained together. + * + * @param verbose the {@code verbose} to set + * @return a reference to this Builder + */ + public Builder withVerbose(boolean verbose) { + this.verbose = verbose; + return this; + } + + /** + * Sets the {@code skipOverwrite} and returns a reference to this Builder so that the methods can be chained together. + * + * @param skipOverwrite the {@code skipOverwrite} to set + * @return a reference to this Builder + */ + public Builder withSkipOverwrite(boolean skipOverwrite) { + this.skipOverwrite = skipOverwrite; + return this; + } + + /** + * Sets the {@code removeOperationIdPrefix} and returns a reference to this Builder so that the methods can be chained together. + * + * @param removeOperationIdPrefix the {@code removeOperationIdPrefix} to set + * @return a reference to this Builder + */ + public Builder withRemoveOperationIdPrefix(boolean removeOperationIdPrefix) { + this.removeOperationIdPrefix = removeOperationIdPrefix; + return this; + } + + /** + * Sets the {@code logToStderr} and returns a reference to this Builder so that the methods can be chained together. + * + * @param logToStderr the {@code logToStderr} to set + * @return a reference to this Builder + */ + public Builder withLogToStderr(boolean logToStderr) { + this.logToStderr = logToStderr; + return this; + } + + /** + * Sets the {@code validateSpec} and returns a reference to this Builder so that the methods can be chained together. + * + * @param validateSpec the {@code validateSpec} to set + * @return a reference to this Builder + */ + public Builder withValidateSpec(boolean validateSpec) { + this.validateSpec = validateSpec; + return this; + } + + /** + * Sets the {@code enablePostProcessFile} and returns a reference to this Builder so that the methods can be chained together. + * + * @param enablePostProcessFile the {@code enablePostProcessFile} to set + * @return a reference to this Builder + */ + public Builder withEnablePostProcessFile(boolean enablePostProcessFile) { + this.enablePostProcessFile = enablePostProcessFile; + return this; + } + + /** + * Sets the {@code enableMinimalUpdate} and returns a reference to this Builder so that the methods can be chained together. + * + * @param enableMinimalUpdate the {@code enableMinimalUpdate} to set + * @return a reference to this Builder + */ + public Builder withEnableMinimalUpdate(boolean enableMinimalUpdate) { + this.enableMinimalUpdate = enableMinimalUpdate; + return this; + } + + /** + * Sets the {@code strictSpecBehavior} and returns a reference to this Builder so that the methods can be chained together. + * + * @param strictSpecBehavior the {@code strictSpecBehavior} to set + * @return a reference to this Builder + */ + public Builder withStrictSpecBehavior(boolean strictSpecBehavior) { + this.strictSpecBehavior = strictSpecBehavior; + return this; + } + + /** + * Sets the {@code templateDir} and returns a reference to this Builder so that the methods can be chained together. + * + * @param templateDir the {@code templateDir} to set + * @return a reference to this Builder + */ + public Builder withTemplateDir(String templateDir) { + if (templateDir == null) { + this.templateDir = null; + } else { + File f = new File(templateDir); + + // check to see if the folder exists + if (!(f.exists() && f.isDirectory())) { + throw new IllegalArgumentException( + "Template directory " + templateDir + " does not exist."); + } + + this.templateDir = Paths.get(f.toURI()).toAbsolutePath().toString(); + } + + return this; + } + + /** + * Sets the {@code templatingEngineName} and returns a reference to this Builder so that the methods can be chained together. + * + * @param templatingEngineName the {@code templatingEngineName} to set + * @return a reference to this Builder + */ + public Builder withTemplatingEngineName(String templatingEngineName) { + this.templatingEngineName = templatingEngineName; + return this; + } + + /** + * Sets the {@code ignoreFileOverride} and returns a reference to this Builder so that the methods can be chained together. + * + * @param ignoreFileOverride the {@code ignoreFileOverride} to set + * @return a reference to this Builder + */ + public Builder withIgnoreFileOverride(String ignoreFileOverride) { + this.ignoreFileOverride = ignoreFileOverride; + return this; + } + + /** + * Sets the {@code systemProperties} and returns a reference to this Builder so that the methods can be chained together. + * + * @param systemProperties the {@code systemProperties} to set + * @return a reference to this Builder + */ + public Builder withSystemProperties(Map systemProperties) { + this.systemProperties = systemProperties; + return this; + } + + /** + * Sets the {@code systemProperties} and returns a reference to this Builder so that the methods can be chained together. + * + * @param key The key of a system (global) property to set + * @param value The value of a system (global) property to set + * @return a reference to this Builder + */ + public Builder withSystemProperty(String key, String value) { + if (this.systemProperties == null) { + this.systemProperties = new HashMap<>(); + } + this.systemProperties.put(key, value); + return this; + } + + /** + * Returns a {@code WorkflowSettings} built from the parameters previously set. + * + * @return a {@code WorkflowSettings} built with parameters of this {@code WorkflowSettings.Builder} + */ + public WorkflowSettings build() { + WorkflowSettings instance = new WorkflowSettings(this); + //noinspection PlaceholderCountMatchesArgumentCount + LOGGER.debug("WorkflowSettings#build: %s", instance.toString()); + return instance; + } + } + + + @Override + public String toString() { + return "WorkflowSettings{" + + "inputSpec='" + inputSpec + '\'' + + ", outputDir='" + outputDir + '\'' + + ", verbose=" + verbose + + ", skipOverwrite=" + skipOverwrite + + ", removeOperationIdPrefix=" + removeOperationIdPrefix + + ", logToStderr=" + logToStderr + + ", validateSpec=" + validateSpec + + ", enablePostProcessFile=" + enablePostProcessFile + + ", enableMinimalUpdate=" + enableMinimalUpdate + + ", strictSpecBehavior=" + strictSpecBehavior + + ", templateDir='" + templateDir + '\'' + + ", templatingEngineName='" + templatingEngineName + '\'' + + ", ignoreFileOverride='" + ignoreFileOverride + '\'' + + ", systemProperties=" + systemProperties + + '}'; + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (!(o instanceof WorkflowSettings)) return false; + WorkflowSettings that = (WorkflowSettings) o; + return isVerbose() == that.isVerbose() && + isSkipOverwrite() == that.isSkipOverwrite() && + isRemoveOperationIdPrefix() == that.isRemoveOperationIdPrefix() && + isLogToStderr() == that.isLogToStderr() && + isValidateSpec() == that.isValidateSpec() && + isEnablePostProcessFile() == that.isEnablePostProcessFile() && + isEnableMinimalUpdate() == that.isEnableMinimalUpdate() && + isStrictSpecBehavior() == that.isStrictSpecBehavior() && + Objects.equals(getInputSpec(), that.getInputSpec()) && + Objects.equals(getOutputDir(), that.getOutputDir()) && + Objects.equals(getTemplateDir(), that.getTemplateDir()) && + Objects.equals(getTemplatingEngineName(), that.getTemplatingEngineName()) && + Objects.equals(getIgnoreFileOverride(), that.getIgnoreFileOverride()) && + Objects.equals(getSystemProperties(), that.getSystemProperties()); + } + + @Override + public int hashCode() { + return Objects.hash( + getInputSpec(), + getOutputDir(), + isVerbose(), + isSkipOverwrite(), + isRemoveOperationIdPrefix(), + isLogToStderr(), + isValidateSpec(), + isEnablePostProcessFile(), + isEnableMinimalUpdate(), + isStrictSpecBehavior(), + getTemplateDir(), + getTemplatingEngineName(), + getIgnoreFileOverride(), + getSystemProperties() + ); + } +} diff --git a/modules/openapi-generator-core/src/main/java/org/openapitools/codegen/meta/GeneratorMetadata.java b/modules/openapi-generator-core/src/main/java/org/openapitools/codegen/meta/GeneratorMetadata.java index 0c87104c7b5e..4bd538a231d5 100644 --- a/modules/openapi-generator-core/src/main/java/org/openapitools/codegen/meta/GeneratorMetadata.java +++ b/modules/openapi-generator-core/src/main/java/org/openapitools/codegen/meta/GeneratorMetadata.java @@ -1,3 +1,19 @@ +/* + * Copyright 2019 OpenAPI-Generator Contributors (https://openapi-generator.tech) + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package org.openapitools.codegen.meta; /** diff --git a/modules/openapi-generator-core/src/main/java/org/openapitools/codegen/meta/Stability.java b/modules/openapi-generator-core/src/main/java/org/openapitools/codegen/meta/Stability.java index 6e12c64f7d15..8547ea9b10d0 100644 --- a/modules/openapi-generator-core/src/main/java/org/openapitools/codegen/meta/Stability.java +++ b/modules/openapi-generator-core/src/main/java/org/openapitools/codegen/meta/Stability.java @@ -1,3 +1,19 @@ +/* + * Copyright 2019 OpenAPI-Generator Contributors (https://openapi-generator.tech) + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package org.openapitools.codegen.meta; /** diff --git a/modules/openapi-generator-gradle-plugin/src/main/kotlin/org/openapitools/generator/gradle/plugin/tasks/GenerateTask.kt b/modules/openapi-generator-gradle-plugin/src/main/kotlin/org/openapitools/generator/gradle/plugin/tasks/GenerateTask.kt index 28a512dd0067..79e20d867ab8 100644 --- a/modules/openapi-generator-gradle-plugin/src/main/kotlin/org/openapitools/generator/gradle/plugin/tasks/GenerateTask.kt +++ b/modules/openapi-generator-gradle-plugin/src/main/kotlin/org/openapitools/generator/gradle/plugin/tasks/GenerateTask.kt @@ -28,7 +28,7 @@ import org.gradle.kotlin.dsl.property import org.openapitools.codegen.CodegenConstants import org.openapitools.codegen.DefaultGenerator import org.openapitools.codegen.config.CodegenConfigurator -import org.openapitools.codegen.config.GeneratorProperties +import org.openapitools.codegen.config.GlobalSettings /** @@ -40,6 +40,7 @@ import org.openapitools.codegen.config.GeneratorProperties * * @author Jim Schubert */ +@Suppress("UnstableApiUsage") open class GenerateTask : DefaultTask() { /** @@ -392,146 +393,146 @@ open class GenerateTask : DefaultTask() { } if (supportingFilesConstrainedTo.isPresent && supportingFilesConstrainedTo.get().isNotEmpty()) { - GeneratorProperties.setProperty(CodegenConstants.SUPPORTING_FILES, supportingFilesConstrainedTo.get().joinToString(",")) + GlobalSettings.setProperty(CodegenConstants.SUPPORTING_FILES, supportingFilesConstrainedTo.get().joinToString(",")) } else { - GeneratorProperties.clearProperty(CodegenConstants.SUPPORTING_FILES) + GlobalSettings.clearProperty(CodegenConstants.SUPPORTING_FILES) } if (modelFilesConstrainedTo.isPresent && modelFilesConstrainedTo.get().isNotEmpty()) { - GeneratorProperties.setProperty(CodegenConstants.MODELS, modelFilesConstrainedTo.get().joinToString(",")) + GlobalSettings.setProperty(CodegenConstants.MODELS, modelFilesConstrainedTo.get().joinToString(",")) } else { - GeneratorProperties.clearProperty(CodegenConstants.MODELS) + GlobalSettings.clearProperty(CodegenConstants.MODELS) } if (apiFilesConstrainedTo.isPresent && apiFilesConstrainedTo.get().isNotEmpty()) { - GeneratorProperties.setProperty(CodegenConstants.APIS, apiFilesConstrainedTo.get().joinToString(",")) + GlobalSettings.setProperty(CodegenConstants.APIS, apiFilesConstrainedTo.get().joinToString(",")) } else { - GeneratorProperties.clearProperty(CodegenConstants.APIS) + GlobalSettings.clearProperty(CodegenConstants.APIS) } if (generateApiDocumentation.isPresent) { - GeneratorProperties.setProperty(CodegenConstants.API_DOCS, generateApiDocumentation.get().toString()) + GlobalSettings.setProperty(CodegenConstants.API_DOCS, generateApiDocumentation.get().toString()) } if (generateModelDocumentation.isPresent) { - GeneratorProperties.setProperty(CodegenConstants.MODEL_DOCS, generateModelDocumentation.get().toString()) + GlobalSettings.setProperty(CodegenConstants.MODEL_DOCS, generateModelDocumentation.get().toString()) } if (generateModelTests.isPresent) { - GeneratorProperties.setProperty(CodegenConstants.MODEL_TESTS, generateModelTests.get().toString()) + GlobalSettings.setProperty(CodegenConstants.MODEL_TESTS, generateModelTests.get().toString()) } if (generateApiTests.isPresent) { - GeneratorProperties.setProperty(CodegenConstants.API_TESTS, generateApiTests.get().toString()) + GlobalSettings.setProperty(CodegenConstants.API_TESTS, generateApiTests.get().toString()) } if (withXml.isPresent) { - GeneratorProperties.setProperty(CodegenConstants.WITH_XML, withXml.get().toString()) + GlobalSettings.setProperty(CodegenConstants.WITH_XML, withXml.get().toString()) } // now override with any specified parameters verbose.ifNotEmpty { value -> - configurator.isVerbose = value + configurator.setVerbose(value) } validateSpec.ifNotEmpty { value -> - configurator.isValidateSpec = value + configurator.setValidateSpec(value) } skipOverwrite.ifNotEmpty { value -> - configurator.isSkipOverwrite = value ?: false + configurator.setSkipOverwrite(value ?: false) } inputSpec.ifNotEmpty { value -> - configurator.inputSpec = value + configurator.setInputSpec(value) } generatorName.ifNotEmpty { value -> - configurator.generatorName = value + configurator.setGeneratorName(value) } outputDir.ifNotEmpty { value -> - configurator.outputDir = value + configurator.setOutputDir(value) } auth.ifNotEmpty { value -> - configurator.auth = value + configurator.setAuth(value) } templateDir.ifNotEmpty { value -> - configurator.templateDir = value + configurator.setTemplateDir(value) } packageName.ifNotEmpty { value -> - configurator.packageName = value + configurator.setPackageName(value) } apiPackage.ifNotEmpty { value -> - configurator.apiPackage = value + configurator.setApiPackage(value) } modelPackage.ifNotEmpty { value -> - configurator.modelPackage = value + configurator.setModelPackage(value) } modelNamePrefix.ifNotEmpty { value -> - configurator.modelNamePrefix = value + configurator.setModelNamePrefix(value) } modelNameSuffix.ifNotEmpty { value -> - configurator.modelNameSuffix = value + configurator.setModelNameSuffix(value) } invokerPackage.ifNotEmpty { value -> - configurator.invokerPackage = value + configurator.setInvokerPackage(value) } groupId.ifNotEmpty { value -> - configurator.groupId = value + configurator.setGroupId(value) } id.ifNotEmpty { value -> - configurator.artifactId = value + configurator.setArtifactId(value) } version.ifNotEmpty { value -> - configurator.artifactVersion = value + configurator.setArtifactVersion(value) } library.ifNotEmpty { value -> - configurator.library = value + configurator.setLibrary(value) } gitUserId.ifNotEmpty { value -> - configurator.gitUserId = value + configurator.setGitUserId(value) } gitRepoId.ifNotEmpty { value -> - configurator.gitRepoId = value + configurator.setGitRepoId(value) } releaseNote.ifNotEmpty { value -> - configurator.releaseNote = value + configurator.setReleaseNote(value) } httpUserAgent.ifNotEmpty { value -> - configurator.httpUserAgent = value + configurator.setHttpUserAgent(value) } ignoreFileOverride.ifNotEmpty { value -> - configurator.ignoreFileOverride = value + configurator.setIgnoreFileOverride(value) } removeOperationIdPrefix.ifNotEmpty { value -> - configurator.removeOperationIdPrefix = value!! + configurator.setRemoveOperationIdPrefix(value!!) } logToStderr.ifNotEmpty { value -> - configurator.logToStderr = value + configurator.setLogToStderr(value) } enablePostProcessFile.ifNotEmpty { value -> - configurator.enablePostProcessFile = value + configurator.setEnablePostProcessFile(value) } skipValidateSpec.ifNotEmpty { value -> @@ -602,12 +603,12 @@ open class GenerateTask : DefaultTask() { DefaultGenerator().opts(clientOptInput).generate() - out.println("Successfully generated code to ${configurator.outputDir}") + out.println("Successfully generated code to $outputDir") } catch (e: RuntimeException) { throw GradleException("Code generation failed.", e) } } finally { - GeneratorProperties.reset() + GlobalSettings.reset() } } } diff --git a/modules/openapi-generator-maven-plugin/examples/java-client.xml b/modules/openapi-generator-maven-plugin/examples/java-client.xml index 0d6d91acadd9..9d08aecd05e5 100644 --- a/modules/openapi-generator-maven-plugin/examples/java-client.xml +++ b/modules/openapi-generator-maven-plugin/examples/java-client.xml @@ -46,6 +46,7 @@ 1.7 1.7 + none diff --git a/modules/openapi-generator-maven-plugin/examples/multi-module/java-client/pom.xml b/modules/openapi-generator-maven-plugin/examples/multi-module/java-client/pom.xml index 1b1e28ee071d..06e6b7216730 100644 --- a/modules/openapi-generator-maven-plugin/examples/multi-module/java-client/pom.xml +++ b/modules/openapi-generator-maven-plugin/examples/multi-module/java-client/pom.xml @@ -59,6 +59,7 @@ 1.7 1.7 + none diff --git a/modules/openapi-generator-maven-plugin/src/main/java/org/openapitools/codegen/plugin/CodeGenMojo.java b/modules/openapi-generator-maven-plugin/src/main/java/org/openapitools/codegen/plugin/CodeGenMojo.java index 7ac66dc4da46..16689b1c15da 100644 --- a/modules/openapi-generator-maven-plugin/src/main/java/org/openapitools/codegen/plugin/CodeGenMojo.java +++ b/modules/openapi-generator-maven-plugin/src/main/java/org/openapitools/codegen/plugin/CodeGenMojo.java @@ -54,7 +54,7 @@ import org.openapitools.codegen.CodegenConstants; import org.openapitools.codegen.DefaultGenerator; import org.openapitools.codegen.config.CodegenConfigurator; -import org.openapitools.codegen.config.GeneratorProperties; +import org.openapitools.codegen.config.GlobalSettings; import org.sonatype.plexus.build.incremental.BuildContext; import org.sonatype.plexus.build.incremental.DefaultBuildContext; import org.slf4j.Logger; @@ -562,28 +562,28 @@ public void execute() throws MojoExecutionException { // Set generation options if (null != generateApis && generateApis) { - GeneratorProperties.setProperty(CodegenConstants.APIS, ""); + GlobalSettings.setProperty(CodegenConstants.APIS, ""); } else { - GeneratorProperties.clearProperty(CodegenConstants.APIS); + GlobalSettings.clearProperty(CodegenConstants.APIS); } if (null != generateModels && generateModels) { - GeneratorProperties.setProperty(CodegenConstants.MODELS, modelsToGenerate); + GlobalSettings.setProperty(CodegenConstants.MODELS, modelsToGenerate); } else { - GeneratorProperties.clearProperty(CodegenConstants.MODELS); + GlobalSettings.clearProperty(CodegenConstants.MODELS); } if (null != generateSupportingFiles && generateSupportingFiles) { - GeneratorProperties.setProperty(CodegenConstants.SUPPORTING_FILES, supportingFilesToGenerate); + GlobalSettings.setProperty(CodegenConstants.SUPPORTING_FILES, supportingFilesToGenerate); } else { - GeneratorProperties.clearProperty(CodegenConstants.SUPPORTING_FILES); + GlobalSettings.clearProperty(CodegenConstants.SUPPORTING_FILES); } - GeneratorProperties.setProperty(CodegenConstants.MODEL_TESTS, generateModelTests.toString()); - GeneratorProperties.setProperty(CodegenConstants.MODEL_DOCS, generateModelDocumentation.toString()); - GeneratorProperties.setProperty(CodegenConstants.API_TESTS, generateApiTests.toString()); - GeneratorProperties.setProperty(CodegenConstants.API_DOCS, generateApiDocumentation.toString()); - GeneratorProperties.setProperty(CodegenConstants.WITH_XML, withXml.toString()); + GlobalSettings.setProperty(CodegenConstants.MODEL_TESTS, generateModelTests.toString()); + GlobalSettings.setProperty(CodegenConstants.MODEL_DOCS, generateModelDocumentation.toString()); + GlobalSettings.setProperty(CodegenConstants.API_TESTS, generateApiTests.toString()); + GlobalSettings.setProperty(CodegenConstants.API_DOCS, generateApiDocumentation.toString()); + GlobalSettings.setProperty(CodegenConstants.WITH_XML, withXml.toString()); if (configOptions != null) { // Retained for backwards-compataibility with configOptions -> instantiation-types @@ -656,13 +656,13 @@ public void execute() throws MojoExecutionException { if (environmentVariables != null) { for (String key : environmentVariables.keySet()) { - originalEnvironmentVariables.put(key, GeneratorProperties.getProperty(key)); + originalEnvironmentVariables.put(key, GlobalSettings.getProperty(key)); String value = environmentVariables.get(key); if (value == null) { // don't put null values value = ""; } - GeneratorProperties.setProperty(key, value); + GlobalSettings.setProperty(key, value); configurator.addSystemProperty(key, value); } } @@ -748,9 +748,9 @@ private void addCompileSourceRootIfConfigured() { // when running the plugin multiple consecutive times with different configurations. for (Map.Entry entry : originalEnvironmentVariables.entrySet()) { if (entry.getValue() == null) { - GeneratorProperties.clearProperty(entry.getKey()); + GlobalSettings.clearProperty(entry.getKey()); } else { - GeneratorProperties.setProperty(entry.getKey(), entry.getValue()); + GlobalSettings.setProperty(entry.getKey(), entry.getValue()); } } } diff --git a/modules/openapi-generator-online/src/main/java/org/openapitools/codegen/online/service/Generator.java b/modules/openapi-generator-online/src/main/java/org/openapitools/codegen/online/service/Generator.java index 557d74a8197c..dd6095649183 100644 --- a/modules/openapi-generator-online/src/main/java/org/openapitools/codegen/online/service/Generator.java +++ b/modules/openapi-generator-online/src/main/java/org/openapitools/codegen/online/service/Generator.java @@ -25,7 +25,6 @@ import io.swagger.v3.parser.core.models.ParseOptions; import org.openapitools.codegen.CliOption; import org.openapitools.codegen.ClientOptInput; -import org.openapitools.codegen.ClientOpts; import org.openapitools.codegen.CodegenConfig; import org.openapitools.codegen.CodegenConfigLoader; import org.openapitools.codegen.DefaultGenerator; @@ -129,11 +128,10 @@ private static String generate(String language, GeneratorInput opts, Type type) } ClientOptInput clientOptInput = new ClientOptInput(); - ClientOpts clientOpts = new ClientOpts(); String outputFolder = getTmpFolder().getAbsolutePath() + File.separator + destPath; String outputFilename = outputFolder + "-bundle.zip"; - clientOptInput.opts(clientOpts).openAPI(openapi); + clientOptInput.openAPI(openapi); CodegenConfig codegenConfig; try { @@ -149,8 +147,6 @@ private static String generate(String language, GeneratorInput opts, Type type) codegenConfig.setOutputDir(outputFolder); - LOGGER.debug(Json.pretty(clientOpts)); - clientOptInput.setConfig(codegenConfig); try { diff --git a/modules/openapi-generator/pom.xml b/modules/openapi-generator/pom.xml index 53fc6efe312b..9b19bc2320e7 100644 --- a/modules/openapi-generator/pom.xml +++ b/modules/openapi-generator/pom.xml @@ -255,6 +255,11 @@ guava ${guava-version} + + com.fasterxml.jackson.datatype + jackson-datatype-guava + ${jackson-version} + org.testng testng diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/ClientOptInput.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/ClientOptInput.java index 2c7568589b71..8453c1c9051f 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/ClientOptInput.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/ClientOptInput.java @@ -25,22 +25,16 @@ public class ClientOptInput { private CodegenConfig config; - private ClientOpts opts; private OpenAPI openAPI; private List auths; public ClientOptInput openAPI(OpenAPI openAPI) { - this.setOpenAPI(openAPI); - return this; - } - - public ClientOptInput opts(ClientOpts opts) { - this.setOpts(opts); + this.openAPI = openAPI; return this; } public ClientOptInput config(CodegenConfig codegenConfig) { - this.setConfig(codegenConfig); + this.config = codegenConfig; return this; } @@ -65,26 +59,22 @@ public List getAuthorizationValues() { return auths; } + @Deprecated public CodegenConfig getConfig() { return config; } + @Deprecated public void setConfig(CodegenConfig config) { this.config = config; } - public ClientOpts getOpts() { - return opts; - } - - public void setOpts(ClientOpts opts) { - this.opts = opts; - } - + @Deprecated public OpenAPI getOpenAPI() { return openAPI; } + @Deprecated public void setOpenAPI(OpenAPI openAPI) { this.openAPI = openAPI; } diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/ClientOpts.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/ClientOpts.java deleted file mode 100644 index 00a4f291ddb5..000000000000 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/ClientOpts.java +++ /dev/null @@ -1,93 +0,0 @@ -/* - * Copyright 2018 OpenAPI-Generator Contributors (https://openapi-generator.tech) - * Copyright 2018 SmartBear Software - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.openapitools.codegen; - -import org.openapitools.codegen.auth.AuthMethod; - -import java.util.HashMap; -import java.util.Map; -import java.util.Objects; - -public class ClientOpts { - protected String uri; - protected String target; - protected AuthMethod auth; - protected Map properties = new HashMap(); - protected String outputDirectory; - - public String getUri() { - return uri; - } - - public void setUri(String uri) { - this.uri = uri; - } - - public String getTarget() { - return target; - } - - public void setTarget(String target) { - this.target = target; - } - - public Map getProperties() { - return properties; - } - - public void setProperties(Map properties) { - this.properties = properties; - } - - public String getOutputDirectory() { - return outputDirectory; - } - - public void setOutputDirectory(String outputDirectory) { - this.outputDirectory = outputDirectory; - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("ClientOpts: {\n"); - sb.append(" uri: ").append(uri).append(","); - sb.append(" auth: ").append(auth).append(","); - sb.append(properties); - sb.append("}"); - return sb.toString(); - } - - @Override - public boolean equals(Object o) { - if (this == o) return true; - if (o == null || getClass() != o.getClass()) return false; - - ClientOpts that = (ClientOpts) o; - return Objects.equals(uri, that.uri) && - Objects.equals(target, that.target) && - Objects.equals(auth, that.auth) && - Objects.equals(properties, that.properties) && - Objects.equals(outputDirectory, that.outputDirectory); - } - - @Override - public int hashCode() { - return Objects.hash(uri, target, auth, properties, outputDirectory); - } -} diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/DefaultCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/DefaultCodegen.java index 96cc49981007..e3853ced333a 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/DefaultCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/DefaultCodegen.java @@ -42,7 +42,7 @@ import org.apache.commons.lang3.tuple.Pair; import org.openapitools.codegen.CodegenDiscriminator.MappedModel; import org.openapitools.codegen.api.TemplatingEngineAdapter; -import org.openapitools.codegen.config.GeneratorProperties; +import org.openapitools.codegen.config.GlobalSettings; import org.openapitools.codegen.examples.ExampleGenerator; import org.openapitools.codegen.meta.GeneratorMetadata; import org.openapitools.codegen.meta.Stability; @@ -2932,7 +2932,7 @@ public CodegenParameter fromParameter(Parameter parameter, Set imports) } codegenParameter.jsonSchema = Json.pretty(parameter); - if (GeneratorProperties.getProperty("debugParser") != null) { + if (GlobalSettings.getProperty("debugParser") != null) { LOGGER.info("working on Parameter " + parameter.getName()); LOGGER.info("JSON schema: " + codegenParameter.jsonSchema); } diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/DefaultGenerator.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/DefaultGenerator.java index 1226eaba9fe3..e5543419921f 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/DefaultGenerator.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/DefaultGenerator.java @@ -32,13 +32,12 @@ import org.apache.commons.io.IOUtils; import org.apache.commons.lang3.ObjectUtils; import org.apache.commons.lang3.StringUtils; -import org.openapitools.codegen.config.GeneratorProperties; +import org.openapitools.codegen.config.GlobalSettings; import org.openapitools.codegen.api.TemplatingEngineAdapter; import org.openapitools.codegen.ignore.CodegenIgnoreProcessor; import org.openapitools.codegen.meta.GeneratorMetadata; import org.openapitools.codegen.meta.Stability; import org.openapitools.codegen.templating.MustacheEngineAdapter; -import org.openapitools.codegen.config.GeneratorProperties; import org.openapitools.codegen.utils.ImplementationVersion; import org.openapitools.codegen.utils.ModelUtils; import org.openapitools.codegen.utils.URLPathUtils; @@ -81,7 +80,6 @@ public Generator opts(ClientOptInput opts) { this.opts = opts; this.openAPI = opts.getOpenAPI(); this.config = opts.getConfig(); - this.config.additionalProperties().putAll(opts.getOpts().getProperties()); this.templatingEngine = this.config.getTemplatingEngine(); String ignoreFileLocation = this.config.getIgnoreFilePathOverride(); @@ -145,9 +143,9 @@ private Boolean getGeneratorPropertyDefaultSwitch(final String key, final Boolea private void configureGeneratorProperties() { // allows generating only models by specifying a CSV of models to generate, or empty for all // NOTE: Boolean.TRUE is required below rather than `true` because of JVM boxing constraints and type inference. - generateApis = GeneratorProperties.getProperty(CodegenConstants.APIS) != null ? Boolean.TRUE : getGeneratorPropertyDefaultSwitch(CodegenConstants.APIS, null); - generateModels = GeneratorProperties.getProperty(CodegenConstants.MODELS) != null ? Boolean.TRUE : getGeneratorPropertyDefaultSwitch(CodegenConstants.MODELS, null); - generateSupportingFiles = GeneratorProperties.getProperty(CodegenConstants.SUPPORTING_FILES) != null ? Boolean.TRUE : getGeneratorPropertyDefaultSwitch(CodegenConstants.SUPPORTING_FILES, null); + generateApis = GlobalSettings.getProperty(CodegenConstants.APIS) != null ? Boolean.TRUE : getGeneratorPropertyDefaultSwitch(CodegenConstants.APIS, null); + generateModels = GlobalSettings.getProperty(CodegenConstants.MODELS) != null ? Boolean.TRUE : getGeneratorPropertyDefaultSwitch(CodegenConstants.MODELS, null); + generateSupportingFiles = GlobalSettings.getProperty(CodegenConstants.SUPPORTING_FILES) != null ? Boolean.TRUE : getGeneratorPropertyDefaultSwitch(CodegenConstants.SUPPORTING_FILES, null); if (generateApis == null && generateModels == null && generateSupportingFiles == null) { // no specifics are set, generate everything @@ -165,10 +163,10 @@ private void configureGeneratorProperties() { } // model/api tests and documentation options rely on parent generate options (api or model) and no other options. // They default to true in all scenarios and can only be marked false explicitly - generateModelTests = GeneratorProperties.getProperty(CodegenConstants.MODEL_TESTS) != null ? Boolean.valueOf(GeneratorProperties.getProperty(CodegenConstants.MODEL_TESTS)) : getGeneratorPropertyDefaultSwitch(CodegenConstants.MODEL_TESTS, true); - generateModelDocumentation = GeneratorProperties.getProperty(CodegenConstants.MODEL_DOCS) != null ? Boolean.valueOf(GeneratorProperties.getProperty(CodegenConstants.MODEL_DOCS)) : getGeneratorPropertyDefaultSwitch(CodegenConstants.MODEL_DOCS, true); - generateApiTests = GeneratorProperties.getProperty(CodegenConstants.API_TESTS) != null ? Boolean.valueOf(GeneratorProperties.getProperty(CodegenConstants.API_TESTS)) : getGeneratorPropertyDefaultSwitch(CodegenConstants.API_TESTS, true); - generateApiDocumentation = GeneratorProperties.getProperty(CodegenConstants.API_DOCS) != null ? Boolean.valueOf(GeneratorProperties.getProperty(CodegenConstants.API_DOCS)) : getGeneratorPropertyDefaultSwitch(CodegenConstants.API_DOCS, true); + generateModelTests = GlobalSettings.getProperty(CodegenConstants.MODEL_TESTS) != null ? Boolean.valueOf(GlobalSettings.getProperty(CodegenConstants.MODEL_TESTS)) : getGeneratorPropertyDefaultSwitch(CodegenConstants.MODEL_TESTS, true); + generateModelDocumentation = GlobalSettings.getProperty(CodegenConstants.MODEL_DOCS) != null ? Boolean.valueOf(GlobalSettings.getProperty(CodegenConstants.MODEL_DOCS)) : getGeneratorPropertyDefaultSwitch(CodegenConstants.MODEL_DOCS, true); + generateApiTests = GlobalSettings.getProperty(CodegenConstants.API_TESTS) != null ? Boolean.valueOf(GlobalSettings.getProperty(CodegenConstants.API_TESTS)) : getGeneratorPropertyDefaultSwitch(CodegenConstants.API_TESTS, true); + generateApiDocumentation = GlobalSettings.getProperty(CodegenConstants.API_DOCS) != null ? Boolean.valueOf(GlobalSettings.getProperty(CodegenConstants.API_DOCS)) : getGeneratorPropertyDefaultSwitch(CodegenConstants.API_DOCS, true); // Additional properties added for tests to exclude references in project related files config.additionalProperties().put(CodegenConstants.GENERATE_API_TESTS, generateApiTests); @@ -184,9 +182,9 @@ private void configureGeneratorProperties() { config.additionalProperties().put(CodegenConstants.EXCLUDE_TESTS, true); } - if (GeneratorProperties.getProperty("debugOpenAPI") != null) { + if (GlobalSettings.getProperty("debugOpenAPI") != null) { Json.prettyPrint(openAPI); - } else if (GeneratorProperties.getProperty("debugSwagger") != null) { + } else if (GlobalSettings.getProperty("debugSwagger") != null) { // This exists for backward compatibility // We fall to this block only if debugOpenAPI is null. No need to dump this twice. LOGGER.info("Please use system property 'debugOpenAPI' instead of 'debugSwagger'."); @@ -344,7 +342,7 @@ private void generateModels(List files, List allModels, List modelsToGenerate = null; if (modelNames != null && !modelNames.isEmpty()) { modelsToGenerate = new HashSet(Arrays.asList(modelNames.split(","))); @@ -417,8 +415,8 @@ private Model getParent(Model model) { } */ }); - Boolean skipFormModel = GeneratorProperties.getProperty(CodegenConstants.SKIP_FORM_MODEL) != null ? - Boolean.valueOf(GeneratorProperties.getProperty(CodegenConstants.SKIP_FORM_MODEL)) : + Boolean skipFormModel = GlobalSettings.getProperty(CodegenConstants.SKIP_FORM_MODEL) != null ? + Boolean.valueOf(GlobalSettings.getProperty(CodegenConstants.SKIP_FORM_MODEL)) : getGeneratorPropertyDefaultSwitch(CodegenConstants.SKIP_FORM_MODEL, false); // process models only @@ -514,7 +512,7 @@ private Model getParent(Model model) { throw new RuntimeException("Could not generate model '" + modelName + "'", e); } } - if (GeneratorProperties.getProperty("debugModels") != null) { + if (GlobalSettings.getProperty("debugModels") != null) { LOGGER.info("############ Model info ############"); Json.prettyPrint(allModels); } @@ -527,7 +525,7 @@ private void generateApis(List files, List allOperations, List> paths = processPaths(this.openAPI.getPaths()); Set apisToGenerate = null; - String apiNames = GeneratorProperties.getProperty("apis"); + String apiNames = GlobalSettings.getProperty("apis"); if (apiNames != null && !apiNames.isEmpty()) { apisToGenerate = new HashSet(Arrays.asList(apiNames.split(","))); } @@ -666,7 +664,7 @@ public int compare(CodegenOperation one, CodegenOperation another) { throw new RuntimeException("Could not generate api file for '" + tag + "'", e); } } - if (GeneratorProperties.getProperty("debugOperations") != null) { + if (GlobalSettings.getProperty("debugOperations") != null) { LOGGER.info("############ Operation info ############"); Json.prettyPrint(allOperations); } @@ -678,7 +676,7 @@ private void generateSupportingFiles(List files, Map bundl return; } Set supportingFilesToGenerate = null; - String supportingFiles = GeneratorProperties.getProperty(CodegenConstants.SUPPORTING_FILES); + String supportingFiles = GlobalSettings.getProperty(CodegenConstants.SUPPORTING_FILES); if (supportingFiles != null && !supportingFiles.isEmpty()) { supportingFilesToGenerate = new HashSet(Arrays.asList(supportingFiles.split(","))); } @@ -867,7 +865,7 @@ private Map buildSupportFileBundle(List allOperations, L config.postProcessSupportingFileData(bundle); - if (GeneratorProperties.getProperty("debugSupportingFiles") != null) { + if (GlobalSettings.getProperty("debugSupportingFiles") != null) { LOGGER.info("############ Supporting file info ############"); Json.prettyPrint(bundle); } @@ -926,8 +924,8 @@ public List generate() { generateSupportingFiles(files, bundle); config.processOpenAPI(openAPI); - // reset GeneratorProperties, so that the running thread can be reused for another generator-run - GeneratorProperties.reset(); + // reset GlobalSettings, so that the running thread can be reused for another generator-run + GlobalSettings.reset(); return files; } @@ -982,7 +980,7 @@ private void processOperation(String resourcePath, String httpMethod, Operation return; } - if (GeneratorProperties.getProperty("debugOperations") != null) { + if (GlobalSettings.getProperty("debugOperations") != null) { LOGGER.info("processOperation: resourcePath= " + resourcePath + "\t;" + httpMethod + " " + operation + "\n"); } diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/config/CodegenConfigurator.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/config/CodegenConfigurator.java index 777e4888e7ab..4c251ffc4a0c 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/config/CodegenConfigurator.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/config/CodegenConfigurator.java @@ -17,9 +17,8 @@ package org.openapitools.codegen.config; -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.datatype.guava.GuavaModule; import io.swagger.parser.OpenAPIParser; import io.swagger.v3.core.util.Json; import io.swagger.v3.core.util.Yaml; @@ -32,559 +31,355 @@ import org.openapitools.codegen.*; import org.openapitools.codegen.api.TemplatingEngineAdapter; import org.openapitools.codegen.auth.AuthParser; -import org.openapitools.codegen.languages.*; -import org.openapitools.codegen.templating.HandlebarsEngineAdapter; -import org.openapitools.codegen.templating.MustacheEngineAdapter; import org.openapitools.codegen.utils.ModelUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import java.io.File; import java.io.IOException; -import java.io.Serializable; -import java.nio.file.Paths; import java.util.*; import static org.apache.commons.lang3.StringUtils.isEmpty; import static org.apache.commons.lang3.StringUtils.isNotEmpty; /** - * A class that contains all codegen configuration properties a user would want to manipulate. An - * instance could be created by deserializing a JSON file or being populated from CLI or Maven - * plugin parameters. It also has a convenience method for creating a ClientOptInput class which is - * THE object DefaultGenerator.java needs to generate code. + * A class which manages the contextual configuration for code generation. + * This includes configuring the generator, templating, and the workflow which orchestrates these. + * + * This helper also enables the deserialization of {@link GeneratorSettings} via application-specific Jackson JSON usage + * (see {@link DynamicSettings}. */ -public class CodegenConfigurator implements Serializable { +@SuppressWarnings("UnusedReturnValue") +public class CodegenConfigurator { public static final Logger LOGGER = LoggerFactory.getLogger(CodegenConfigurator.class); + private GeneratorSettings.Builder generatorSettingsBuilder = GeneratorSettings.newBuilder(); + private WorkflowSettings.Builder workflowSettingsBuilder = WorkflowSettings.newBuilder(); + private String generatorName; private String inputSpec; - private String outputDir; - private boolean verbose; - private boolean skipOverwrite; - private boolean removeOperationIdPrefix; - private boolean logToStderr; - private boolean validateSpec; - private boolean enablePostProcessFile; - private boolean enableMinimalUpdate; - private boolean strictSpecBehavior; - private String templateDir; private String templatingEngineName; + private Map systemProperties = new HashMap<>(); + private Map instantiationTypes = new HashMap<>(); + private Map typeMappings = new HashMap<>(); + private Map additionalProperties = new HashMap<>(); + private Map importMappings = new HashMap<>(); + private Set languageSpecificPrimitives = new HashSet<>(); + private Map reservedWordMappings = new HashMap<>(); private String auth; - private String apiPackage; - private String modelPackage; - private String invokerPackage; - private String packageName; - private String modelNamePrefix; - private String modelNameSuffix; - private String groupId; - private String artifactId; - private String artifactVersion; - private String library; - private String ignoreFileOverride; - private Map systemProperties = new HashMap(); - private Map instantiationTypes = new HashMap(); - private Map typeMappings = new HashMap(); - private Map additionalProperties = new HashMap(); - private Map importMappings = new HashMap(); - private Set languageSpecificPrimitives = new HashSet(); - private Map reservedWordMappings = new HashMap(); - - private String gitUserId = "GIT_USER_ID"; - private String gitRepoId = "GIT_REPO_ID"; - private String releaseNote = "Minor update"; - private String httpUserAgent; - - private final Map dynamicProperties = new HashMap(); - //the map that holds the JsonAnySetter/JsonAnyGetter values public CodegenConfigurator() { - this.validateSpec = true; - this.strictSpecBehavior = true; - this.setOutputDir("."); - } - /** - * Set the "language". This has drifted away from language-only to include framework and - * hyphenated generator types as well as language. - *

- * NOTE: This will eventually become language only again. It is deprecated in its current - * state. - *

- * - * @param lang The generator name. Previously, language name only. - * @return The fluent instance of {@link CodegenConfigurator} - * @deprecated Please use {@link #setGeneratorName(String)}, as generators are no longer - * identified only by language. We may reuse language in the future. - */ - @Deprecated public CodegenConfigurator setLang(String lang) { - this.setGeneratorName(lang); - return this; } - /** - * Sets the name of the target generator. - * - * The generator's name is used to uniquely identify the generator as a mechanism to lookup the - * desired implementation at runtime. - * - * @param generatorName The name of the generator. - * @return The fluent instance of {@link CodegenConfigurator} - */ - public CodegenConfigurator setGeneratorName(final String generatorName) { - this.generatorName = generatorName; - return this; - } + public static CodegenConfigurator fromFile(String configFile) { - public CodegenConfigurator setInputSpec(String inputSpec) { - this.inputSpec = inputSpec; - return this; - } + if (isNotEmpty(configFile)) { + ObjectMapper mapper; - public String getInputSpec() { - return inputSpec; - } + if (FilenameUtils.isExtension(configFile, new String[]{"yml", "yaml"})) { + mapper = Yaml.mapper(); + } else { + mapper = Json.mapper(); + } - public String getOutputDir() { - return outputDir; - } + mapper.registerModule(new GuavaModule()); - public CodegenConfigurator setOutputDir(String outputDir) { - this.outputDir = toAbsolutePathStr(outputDir); - return this; - } - - public String getModelPackage() { - return modelPackage; + try { + DynamicSettings settings = mapper.readValue(new File(configFile), DynamicSettings.class); + CodegenConfigurator configurator = new CodegenConfigurator(); + configurator.generatorSettingsBuilder = GeneratorSettings.newBuilder(settings.getGeneratorSettings()); + return configurator; + } catch (IOException ex) { + LOGGER.error("Unable to deserialize config file: " + configFile, ex); + } + } + return null; } - public CodegenConfigurator setModelPackage(String modelPackage) { - this.modelPackage = modelPackage; + public CodegenConfigurator addAdditionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + generatorSettingsBuilder.withAdditionalProperty(key, value); return this; } - public String getModelNamePrefix() { - return modelNamePrefix; - } - - public CodegenConfigurator setModelNamePrefix(String prefix) { - this.modelNamePrefix = prefix; + public CodegenConfigurator addAdditionalReservedWordMapping(String key, String value) { + this.reservedWordMappings.put(key, value); + generatorSettingsBuilder.withReservedWordMapping(key, value); return this; } - public boolean getRemoveOperationIdPrefix() { - return removeOperationIdPrefix; - } - - public CodegenConfigurator setRemoveOperationIdPrefix(boolean removeOperationIdPrefix) { - this.removeOperationIdPrefix = removeOperationIdPrefix; + public CodegenConfigurator addImportMapping(String key, String value) { + this.importMappings.put(key, value); + generatorSettingsBuilder.withImportMapping(key, value); return this; } - public boolean getEnablePostProcessFile() { - return enablePostProcessFile; - } - - public CodegenConfigurator setEnablePostProcessFile(boolean enablePostProcessFile) { - this.enablePostProcessFile = enablePostProcessFile; + public CodegenConfigurator addInstantiationType(String key, String value) { + this.instantiationTypes.put(key, value); + generatorSettingsBuilder.withInstantiationType(key, value); return this; } - public boolean getLogToStderr() { - return logToStderr; - } - - public CodegenConfigurator setLogToStderr(boolean logToStderrte) { - this.logToStderr = logToStderr; + public CodegenConfigurator addLanguageSpecificPrimitive(String value) { + this.languageSpecificPrimitives.add(value); + generatorSettingsBuilder.withLanguageSpecificPrimitive(value); return this; } - public boolean getEnableMinimalUpdate() { - return enableMinimalUpdate; - } - - public CodegenConfigurator setEnableMinimalUpdate(boolean enableMinimalUpdate) { - this.enableMinimalUpdate = enableMinimalUpdate; + public CodegenConfigurator addSystemProperty(String key, String value) { + this.systemProperties.put(key, value); + workflowSettingsBuilder.withSystemProperty(key, value); return this; } - public boolean isGenerateAliasAsModel() { - return ModelUtils.isGenerateAliasAsModel(); - } - - public CodegenConfigurator setGenerateAliasAsModel(boolean generateAliasAsModel) { - ModelUtils.setGenerateAliasAsModel(generateAliasAsModel); + public CodegenConfigurator addTypeMapping(String key, String value) { + this.typeMappings.put(key, value); + generatorSettingsBuilder.withTypeMappings(this.typeMappings); return this; } - public String getModelNameSuffix() { - return modelNameSuffix; - } - - public CodegenConfigurator setModelNameSuffix(String suffix) { - this.modelNameSuffix = suffix; + public CodegenConfigurator setAdditionalProperties(Map additionalProperties) { + this.additionalProperties = additionalProperties; + generatorSettingsBuilder.withAdditionalProperties(additionalProperties); return this; } - public boolean isStrictSpecBehavior() { - return strictSpecBehavior; - } - - public CodegenConfigurator setStrictSpecBehavior(boolean strictSpecBehavior) { - this.strictSpecBehavior = strictSpecBehavior; + public CodegenConfigurator setApiPackage(String apiPackage) { + generatorSettingsBuilder.withApiPackage(apiPackage); return this; } - public boolean isVerbose() { - return verbose; + public CodegenConfigurator setArtifactId(String artifactId) { + generatorSettingsBuilder.withArtifactId(artifactId); + return this; } - public CodegenConfigurator setVerbose(boolean verbose) { - this.verbose = verbose; + public CodegenConfigurator setArtifactVersion(String artifactVersion) { + generatorSettingsBuilder.withArtifactVersion(artifactVersion); return this; } - public boolean isValidateSpec() { - return validateSpec; + public CodegenConfigurator setAuth(String auth) { + this.auth = auth; + return this; } - public CodegenConfigurator setValidateSpec(final boolean validateSpec) { - this.validateSpec = validateSpec; + public CodegenConfigurator setEnableMinimalUpdate(boolean enableMinimalUpdate) { + workflowSettingsBuilder.withEnableMinimalUpdate(enableMinimalUpdate); return this; } - public boolean isSkipOverwrite() { - return skipOverwrite; + public CodegenConfigurator setEnablePostProcessFile(boolean enablePostProcessFile) { + workflowSettingsBuilder.withEnablePostProcessFile(enablePostProcessFile); + return this; } - public CodegenConfigurator setSkipOverwrite(boolean skipOverwrite) { - this.skipOverwrite = skipOverwrite; + public CodegenConfigurator setGenerateAliasAsModel(boolean generateAliasAsModel) { + // TODO: Move to GlobalSettings? + ModelUtils.setGenerateAliasAsModel(generateAliasAsModel); return this; } - /** - * Gets the "language". This has drifted away from language-only to include framework and - * hyphenated generator types as well as language. + * Sets the name of the target generator. *

- * NOTE: This will eventually become language only again. It is deprecated in its current - * state. - *

+ * The generator's name is used to uniquely identify the generator as a mechanism to lookup the + * desired implementation at runtime. * - * @return A string which defines the generator. - * @deprecated Please use {@link #getGeneratorName()}, as generators are no longer identified - * only by language. We may reuse language in the future. + * @param generatorName The name of the generator. + * @return The fluent instance of {@link CodegenConfigurator} */ - @Deprecated public String getLang() { - return getGeneratorName(); - } - - public String getGeneratorName() { - return generatorName; - } - - public String getTemplateDir() { - return templateDir; - } - - public CodegenConfigurator setTemplateDir(String templateDir) { - File f = new File(templateDir); - - // check to see if the folder exists - if (!(f.exists() && f.isDirectory())) { - throw new IllegalArgumentException( - "Template directory " + templateDir + " does not exist."); - } - - this.templateDir = f.getAbsolutePath(); - return this; - } - - public String getAuth() { - return auth; - } - - public CodegenConfigurator setAuth(String auth) { - this.auth = auth; - return this; - } - - public String getApiPackage() { - return apiPackage; - } - - public CodegenConfigurator setApiPackage(String apiPackage) { - this.apiPackage = apiPackage; + public CodegenConfigurator setGeneratorName(final String generatorName) { + this.generatorName = generatorName; + generatorSettingsBuilder.withGeneratorName(generatorName); return this; } - public String getInvokerPackage() { - return invokerPackage; - } - - public CodegenConfigurator setInvokerPackage(String invokerPackage) { - this.invokerPackage = invokerPackage; + public CodegenConfigurator setGitRepoId(String gitRepoId) { + generatorSettingsBuilder.withGitRepoId(gitRepoId); return this; } - public String getPackageName() { - return packageName; - } - - public CodegenConfigurator setPackageName(String packageName) { - this.packageName = packageName; + public CodegenConfigurator setGitUserId(String gitUserId) { + generatorSettingsBuilder.withGitUserId(gitUserId); return this; } - public String getGroupId() { - return groupId; - } - public CodegenConfigurator setGroupId(String groupId) { - this.groupId = groupId; + generatorSettingsBuilder.withGroupId(groupId); return this; } - public String getArtifactId() { - return artifactId; - } - - public CodegenConfigurator setArtifactId(String artifactId) { - this.artifactId = artifactId; + public CodegenConfigurator setHttpUserAgent(String httpUserAgent) { + generatorSettingsBuilder.withHttpUserAgent(httpUserAgent); return this; } - public String getArtifactVersion() { - return artifactVersion; - } - - public CodegenConfigurator setArtifactVersion(String artifactVersion) { - this.artifactVersion = artifactVersion; + public CodegenConfigurator setIgnoreFileOverride(final String ignoreFileOverride) { + workflowSettingsBuilder.withIgnoreFileOverride(ignoreFileOverride); return this; } - public Map getSystemProperties() { - return systemProperties; - } - - public CodegenConfigurator setSystemProperties(Map systemProperties) { - this.systemProperties = systemProperties; + public CodegenConfigurator setImportMappings(Map importMappings) { + generatorSettingsBuilder.withImportMappings(importMappings); return this; } - public CodegenConfigurator addSystemProperty(String key, String value) { - this.systemProperties.put(key, value); + public CodegenConfigurator setInputSpec(String inputSpec) { + this.inputSpec = inputSpec; + workflowSettingsBuilder.withInputSpec(inputSpec); return this; } - public Map getInstantiationTypes() { - return instantiationTypes; - } - public CodegenConfigurator setInstantiationTypes(Map instantiationTypes) { - this.instantiationTypes = instantiationTypes; + generatorSettingsBuilder.withInstantiationTypes(instantiationTypes); return this; } - public CodegenConfigurator addInstantiationType(String key, String value) { - this.instantiationTypes.put(key, value); + public CodegenConfigurator setInvokerPackage(String invokerPackage) { + generatorSettingsBuilder.withInvokerPackage(invokerPackage); return this; } - public Map getTypeMappings() { - return typeMappings; - } - - public CodegenConfigurator setTypeMappings(Map typeMappings) { - this.typeMappings = typeMappings; + public CodegenConfigurator setLanguageSpecificPrimitives( + Set languageSpecificPrimitives) { + generatorSettingsBuilder.withLanguageSpecificPrimitives(languageSpecificPrimitives); return this; } - public CodegenConfigurator addTypeMapping(String key, String value) { - this.typeMappings.put(key, value); + public CodegenConfigurator setLibrary(String library) { + generatorSettingsBuilder.withLibrary(library); return this; } - public Map getAdditionalProperties() { - return additionalProperties; - } - - public CodegenConfigurator setAdditionalProperties(Map additionalProperties) { - this.additionalProperties = additionalProperties; + public CodegenConfigurator setLogToStderr(boolean logToStderr) { + workflowSettingsBuilder.withLogToStderr(logToStderr); return this; } - public CodegenConfigurator addAdditionalProperty(String key, Object value) { - this.additionalProperties.put(key, value); + public CodegenConfigurator setModelNamePrefix(String prefix) { + generatorSettingsBuilder.withModelNamePrefix(prefix); return this; } - public Map getImportMappings() { - return importMappings; - } - - public CodegenConfigurator setImportMappings(Map importMappings) { - this.importMappings = importMappings; + public CodegenConfigurator setModelNameSuffix(String suffix) { + generatorSettingsBuilder.withModelNameSuffix(suffix); return this; } - public CodegenConfigurator addImportMapping(String key, String value) { - this.importMappings.put(key, value); + public CodegenConfigurator setModelPackage(String modelPackage) { + generatorSettingsBuilder.withModelPackage(modelPackage); return this; } - public Set getLanguageSpecificPrimitives() { - return languageSpecificPrimitives; - } - - public CodegenConfigurator setLanguageSpecificPrimitives( - Set languageSpecificPrimitives) { - this.languageSpecificPrimitives = languageSpecificPrimitives; + public CodegenConfigurator setOutputDir(String outputDir) { + workflowSettingsBuilder.withOutputDir(outputDir); return this; } - public CodegenConfigurator addLanguageSpecificPrimitive(String value) { - this.languageSpecificPrimitives.add(value); + public CodegenConfigurator setPackageName(String packageName) { + generatorSettingsBuilder.withPackageName(packageName); return this; } - public String getLibrary() { - return library; - } - - public CodegenConfigurator setLibrary(String library) { - this.library = library; + public CodegenConfigurator setReleaseNote(String releaseNote) { + generatorSettingsBuilder.withReleaseNote(releaseNote); return this; } - public String getGitUserId() { - return gitUserId; - } - - public CodegenConfigurator setGitUserId(String gitUserId) { - this.gitUserId = gitUserId; + public CodegenConfigurator setRemoveOperationIdPrefix(boolean removeOperationIdPrefix) { + workflowSettingsBuilder.withRemoveOperationIdPrefix(removeOperationIdPrefix); return this; } - public String getGitRepoId() { - return gitRepoId; - } - - public CodegenConfigurator setGitRepoId(String gitRepoId) { - this.gitRepoId = gitRepoId; + public CodegenConfigurator setReservedWordsMappings(Map reservedWordMappings) { + generatorSettingsBuilder.withReservedWordMappings(reservedWordMappings); return this; } - public String getReleaseNote() { - return releaseNote; - } - - public CodegenConfigurator setReleaseNote(String releaseNote) { - this.releaseNote = releaseNote; + public CodegenConfigurator setSkipOverwrite(boolean skipOverwrite) { + workflowSettingsBuilder.withSkipOverwrite(skipOverwrite); return this; } - public String getHttpUserAgent() { - return httpUserAgent; + public CodegenConfigurator setStrictSpecBehavior(boolean strictSpecBehavior) { + workflowSettingsBuilder.withStrictSpecBehavior(strictSpecBehavior); + return this; } - public CodegenConfigurator setHttpUserAgent(String httpUserAgent) { - this.httpUserAgent = httpUserAgent; + public CodegenConfigurator setSystemProperties(Map systemProperties) { + workflowSettingsBuilder.withSystemProperties(systemProperties); return this; } - public Map getReservedWordsMappings() { - return reservedWordMappings; + public CodegenConfigurator setTemplateDir(String templateDir) { + workflowSettingsBuilder.withTemplateDir(templateDir); + return this; } - public CodegenConfigurator setReservedWordsMappings(Map reservedWordsMappings) { - this.reservedWordMappings = reservedWordsMappings; + public CodegenConfigurator setTemplatingEngineName(String templatingEngineName) { + this.templatingEngineName = templatingEngineName; + workflowSettingsBuilder.withTemplatingEngineName(templatingEngineName); return this; } - public CodegenConfigurator addAdditionalReservedWordMapping(String key, String value) { - this.reservedWordMappings.put(key, value); + public CodegenConfigurator setTypeMappings(Map typeMappings) { + generatorSettingsBuilder.withTypeMappings(typeMappings); return this; } - public String getIgnoreFileOverride() { - return ignoreFileOverride; + public CodegenConfigurator setValidateSpec(final boolean validateSpec) { + workflowSettingsBuilder.withValidateSpec(validateSpec); + return this; } - public CodegenConfigurator setIgnoreFileOverride(final String ignoreFileOverride) { - this.ignoreFileOverride = ignoreFileOverride; + public CodegenConfigurator setVerbose(boolean verbose) { + workflowSettingsBuilder.withVerbose(verbose); return this; } - public ClientOptInput toClientOptInput() { - + @SuppressWarnings("WeakerAccess") + public Context toContext() { Validate.notEmpty(generatorName, "language/generatorName must be specified"); Validate.notEmpty(inputSpec, "input spec must be specified"); - setVerboseFlags(); - setSystemProperties(); - - CodegenConfig config = CodegenConfigLoader.forName(generatorName); - - config.setInputSpec(inputSpec); - config.setOutputDir(outputDir); - config.setSkipOverwrite(skipOverwrite); - config.setIgnoreFilePathOverride(ignoreFileOverride); - config.setRemoveOperationIdPrefix(removeOperationIdPrefix); - config.setEnablePostProcessFile(enablePostProcessFile); - config.setEnableMinimalUpdate(enableMinimalUpdate); - - config.instantiationTypes().putAll(instantiationTypes); - config.typeMapping().putAll(typeMappings); - config.importMapping().putAll(importMappings); - config.languageSpecificPrimitives().addAll(languageSpecificPrimitives); - config.reservedWordsMappings().putAll(reservedWordMappings); - - config.setStrictSpecBehavior(isStrictSpecBehavior()); - - checkAndSetAdditionalProperty(apiPackage, CodegenConstants.API_PACKAGE); - checkAndSetAdditionalProperty(modelPackage, CodegenConstants.MODEL_PACKAGE); - checkAndSetAdditionalProperty(invokerPackage, CodegenConstants.INVOKER_PACKAGE); - checkAndSetAdditionalProperty(packageName, CodegenConstants.PACKAGE_NAME); - checkAndSetAdditionalProperty(groupId, CodegenConstants.GROUP_ID); - checkAndSetAdditionalProperty(artifactId, CodegenConstants.ARTIFACT_ID); - checkAndSetAdditionalProperty(artifactVersion, CodegenConstants.ARTIFACT_VERSION); - checkAndSetAdditionalProperty(templateDir, toAbsolutePathStr(templateDir), - CodegenConstants.TEMPLATE_DIR); - checkAndSetAdditionalProperty(templatingEngineName, CodegenConstants.TEMPLATING_ENGINE); - checkAndSetAdditionalProperty(modelNamePrefix, CodegenConstants.MODEL_NAME_PREFIX); - checkAndSetAdditionalProperty(modelNameSuffix, CodegenConstants.MODEL_NAME_SUFFIX); - checkAndSetAdditionalProperty(gitUserId, CodegenConstants.GIT_USER_ID); - checkAndSetAdditionalProperty(gitRepoId, CodegenConstants.GIT_REPO_ID); - checkAndSetAdditionalProperty(releaseNote, CodegenConstants.RELEASE_NOTE); - checkAndSetAdditionalProperty(httpUserAgent, CodegenConstants.HTTP_USER_AGENT); - - handleDynamicProperties(config); - - if (isNotEmpty(library)) { - config.setLibrary(library); - } - - String templatingEngineId; if (isEmpty(templatingEngineName)) { // Built-in templates are mustache, but allow users to use a simplified handlebars engine for their custom templates. - templatingEngineId = "mustache"; + workflowSettingsBuilder.withTemplatingEngineName("mustache"); + } else { + workflowSettingsBuilder.withTemplatingEngineName(templatingEngineName); } - else { templatingEngineId = templatingEngineName; } - - TemplatingEngineAdapter templatingEngine = TemplatingEngineLoader.byIdentifier(templatingEngineId); - config.setTemplatingEngine(templatingEngine); - config.additionalProperties().putAll(additionalProperties); + // at this point, all "additionalProperties" are set, and are now immutable per GeneratorSettings instance. + GeneratorSettings generatorSettings = generatorSettingsBuilder.build(); + WorkflowSettings workflowSettings = workflowSettingsBuilder.build(); + + if (workflowSettings.isVerbose()) { + LOGGER.info("\nVERBOSE MODE: ON. Additional debug options are injected" + + "\n - [debugOpenAPI] prints the OpenAPI specification as interpreted by the codegen" + + "\n - [debugModels] prints models passed to the template engine" + + "\n - [debugOperations] prints operations passed to the template engine" + + "\n - [debugSupportingFiles] prints additional data passed to the template engine"); + + GlobalSettings.setProperty("debugOpenAPI", ""); + GlobalSettings.setProperty("debugModels", ""); + GlobalSettings.setProperty("debugOperations", ""); + GlobalSettings.setProperty("debugSupportingFiles", ""); + } - ClientOptInput input = new ClientOptInput().config(config); + for (Map.Entry entry : workflowSettings.getSystemProperties().entrySet()) { + GlobalSettings.setProperty(entry.getKey(), entry.getValue()); + } - final List authorizationValues = AuthParser.parse(auth); + // TODO: Support custom spec loader implementations (https://github.com/OpenAPITools/openapi-generator/issues/844) + final List authorizationValues = AuthParser.parse(this.auth); ParseOptions options = new ParseOptions(); options.setResolve(true); SwaggerParseResult result = new OpenAPIParser().readLocation(inputSpec, authorizationValues, options); + // TODO: Move custom validations to a separate type as part of a "Workflow" Set validationMessages = new HashSet<>(result.getMessages()); OpenAPI specification = result.getOpenAPI(); @@ -598,12 +393,10 @@ public ClientOptInput toClientOptInput() { } } - if (this.isValidateSpec()) { - StringBuilder sb = new StringBuilder(); - sb.append( - "There were issues with the specification. The option can be disabled via validateSpec (Maven/Gradle) or --skip-validate-spec (CLI)."); - sb.append(System.lineSeparator()); - SpecValidationException ex = new SpecValidationException(sb.toString()); + if (workflowSettings.isValidateSpec()) { + String sb = "There were issues with the specification. The option can be disabled via validateSpec (Maven/Gradle) or --skip-validate-spec (CLI)." + + System.lineSeparator(); + SpecValidationException ex = new SpecValidationException(sb); ex.setErrors(validationMessages); ex.setWarnings(warnings); throw ex; @@ -626,95 +419,44 @@ public ClientOptInput toClientOptInput() { } } - input.opts(new ClientOpts()).openAPI(specification); - - return input; - } - - @JsonAnySetter public CodegenConfigurator addDynamicProperty(String name, Object value) { - dynamicProperties.put(name, value); - return this; - } - - @JsonAnyGetter public Map getDynamicProperties() { - return dynamicProperties; - } - - private void handleDynamicProperties(CodegenConfig codegenConfig) { - for (CliOption langCliOption : codegenConfig.cliOptions()) { - String opt = langCliOption.getOpt(); - if (dynamicProperties.containsKey(opt)) { - codegenConfig.additionalProperties().put(opt, dynamicProperties.get(opt)); - } else if (systemProperties.containsKey(opt)) { - codegenConfig.additionalProperties().put(opt, systemProperties.get(opt)); - } - } - } - - private void setVerboseFlags() { - if (!verbose) { - return; - } - LOGGER.info("\nVERBOSE MODE: ON. Additional debug options are injected" - + "\n - [debugOpenAPI] prints the OpenAPI specification as interpreted by the codegen" - + "\n - [debugModels] prints models passed to the template engine" - + "\n - [debugOperations] prints operations passed to the template engine" - + "\n - [debugSupportingFiles] prints additional data passed to the template engine"); - - GeneratorProperties.setProperty("debugOpenAPI", ""); - GeneratorProperties.setProperty("debugModels", ""); - GeneratorProperties.setProperty("debugOperations", ""); - GeneratorProperties.setProperty("debugSupportingFiles", ""); + return new Context<>(specification, generatorSettings, workflowSettings); } - private void setSystemProperties() { - for (Map.Entry entry : systemProperties.entrySet()) { - GeneratorProperties.setProperty(entry.getKey(), entry.getValue()); - } - } - - private static String toAbsolutePathStr(String path) { - if (isNotEmpty(path)) { - return Paths.get(path).toAbsolutePath().toString(); - } - - return path; + public ClientOptInput toClientOptInput() { + CodegenConfig config = CodegenConfigLoader.forName(generatorName); - } + Context context = toContext(); + WorkflowSettings workflowSettings = context.getWorkflowSettings(); + GeneratorSettings generatorSettings = context.getGeneratorSettings(); - private void checkAndSetAdditionalProperty(String property, String propertyKey) { - checkAndSetAdditionalProperty(property, property, propertyKey); - } - - private void checkAndSetAdditionalProperty(String property, String valueToSet, - String propertyKey) { - if (isNotEmpty(property)) { - additionalProperties.put(propertyKey, valueToSet); + if (isNotEmpty(generatorSettings.getLibrary())) { + config.setLibrary(generatorSettings.getLibrary()); } - } - - public static CodegenConfigurator fromFile(String configFile) { - if (isNotEmpty(configFile)) { - ObjectMapper mapper; + // TODO: Work toward CodegenConfig having a "WorkflowSettings" property, or better a "Workflow" object which itself has a "WorkflowSettings" property. + config.setInputSpec(workflowSettings.getInputSpec()); + config.setOutputDir(workflowSettings.getOutputDir()); + config.setSkipOverwrite(workflowSettings.isSkipOverwrite()); + config.setIgnoreFilePathOverride(workflowSettings.getIgnoreFileOverride()); + config.setRemoveOperationIdPrefix(workflowSettings.isRemoveOperationIdPrefix()); + config.setEnablePostProcessFile(workflowSettings.isEnablePostProcessFile()); + config.setEnableMinimalUpdate(workflowSettings.isEnableMinimalUpdate()); + config.setStrictSpecBehavior(workflowSettings.isStrictSpecBehavior()); + + TemplatingEngineAdapter templatingEngine = TemplatingEngineLoader.byIdentifier(workflowSettings.getTemplatingEngineName()); + config.setTemplatingEngine(templatingEngine); - if (FilenameUtils.isExtension(configFile, new String[] {"yml", "yaml"})) { - mapper = Yaml.mapper(); - } else { - mapper = Json.mapper(); - } + // TODO: Work toward CodegenConfig having a "GeneratorSettings" property. + config.instantiationTypes().putAll(generatorSettings.getInstantiationTypes()); + config.typeMapping().putAll(generatorSettings.getTypeMappings()); + config.importMapping().putAll(generatorSettings.getImportMappings()); + config.languageSpecificPrimitives().addAll(generatorSettings.getLanguageSpecificPrimitives()); + config.reservedWordsMappings().putAll(generatorSettings.getReservedWordMappings()); + config.additionalProperties().putAll(generatorSettings.getAdditionalProperties()); - try { - return mapper.readValue(new File(configFile), CodegenConfigurator.class); - } catch (IOException ex) { - LOGGER.error("Unable to deserialize config file: " + configFile, ex); - } - } - return null; - } + ClientOptInput input = new ClientOptInput() + .config(config); - public CodegenConfigurator setTemplatingEngineName(String templatingEngineName) { - this.templatingEngineName = templatingEngineName; - return this; + return input.openAPI((OpenAPI)context.getSpecDocument()); } } diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/config/DynamicSettings.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/config/DynamicSettings.java new file mode 100644 index 000000000000..60164226f29f --- /dev/null +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/config/DynamicSettings.java @@ -0,0 +1,77 @@ +package org.openapitools.codegen.config; + +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonUnwrapped; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; + +import java.lang.reflect.Field; +import java.util.HashMap; +import java.util.HashSet; +import java.util.Map; +import java.util.Set; + +/** + * Represents a serialization helper of {@link GeneratorSettings} and {@link WorkflowSettings}. When used to deserialize any available Jackson binding input, + * this will accumulate any "unknown properties" into {@link GeneratorSettings#getAdditionalProperties()} as a side effect of calling + * {@link DynamicSettings#getGeneratorSettings()}. + */ +@SuppressWarnings({"unused", "WeakerAccess"}) +public class DynamicSettings { + @JsonAnySetter + private Map dynamicProperties = new HashMap<>(); + + @JsonUnwrapped + @JsonDeserialize(builder = GeneratorSettings.Builder.class) + private GeneratorSettings generatorSettings; + + @JsonUnwrapped + @JsonDeserialize(builder = WorkflowSettings.Builder.class) + private WorkflowSettings workflowSettings; + + /** + * Gets the {@link GeneratorSettings} included in the config object. + * + * @return A new instance of settings + */ + public GeneratorSettings getGeneratorSettings() { + excludeSettingsFromDynamicProperties(); + return GeneratorSettings.newBuilder(generatorSettings) + .withAdditionalProperties(dynamicProperties) + .build(); + } + + /** + * Gets the {@link WorkflowSettings} included in the config object. + * + * @return A new instance of settings + */ + public WorkflowSettings getWorkflowSettings() { + excludeSettingsFromDynamicProperties(); + return WorkflowSettings.newBuilder(workflowSettings) + .build(); + } + + @JsonCreator + public DynamicSettings() { } + + /** + * Gets all "custom" properties included in the config object. + * + * @return All user-specified custom properties. + */ + public Map getDynamicProperties() { + return dynamicProperties; + } + + private void excludeSettingsFromDynamicProperties(){ + Set fieldNames = new HashSet<>(); + for (Field field : GeneratorSettings.class.getDeclaredFields()) { + fieldNames.add(field.getName()); + } + for (Field field : WorkflowSettings.class.getDeclaredFields()) { + fieldNames.add(field.getName()); + } + dynamicProperties.keySet().removeAll(fieldNames); + } +} diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/config/GeneratorProperties.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/config/GlobalSettings.java similarity index 85% rename from modules/openapi-generator/src/main/java/org/openapitools/codegen/config/GeneratorProperties.java rename to modules/openapi-generator/src/main/java/org/openapitools/codegen/config/GlobalSettings.java index 97fcb07f2a5a..0f078821024f 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/config/GeneratorProperties.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/config/GlobalSettings.java @@ -19,14 +19,17 @@ import java.util.Properties; /** - * GeneratorProperties encapsulates SystemProperties, since the codegen mechanism heavily relies on a stable, + * GlobalSettings encapsulates SystemProperties, since the codegen mechanism heavily relies on a stable, * non-changing System Property Basis. Using plain System.(get|set|clear)Property raises Race-Conditions in combination * with Code, that uses System.setProperties (e.g. maven-surefire-plugin). + * + * This provides a set of properties specific to the executing thread, such that the generator may not modify system properties + * consumed by other threads. * * @author gndrm * @since 2018 */ -public class GeneratorProperties { +public class GlobalSettings { private static ThreadLocal properties = new InheritableThreadLocal() { @Override diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/JavaInflectorServerCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/JavaInflectorServerCodegen.java index 7ceeece3fa9d..d44daedd70bf 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/JavaInflectorServerCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/JavaInflectorServerCodegen.java @@ -21,7 +21,7 @@ import org.apache.commons.lang3.BooleanUtils; import org.apache.commons.lang3.StringUtils; import org.openapitools.codegen.*; -import org.openapitools.codegen.config.GeneratorProperties; +import org.openapitools.codegen.config.GlobalSettings; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -46,8 +46,8 @@ public JavaInflectorServerCodegen() { invokerPackage = "org.openapitools.controllers"; artifactId = "openapi-inflector-server"; dateLibrary = "legacy"; //TODO: add joda support - apiPackage = GeneratorProperties.getProperty("swagger.codegen.inflector.apipackage", "org.openapitools.controllers"); - modelPackage = GeneratorProperties.getProperty("swagger.codegen.inflector.modelpackage", "org.openapitools.model"); + apiPackage = GlobalSettings.getProperty("swagger.codegen.inflector.apipackage", "org.openapitools.controllers"); + modelPackage = GlobalSettings.getProperty("swagger.codegen.inflector.modelpackage", "org.openapitools.model"); // clear model and api doc template as this codegen // does not support auto-generated markdown doc at the moment diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/JavaUndertowServerCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/JavaUndertowServerCodegen.java index ef6b005fb0b0..47df13f7295a 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/JavaUndertowServerCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/JavaUndertowServerCodegen.java @@ -19,7 +19,7 @@ import org.apache.commons.lang3.BooleanUtils; import org.openapitools.codegen.*; -import org.openapitools.codegen.config.GeneratorProperties; +import org.openapitools.codegen.config.GlobalSettings; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -58,17 +58,17 @@ public JavaUndertowServerCodegen() { modelDocTemplateFiles.remove("model_doc.mustache"); apiDocTemplateFiles.remove("api_doc.mustache"); - if(GeneratorProperties.getProperty("swagger.codegen.undertow.apipackage") != null && GeneratorProperties.getProperty("openapi.codegen.undertow.apipackage") == null) { + if(GlobalSettings.getProperty("swagger.codegen.undertow.apipackage") != null && GlobalSettings.getProperty("openapi.codegen.undertow.apipackage") == null) { LOGGER.warn("System property 'swagger.codegen.undertow.apipackage' was renamed to 'swagger.codegen.undertow.apipackage'"); - apiPackage = GeneratorProperties.getProperty("swagger.codegen.undertow.apipackage", "org.openapitools.handler"); + apiPackage = GlobalSettings.getProperty("swagger.codegen.undertow.apipackage", "org.openapitools.handler"); } else { - apiPackage = GeneratorProperties.getProperty("openapi.codegen.undertow.apipackage", "org.openapitools.handler"); + apiPackage = GlobalSettings.getProperty("openapi.codegen.undertow.apipackage", "org.openapitools.handler"); } - if(GeneratorProperties.getProperty("swagger.codegen.undertow.modelpackage") != null && GeneratorProperties.getProperty("openapi.codegen.undertow.modelpackage") == null) { + if(GlobalSettings.getProperty("swagger.codegen.undertow.modelpackage") != null && GlobalSettings.getProperty("openapi.codegen.undertow.modelpackage") == null) { LOGGER.warn("System property 'swagger.codegen.undertow.modelpackage' was renamed to 'openapi.codegen.undertow.modelpackage'"); - modelPackage = GeneratorProperties.getProperty("swagger.codegen.undertow.modelpackage", "org.openapitools.model"); + modelPackage = GlobalSettings.getProperty("swagger.codegen.undertow.modelpackage", "org.openapitools.model"); } else { - modelPackage = GeneratorProperties.getProperty("openapi.codegen.undertow.modelpackage", "org.openapitools.model"); + modelPackage = GlobalSettings.getProperty("openapi.codegen.undertow.modelpackage", "org.openapitools.model"); } additionalProperties.put("title", title); diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/NodeJSServerCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/NodeJSServerCodegen.java index 896f0837e572..2dd724f77f68 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/NodeJSServerCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/NodeJSServerCodegen.java @@ -27,7 +27,7 @@ import io.swagger.v3.oas.models.Paths; import io.swagger.v3.oas.models.info.Info; import org.openapitools.codegen.*; -import org.openapitools.codegen.config.GeneratorProperties; +import org.openapitools.codegen.config.GlobalSettings; import org.openapitools.codegen.utils.URLPathUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -340,7 +340,7 @@ public void processOpts() { } writeOptional(outputFolder, new SupportingFile("package.mustache", "", "package.json")); writeOptional(outputFolder, new SupportingFile("README.mustache", "", "README.md")); - if (GeneratorProperties.getProperty("noservice") == null) { + if (GlobalSettings.getProperty("noservice") == null) { apiTemplateFiles.put( "service.mustache", // the template to use "Service.js"); // the extension for each file to write diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/utils/ModelUtils.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/utils/ModelUtils.java index 814035e9e81b..15c292996969 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/utils/ModelUtils.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/utils/ModelUtils.java @@ -42,7 +42,10 @@ public class ModelUtils { private static final Logger LOGGER = LoggerFactory.getLogger(ModelUtils.class); + private static final String URI_FORMAT = "uri"; + + // TODO: Use GlobalSettings for all static/global properties in a more thread-safe way. private static boolean generateAliasAsModel = false; public static void setGenerateAliasAsModel(boolean value) { diff --git a/modules/openapi-generator/src/test/java/org/openapitools/codegen/AbstractIntegrationTest.java b/modules/openapi-generator/src/test/java/org/openapitools/codegen/AbstractIntegrationTest.java index 518f6fee8797..fc9b05521c45 100644 --- a/modules/openapi-generator/src/test/java/org/openapitools/codegen/AbstractIntegrationTest.java +++ b/modules/openapi-generator/src/test/java/org/openapitools/codegen/AbstractIntegrationTest.java @@ -58,13 +58,12 @@ public void generatesCorrectDirectoryStructure() throws IOException { CodegenConfig codegenConfig = getCodegenConfig(); codegenConfig.setOutputDir(integrationTestPathsConfig.getOutputPath().toString()); codegenConfig.setIgnoreFilePathOverride(integrationTestPathsConfig.getIgnoreFilePath().toFile().toString()); - ClientOpts clientOpts = new ClientOpts(); - clientOpts.setProperties(configProperties()); ClientOptInput opts = new ClientOptInput() .config(codegenConfig) - .opts(clientOpts) .openAPI(openAPI); + codegenConfig.additionalProperties().putAll(configProperties()); + codeGen.opts(opts).generate(); assertPathEqualsRecursively(integrationTestPathsConfig.getExpectedPath(), integrationTestPathsConfig.getOutputPath()); diff --git a/modules/openapi-generator/src/test/java/org/openapitools/codegen/DefaultGeneratorTest.java b/modules/openapi-generator/src/test/java/org/openapitools/codegen/DefaultGeneratorTest.java index 89ebd814187c..e8097915a0fe 100644 --- a/modules/openapi-generator/src/test/java/org/openapitools/codegen/DefaultGeneratorTest.java +++ b/modules/openapi-generator/src/test/java/org/openapitools/codegen/DefaultGeneratorTest.java @@ -31,7 +31,6 @@ public void testProcessPaths() throws Exception { ClientOptInput opts = new ClientOptInput(); opts.setOpenAPI(openAPI); opts.setConfig(new DefaultCodegen()); - opts.setOpts(new ClientOpts()); DefaultGenerator generator = new DefaultGenerator(); generator.opts(opts); @@ -62,7 +61,6 @@ public void testNonStrictProcessPaths() throws Exception { CodegenConfig config = new DefaultCodegen(); config.setStrictSpecBehavior(false); opts.setConfig(config); - opts.setOpts(new ClientOpts()); DefaultGenerator generator = new DefaultGenerator(); generator.opts(opts); @@ -85,7 +83,6 @@ public void minimalUpdateTest() throws IOException { DefaultCodegen codegen = new DefaultCodegen(); codegen.setEnableMinimalUpdate(true); opts.setConfig(codegen); - opts.setOpts(new ClientOpts()); DefaultGenerator generator = new DefaultGenerator(); generator.opts(opts); File testPath = new File("temp/overwrite.test"); diff --git a/modules/openapi-generator/src/test/java/org/openapitools/codegen/config/DynamicSettingsTest.java b/modules/openapi-generator/src/test/java/org/openapitools/codegen/config/DynamicSettingsTest.java new file mode 100644 index 000000000000..062f906743fc --- /dev/null +++ b/modules/openapi-generator/src/test/java/org/openapitools/codegen/config/DynamicSettingsTest.java @@ -0,0 +1,107 @@ +package org.openapitools.codegen.config; + +import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.datatype.guava.GuavaModule; +import io.swagger.v3.core.util.Yaml; +import org.testng.annotations.Test; + +import java.io.File; + +import static org.testng.Assert.*; + +public class DynamicSettingsTest { + + @Test + public void tesDynamicSettingsWithDynamicProperties() throws Exception { + ObjectMapper mapper = Yaml.mapper(); + mapper.registerModule(new GuavaModule()); + + String spec = + "gemName: 'petstore'" + System.lineSeparator() + + "moduleName: 'Petstore'" + System.lineSeparator() + + "gemVersion: '1.0.0'" + System.lineSeparator() + + "apiPackage: 'testing'" + System.lineSeparator(); + + DynamicSettings dynamicSettings = mapper.readValue(spec, DynamicSettings.class); + GeneratorSettings generatorSettings = dynamicSettings.getGeneratorSettings(); + WorkflowSettings workflowSettings = dynamicSettings.getWorkflowSettings(); + + assertNotNull(dynamicSettings); + assertNotNull(generatorSettings); + assertNotNull(workflowSettings); + + assertEquals(generatorSettings.getApiPackage(), "testing"); + assertEquals(generatorSettings.getAdditionalProperties().size(), 7); + assertEquals(generatorSettings.getAdditionalProperties().get("gemName"), "petstore"); + assertEquals(generatorSettings.getAdditionalProperties().get("moduleName"), "Petstore"); + assertEquals(generatorSettings.getAdditionalProperties().get("gemVersion"), "1.0.0"); + assertEquals(generatorSettings.getAdditionalProperties().get("apiPackage"), "testing"); + assertEquals(generatorSettings.getAdditionalProperties().get("gitUserId"), "GIT_USER_ID"); + assertEquals(generatorSettings.getAdditionalProperties().get("gitRepoId"), "GIT_REPO_ID"); + assertEquals(generatorSettings.getAdditionalProperties().get("releaseNote"), "Minor update"); + } + + @Test + public void testDynamicSettingsWithBuilderSideEffects() throws Exception { + ObjectMapper mapper = Yaml.mapper(); + mapper.registerModule(new GuavaModule()); + + // example here is that templateDir is intended to provide the _full_ absolute path + String input = "."; + File current = new File(input); + + // sanity + assertTrue(current.exists()); + assertTrue(current.isDirectory()); + + String spec = + "generatorName: none" + System.lineSeparator() + + "templateDir: '" + input + "'" + System.lineSeparator(); + + DynamicSettings dynamicSettings = mapper.readValue(spec, DynamicSettings.class); + GeneratorSettings generatorSettings = dynamicSettings.getGeneratorSettings(); + WorkflowSettings workflowSettings = dynamicSettings.getWorkflowSettings(); + + assertNotNull(dynamicSettings); + assertNotNull(generatorSettings); + assertNotNull(workflowSettings); + + assertEquals(generatorSettings.getGeneratorName(), "none"); + assertEquals(workflowSettings.getTemplateDir(), current.getAbsolutePath()); + assertNotEquals(workflowSettings.getTemplateDir(), input); + + assertEquals(generatorSettings.getAdditionalProperties().size(), 3); + assertEquals(generatorSettings.getAdditionalProperties().get("gitUserId"), "GIT_USER_ID"); + assertEquals(generatorSettings.getAdditionalProperties().get("gitRepoId"), "GIT_REPO_ID"); + assertEquals(generatorSettings.getAdditionalProperties().get("releaseNote"), "Minor update"); + } + + @Test + public void testDynamicSettingsSetsConstructorDefaultsOnDeserialization() throws Exception { + ObjectMapper mapper = Yaml.mapper(); + mapper.registerModule(new GuavaModule()); + + String gitUserId = "openapitools"; + String spec = + "supportPython2: true" + System.lineSeparator() + + "gitUserId: '" + gitUserId + "'" + System.lineSeparator(); + + DynamicSettings dynamicSettings = mapper.readValue(spec, DynamicSettings.class); + GeneratorSettings generatorSettings = dynamicSettings.getGeneratorSettings(); + WorkflowSettings workflowSettings = dynamicSettings.getWorkflowSettings(); + + assertNotNull(dynamicSettings); + assertNotNull(generatorSettings); + assertNotNull(workflowSettings); + + assertEquals(generatorSettings.getGitUserId(), gitUserId); + assertEquals(generatorSettings.getGitRepoId(), "GIT_REPO_ID"); + assertEquals(generatorSettings.getReleaseNote(), "Minor update"); + + assertEquals(generatorSettings.getAdditionalProperties().size(), 4); + assertEquals(generatorSettings.getAdditionalProperties().get("supportPython2"), true); + assertEquals(generatorSettings.getAdditionalProperties().get("gitUserId"), gitUserId); + assertEquals(generatorSettings.getAdditionalProperties().get("gitRepoId"), "GIT_REPO_ID"); + assertEquals(generatorSettings.getAdditionalProperties().get("releaseNote"), "Minor update"); + } +} diff --git a/modules/openapi-generator/src/test/java/org/openapitools/codegen/java/JavaClientCodegenTest.java b/modules/openapi-generator/src/test/java/org/openapitools/codegen/java/JavaClientCodegenTest.java index 68c556e5b090..b024583a08da 100644 --- a/modules/openapi-generator/src/test/java/org/openapitools/codegen/java/JavaClientCodegenTest.java +++ b/modules/openapi-generator/src/test/java/org/openapitools/codegen/java/JavaClientCodegenTest.java @@ -329,10 +329,6 @@ public void testAuthorizationScopeValues_Issue392() { clientOptInput.setOpenAPI(openAPI); clientOptInput.setConfig(new JavaClientCodegen()); - final ClientOpts clientOpts = new ClientOpts(); - clientOpts.setProperties(Collections.emptyMap()); - clientOptInput.setOpts(clientOpts); - defaultGenerator.opts(clientOptInput); final List codegenOperations = defaultGenerator.processPaths(openAPI.getPaths()).get("Pet"); diff --git a/modules/openapi-generator/src/test/java/org/openapitools/codegen/java/JavaModelTest.java b/modules/openapi-generator/src/test/java/org/openapitools/codegen/java/JavaModelTest.java index 339fc73c11bb..074bf94c1c7c 100644 --- a/modules/openapi-generator/src/test/java/org/openapitools/codegen/java/JavaModelTest.java +++ b/modules/openapi-generator/src/test/java/org/openapitools/codegen/java/JavaModelTest.java @@ -1280,7 +1280,6 @@ public void generateEmpty() throws Exception { final ClientOptInput opts = new ClientOptInput(); opts.setConfig(config); opts.setOpenAPI(openAPI); - opts.setOpts(new ClientOpts()); new DefaultGenerator().opts(opts).generate(); File orderFile = new File(output, "src/main/java/org/openapitools/client/api/DefaultApi.java"); diff --git a/modules/openapi-generator/src/test/java/org/openapitools/codegen/java/jaxrs/JavaJAXRSCXFExtServerCodegenTest.java b/modules/openapi-generator/src/test/java/org/openapitools/codegen/java/jaxrs/JavaJAXRSCXFExtServerCodegenTest.java index 273229f63004..d82604870343 100644 --- a/modules/openapi-generator/src/test/java/org/openapitools/codegen/java/jaxrs/JavaJAXRSCXFExtServerCodegenTest.java +++ b/modules/openapi-generator/src/test/java/org/openapitools/codegen/java/jaxrs/JavaJAXRSCXFExtServerCodegenTest.java @@ -369,11 +369,9 @@ public void testAddOperationToGroup() throws Exception { .getOpenAPI(); codegen.setOutputDir(output.getAbsolutePath()); - ClientOpts opts = new ClientOpts(); ClientOptInput input = new ClientOptInput(); input.setOpenAPI(openAPI); input.setConfig(codegen); - input.setOpts(opts); MockDefaultGenerator generator = new MockDefaultGenerator(); generator.opts(input).generate(); @@ -448,13 +446,11 @@ public void testGenerateOperationBodyWithCodedTestData() throws Exception { .readLocation("src/test/resources/3_0/petstore.yaml", null, new ParseOptions()).getOpenAPI(); codegen.setOutputDir(output.getAbsolutePath()); - ClientOpts opts = new ClientOpts(); - opts.getProperties().put(CXFExtServerFeatures.GENERATE_OPERATION_BODY, "true"); + codegen.additionalProperties().put(CXFExtServerFeatures.GENERATE_OPERATION_BODY, "true"); ClientOptInput input = new ClientOptInput(); input.setOpenAPI(openAPI); input.setConfig(codegen); - input.setOpts(opts); MockDefaultGenerator generator = new MockDefaultGenerator(); generator.opts(input).generate(); @@ -494,14 +490,12 @@ public void testGenerateOperationBodyWithJsonTestData() throws Exception { .readLocation("src/test/resources/3_0/petstore.yaml", null, new ParseOptions()).getOpenAPI(); codegen.setOutputDir(output.getAbsolutePath()); - ClientOpts opts = new ClientOpts(); - opts.getProperties().put(CXFExtServerFeatures.GENERATE_OPERATION_BODY, "true"); - opts.getProperties().put(CXFServerFeatures.LOAD_TEST_DATA_FROM_FILE, "true"); + codegen.additionalProperties().put(CXFExtServerFeatures.GENERATE_OPERATION_BODY, "true"); + codegen.additionalProperties().put(CXFServerFeatures.LOAD_TEST_DATA_FROM_FILE, "true"); ClientOptInput input = new ClientOptInput(); input.setOpenAPI(openAPI); input.setConfig(codegen); - input.setOpts(opts); MockDefaultGenerator generator = new MockDefaultGenerator(); generator.opts(input).generate(); diff --git a/modules/openapi-generator/src/test/java/org/openapitools/codegen/java/jaxrs/JavaJaxrsBaseTest.java b/modules/openapi-generator/src/test/java/org/openapitools/codegen/java/jaxrs/JavaJaxrsBaseTest.java index e76f0bf6fe91..0b782aa3c4eb 100644 --- a/modules/openapi-generator/src/test/java/org/openapitools/codegen/java/jaxrs/JavaJaxrsBaseTest.java +++ b/modules/openapi-generator/src/test/java/org/openapitools/codegen/java/jaxrs/JavaJaxrsBaseTest.java @@ -5,7 +5,6 @@ import io.swagger.v3.oas.models.media.StringSchema; import io.swagger.v3.parser.core.models.ParseOptions; import org.openapitools.codegen.ClientOptInput; -import org.openapitools.codegen.ClientOpts; import org.openapitools.codegen.MockDefaultGenerator; import org.openapitools.codegen.languages.AbstractJavaJAXRSServerCodegen; import org.openapitools.codegen.languages.features.CXFServerFeatures; @@ -33,13 +32,11 @@ public void generateJsonAnnotationForPolymorphism() throws IOException { .readLocation("src/test/resources/3_0/generic.yaml", null, new ParseOptions()).getOpenAPI(); codegen.setOutputDir(output.getAbsolutePath()); - ClientOpts opts = new ClientOpts(); - opts.getProperties().put(CXFServerFeatures.LOAD_TEST_DATA_FROM_FILE, "true"); + codegen.additionalProperties().put(CXFServerFeatures.LOAD_TEST_DATA_FROM_FILE, "true"); ClientOptInput input = new ClientOptInput(); input.setOpenAPI(openAPI); input.setConfig(codegen); - input.setOpts(opts); MockDefaultGenerator generator = new MockDefaultGenerator(); generator.opts(input).generate(); @@ -75,13 +72,11 @@ public void doNotGenerateJsonAnnotationForPolymorphismIfJsonExclude() throws IOE .readLocation("src/test/resources/3_0/generic.yaml", null, new ParseOptions()).getOpenAPI(); codegen.setOutputDir(output.getAbsolutePath()); - ClientOpts opts = new ClientOpts(); - opts.getProperties().put(CXFServerFeatures.LOAD_TEST_DATA_FROM_FILE, "true"); + codegen.additionalProperties().put(CXFServerFeatures.LOAD_TEST_DATA_FROM_FILE, "true"); ClientOptInput input = new ClientOptInput(); input.setOpenAPI(openAPI); input.setConfig(codegen); - input.setOpts(opts); MockDefaultGenerator generator = new MockDefaultGenerator(); generator.opts(input).generate(); @@ -112,13 +107,11 @@ public void doNotAddDefaultValueDocumentationForContainers() throws IOException .readLocation("src/test/resources/3_0/arrayParameter.yaml", null, new ParseOptions()).getOpenAPI(); codegen.setOutputDir(output.getAbsolutePath()); - ClientOpts opts = new ClientOpts(); - opts.getProperties().put(CXFServerFeatures.LOAD_TEST_DATA_FROM_FILE, "true"); + codegen.additionalProperties().put(CXFServerFeatures.LOAD_TEST_DATA_FROM_FILE, "true"); ClientOptInput input = new ClientOptInput(); input.setOpenAPI(openAPI); input.setConfig(codegen); - input.setOpts(opts); MockDefaultGenerator generator = new MockDefaultGenerator(); generator.opts(input).generate(); @@ -138,13 +131,11 @@ public void addDefaultValueDocumentationForNonContainers() throws IOException { openAPI.getComponents().getParameters().get("operationsQueryParam").setSchema(new StringSchema()._default("default")); codegen.setOutputDir(output.getAbsolutePath()); - ClientOpts opts = new ClientOpts(); - opts.getProperties().put(CXFServerFeatures.LOAD_TEST_DATA_FROM_FILE, "true"); + codegen.additionalProperties().put(CXFServerFeatures.LOAD_TEST_DATA_FROM_FILE, "true"); ClientOptInput input = new ClientOptInput(); input.setOpenAPI(openAPI); input.setConfig(codegen); - input.setOpts(opts); MockDefaultGenerator generator = new MockDefaultGenerator(); generator.opts(input).generate(); diff --git a/modules/openapi-generator/src/test/java/org/openapitools/codegen/java/jaxrs/JavaJerseyServerCodegenTest.java b/modules/openapi-generator/src/test/java/org/openapitools/codegen/java/jaxrs/JavaJerseyServerCodegenTest.java index 6d2ac1c23e77..9fda8ba592d2 100644 --- a/modules/openapi-generator/src/test/java/org/openapitools/codegen/java/jaxrs/JavaJerseyServerCodegenTest.java +++ b/modules/openapi-generator/src/test/java/org/openapitools/codegen/java/jaxrs/JavaJerseyServerCodegenTest.java @@ -3,7 +3,6 @@ import io.swagger.v3.oas.models.OpenAPI; import io.swagger.v3.oas.models.servers.Server; import org.openapitools.codegen.ClientOptInput; -import org.openapitools.codegen.ClientOpts; import org.openapitools.codegen.CodegenConstants; import org.openapitools.codegen.CodegenOperation; import org.openapitools.codegen.MockDefaultGenerator; @@ -97,11 +96,9 @@ public void testAddOperationToGroupUseTagsFalse() throws Exception { ((JavaJerseyServerCodegen) codegen).setUseTags(false); codegen.setOutputDir(output.getAbsolutePath()); - ClientOpts opts = new ClientOpts(); ClientOptInput input = new ClientOptInput(); input.setOpenAPI(openAPI); input.setConfig(codegen); - input.setOpts(opts); MockDefaultGenerator generator = new MockDefaultGenerator(); generator.opts(input).generate(); @@ -176,11 +173,9 @@ public void testAddOperationToGroupUseTagsTrue() throws Exception { ((JavaJerseyServerCodegen) codegen).setUseTags(true); codegen.setOutputDir(output.getAbsolutePath()); - ClientOpts opts = new ClientOpts(); ClientOptInput input = new ClientOptInput(); input.setOpenAPI(openAPI); input.setConfig(codegen); - input.setOpts(opts); MockDefaultGenerator generator = new MockDefaultGenerator(); generator.opts(input).generate(); diff --git a/modules/openapi-generator/src/test/java/org/openapitools/codegen/ruby/RubyClientCodegenTest.java b/modules/openapi-generator/src/test/java/org/openapitools/codegen/ruby/RubyClientCodegenTest.java index b0a5bf596040..922c8c4b5202 100644 --- a/modules/openapi-generator/src/test/java/org/openapitools/codegen/ruby/RubyClientCodegenTest.java +++ b/modules/openapi-generator/src/test/java/org/openapitools/codegen/ruby/RubyClientCodegenTest.java @@ -53,7 +53,7 @@ public void testGenerateRubyClientWithHtmlEntity() throws Exception { CodegenConfig codegenConfig = new RubyClientCodegen(); codegenConfig.setOutputDir(output.getAbsolutePath()); - ClientOptInput clientOptInput = new ClientOptInput().opts(new ClientOpts()).openAPI(openAPI).config(codegenConfig); + ClientOptInput clientOptInput = new ClientOptInput().openAPI(openAPI).config(codegenConfig); DefaultGenerator generator = new DefaultGenerator(); List files = generator.opts(clientOptInput).generate(); @@ -117,7 +117,7 @@ public void testBooleanDefaultValue() throws Exception { CodegenConfig codegenConfig = new RubyClientCodegen(); codegenConfig.setOutputDir(output.getAbsolutePath()); - ClientOptInput clientOptInput = new ClientOptInput().opts(new ClientOpts()).openAPI(openAPI).config(codegenConfig); + ClientOptInput clientOptInput = new ClientOptInput().openAPI(openAPI).config(codegenConfig); DefaultGenerator generator = new DefaultGenerator(); List files = generator.opts(clientOptInput).generate(); diff --git a/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/model/EnumArrays.java b/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/model/EnumArrays.java index 45e8e2e1b634..a8d3853b5908 100644 --- a/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/model/EnumArrays.java +++ b/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/model/EnumArrays.java @@ -58,7 +58,7 @@ public static JustSymbolEnum fromValue(String value) { return b; } } - return null; + throw new IllegalArgumentException("Unexpected value '" + value + "'"); } } @@ -96,7 +96,7 @@ public static ArrayEnumEnum fromValue(String value) { return b; } } - return null; + throw new IllegalArgumentException("Unexpected value '" + value + "'"); } } diff --git a/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/model/EnumClass.java b/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/model/EnumClass.java index e757f452e94d..662427bb0ade 100644 --- a/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/model/EnumClass.java +++ b/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/model/EnumClass.java @@ -52,7 +52,7 @@ public static EnumClass fromValue(String value) { return b; } } - return null; + throw new IllegalArgumentException("Unexpected value '" + value + "'"); } } diff --git a/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/model/EnumTest.java b/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/model/EnumTest.java index 8f94eabb281f..546035491960 100644 --- a/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/model/EnumTest.java +++ b/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/model/EnumTest.java @@ -59,7 +59,7 @@ public static EnumStringEnum fromValue(String value) { return b; } } - return null; + throw new IllegalArgumentException("Unexpected value '" + value + "'"); } } @@ -99,7 +99,7 @@ public static EnumStringRequiredEnum fromValue(String value) { return b; } } - return null; + throw new IllegalArgumentException("Unexpected value '" + value + "'"); } } @@ -137,7 +137,7 @@ public static EnumIntegerEnum fromValue(Integer value) { return b; } } - return null; + throw new IllegalArgumentException("Unexpected value '" + value + "'"); } } @@ -175,7 +175,7 @@ public static EnumNumberEnum fromValue(Double value) { return b; } } - return null; + throw new IllegalArgumentException("Unexpected value '" + value + "'"); } } diff --git a/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/model/MapTest.java b/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/model/MapTest.java index a73986fa6521..c140f59e870a 100644 --- a/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/model/MapTest.java +++ b/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/model/MapTest.java @@ -62,7 +62,7 @@ public static InnerEnum fromValue(String value) { return b; } } - return null; + throw new IllegalArgumentException("Unexpected value '" + value + "'"); } } diff --git a/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/model/Order.java b/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/model/Order.java index 875c0fec7174..2879cd2f5aa7 100644 --- a/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/model/Order.java +++ b/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/model/Order.java @@ -71,7 +71,7 @@ public static StatusEnum fromValue(String value) { return b; } } - return null; + throw new IllegalArgumentException("Unexpected value '" + value + "'"); } } diff --git a/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/model/OuterEnum.java b/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/model/OuterEnum.java index 823300463298..46c0003b4e61 100644 --- a/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/model/OuterEnum.java +++ b/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/model/OuterEnum.java @@ -52,7 +52,7 @@ public static OuterEnum fromValue(String value) { return b; } } - return null; + throw new IllegalArgumentException("Unexpected value '" + value + "'"); } } diff --git a/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/model/Pet.java b/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/model/Pet.java index 502673e1550c..2bcbda44b2a3 100644 --- a/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/model/Pet.java +++ b/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/model/Pet.java @@ -77,7 +77,7 @@ public static StatusEnum fromValue(String value) { return b; } } - return null; + throw new IllegalArgumentException("Unexpected value '" + value + "'"); } } diff --git a/samples/client/petstore/java/jersey2/src/main/java/org/openapitools/client/model/EnumArrays.java b/samples/client/petstore/java/jersey2/src/main/java/org/openapitools/client/model/EnumArrays.java index 03bcbcbd1fb6..cb8d45860aec 100644 --- a/samples/client/petstore/java/jersey2/src/main/java/org/openapitools/client/model/EnumArrays.java +++ b/samples/client/petstore/java/jersey2/src/main/java/org/openapitools/client/model/EnumArrays.java @@ -59,7 +59,7 @@ public static JustSymbolEnum fromValue(String value) { return b; } } - return null; + throw new IllegalArgumentException("Unexpected value '" + value + "'"); } } @@ -97,7 +97,7 @@ public static ArrayEnumEnum fromValue(String value) { return b; } } - return null; + throw new IllegalArgumentException("Unexpected value '" + value + "'"); } } diff --git a/samples/client/petstore/java/jersey2/src/main/java/org/openapitools/client/model/EnumClass.java b/samples/client/petstore/java/jersey2/src/main/java/org/openapitools/client/model/EnumClass.java index 5633f0280516..a4cc808868de 100644 --- a/samples/client/petstore/java/jersey2/src/main/java/org/openapitools/client/model/EnumClass.java +++ b/samples/client/petstore/java/jersey2/src/main/java/org/openapitools/client/model/EnumClass.java @@ -53,7 +53,7 @@ public static EnumClass fromValue(String value) { return b; } } - return null; + throw new IllegalArgumentException("Unexpected value '" + value + "'"); } } diff --git a/samples/client/petstore/java/jersey2/src/main/java/org/openapitools/client/model/EnumTest.java b/samples/client/petstore/java/jersey2/src/main/java/org/openapitools/client/model/EnumTest.java index d7c41d30174b..bdf61d52c93d 100644 --- a/samples/client/petstore/java/jersey2/src/main/java/org/openapitools/client/model/EnumTest.java +++ b/samples/client/petstore/java/jersey2/src/main/java/org/openapitools/client/model/EnumTest.java @@ -60,7 +60,7 @@ public static EnumStringEnum fromValue(String value) { return b; } } - return null; + throw new IllegalArgumentException("Unexpected value '" + value + "'"); } } @@ -100,7 +100,7 @@ public static EnumStringRequiredEnum fromValue(String value) { return b; } } - return null; + throw new IllegalArgumentException("Unexpected value '" + value + "'"); } } @@ -138,7 +138,7 @@ public static EnumIntegerEnum fromValue(Integer value) { return b; } } - return null; + throw new IllegalArgumentException("Unexpected value '" + value + "'"); } } @@ -176,7 +176,7 @@ public static EnumNumberEnum fromValue(Double value) { return b; } } - return null; + throw new IllegalArgumentException("Unexpected value '" + value + "'"); } } diff --git a/samples/client/petstore/java/jersey2/src/main/java/org/openapitools/client/model/MapTest.java b/samples/client/petstore/java/jersey2/src/main/java/org/openapitools/client/model/MapTest.java index c47f0375752f..625b6be97dd9 100644 --- a/samples/client/petstore/java/jersey2/src/main/java/org/openapitools/client/model/MapTest.java +++ b/samples/client/petstore/java/jersey2/src/main/java/org/openapitools/client/model/MapTest.java @@ -63,7 +63,7 @@ public static InnerEnum fromValue(String value) { return b; } } - return null; + throw new IllegalArgumentException("Unexpected value '" + value + "'"); } } diff --git a/samples/client/petstore/java/jersey2/src/main/java/org/openapitools/client/model/Order.java b/samples/client/petstore/java/jersey2/src/main/java/org/openapitools/client/model/Order.java index 3a7801b65b09..c6cee16a580b 100644 --- a/samples/client/petstore/java/jersey2/src/main/java/org/openapitools/client/model/Order.java +++ b/samples/client/petstore/java/jersey2/src/main/java/org/openapitools/client/model/Order.java @@ -72,7 +72,7 @@ public static StatusEnum fromValue(String value) { return b; } } - return null; + throw new IllegalArgumentException("Unexpected value '" + value + "'"); } } diff --git a/samples/client/petstore/java/jersey2/src/main/java/org/openapitools/client/model/OuterEnum.java b/samples/client/petstore/java/jersey2/src/main/java/org/openapitools/client/model/OuterEnum.java index f83b0c95877a..dacbbdfb2c91 100644 --- a/samples/client/petstore/java/jersey2/src/main/java/org/openapitools/client/model/OuterEnum.java +++ b/samples/client/petstore/java/jersey2/src/main/java/org/openapitools/client/model/OuterEnum.java @@ -53,7 +53,7 @@ public static OuterEnum fromValue(String value) { return b; } } - return null; + throw new IllegalArgumentException("Unexpected value '" + value + "'"); } } diff --git a/samples/client/petstore/java/jersey2/src/main/java/org/openapitools/client/model/Pet.java b/samples/client/petstore/java/jersey2/src/main/java/org/openapitools/client/model/Pet.java index f604115ce981..8a2408a296a3 100644 --- a/samples/client/petstore/java/jersey2/src/main/java/org/openapitools/client/model/Pet.java +++ b/samples/client/petstore/java/jersey2/src/main/java/org/openapitools/client/model/Pet.java @@ -78,7 +78,7 @@ public static StatusEnum fromValue(String value) { return b; } } - return null; + throw new IllegalArgumentException("Unexpected value '" + value + "'"); } } diff --git a/samples/openapi3/client/petstore/ruby/README.md b/samples/openapi3/client/petstore/ruby/README.md index 6fb930ed9a88..6be30fc31158 100644 --- a/samples/openapi3/client/petstore/ruby/README.md +++ b/samples/openapi3/client/petstore/ruby/README.md @@ -139,6 +139,12 @@ Class | Method | HTTP request | Description - [Petstore::FormatTest](docs/FormatTest.md) - [Petstore::HasOnlyReadOnly](docs/HasOnlyReadOnly.md) - [Petstore::HealthCheckResult](docs/HealthCheckResult.md) + - [Petstore::InlineObject](docs/InlineObject.md) + - [Petstore::InlineObject1](docs/InlineObject1.md) + - [Petstore::InlineObject2](docs/InlineObject2.md) + - [Petstore::InlineObject3](docs/InlineObject3.md) + - [Petstore::InlineObject4](docs/InlineObject4.md) + - [Petstore::InlineObject5](docs/InlineObject5.md) - [Petstore::InlineResponseDefault](docs/InlineResponseDefault.md) - [Petstore::List](docs/List.md) - [Petstore::MapTest](docs/MapTest.md) diff --git a/samples/openapi3/client/petstore/ruby/docs/InlineObject.md b/samples/openapi3/client/petstore/ruby/docs/InlineObject.md new file mode 100644 index 000000000000..f5211d44464c --- /dev/null +++ b/samples/openapi3/client/petstore/ruby/docs/InlineObject.md @@ -0,0 +1,19 @@ +# Petstore::InlineObject + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**name** | **String** | Updated name of the pet | [optional] +**status** | **String** | Updated status of the pet | [optional] + +## Code Sample + +```ruby +require 'Petstore' + +instance = Petstore::InlineObject.new(name: null, + status: null) +``` + + diff --git a/samples/openapi3/client/petstore/ruby/docs/InlineObject1.md b/samples/openapi3/client/petstore/ruby/docs/InlineObject1.md new file mode 100644 index 000000000000..bac17e753cdc --- /dev/null +++ b/samples/openapi3/client/petstore/ruby/docs/InlineObject1.md @@ -0,0 +1,19 @@ +# Petstore::InlineObject1 + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**additional_metadata** | **String** | Additional data to pass to server | [optional] +**file** | **File** | file to upload | [optional] + +## Code Sample + +```ruby +require 'Petstore' + +instance = Petstore::InlineObject1.new(additional_metadata: null, + file: null) +``` + + diff --git a/samples/openapi3/client/petstore/ruby/docs/InlineObject2.md b/samples/openapi3/client/petstore/ruby/docs/InlineObject2.md new file mode 100644 index 000000000000..31118c5b262e --- /dev/null +++ b/samples/openapi3/client/petstore/ruby/docs/InlineObject2.md @@ -0,0 +1,19 @@ +# Petstore::InlineObject2 + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**enum_form_string_array** | **Array<String>** | Form parameter enum test (string array) | [optional] +**enum_form_string** | **String** | Form parameter enum test (string) | [optional] [default to '-efg'] + +## Code Sample + +```ruby +require 'Petstore' + +instance = Petstore::InlineObject2.new(enum_form_string_array: null, + enum_form_string: null) +``` + + diff --git a/samples/openapi3/client/petstore/ruby/docs/InlineObject3.md b/samples/openapi3/client/petstore/ruby/docs/InlineObject3.md new file mode 100644 index 000000000000..b6cb7ccb29b1 --- /dev/null +++ b/samples/openapi3/client/petstore/ruby/docs/InlineObject3.md @@ -0,0 +1,43 @@ +# Petstore::InlineObject3 + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**integer** | **Integer** | None | [optional] +**int32** | **Integer** | None | [optional] +**int64** | **Integer** | None | [optional] +**number** | **Float** | None | +**float** | **Float** | None | [optional] +**double** | **Float** | None | +**string** | **String** | None | [optional] +**pattern_without_delimiter** | **String** | None | +**byte** | **String** | None | +**binary** | **File** | None | [optional] +**date** | **Date** | None | [optional] +**date_time** | **DateTime** | None | [optional] +**password** | **String** | None | [optional] +**callback** | **String** | None | [optional] + +## Code Sample + +```ruby +require 'Petstore' + +instance = Petstore::InlineObject3.new(integer: null, + int32: null, + int64: null, + number: null, + float: null, + double: null, + string: null, + pattern_without_delimiter: null, + byte: null, + binary: null, + date: null, + date_time: null, + password: null, + callback: null) +``` + + diff --git a/samples/openapi3/client/petstore/ruby/docs/InlineObject4.md b/samples/openapi3/client/petstore/ruby/docs/InlineObject4.md new file mode 100644 index 000000000000..97179c3e3772 --- /dev/null +++ b/samples/openapi3/client/petstore/ruby/docs/InlineObject4.md @@ -0,0 +1,19 @@ +# Petstore::InlineObject4 + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**param** | **String** | field1 | +**param2** | **String** | field2 | + +## Code Sample + +```ruby +require 'Petstore' + +instance = Petstore::InlineObject4.new(param: null, + param2: null) +``` + + diff --git a/samples/openapi3/client/petstore/ruby/docs/InlineObject5.md b/samples/openapi3/client/petstore/ruby/docs/InlineObject5.md new file mode 100644 index 000000000000..23c1df99ffeb --- /dev/null +++ b/samples/openapi3/client/petstore/ruby/docs/InlineObject5.md @@ -0,0 +1,19 @@ +# Petstore::InlineObject5 + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**additional_metadata** | **String** | Additional data to pass to server | [optional] +**required_file** | **File** | file to upload | + +## Code Sample + +```ruby +require 'Petstore' + +instance = Petstore::InlineObject5.new(additional_metadata: null, + required_file: null) +``` + + diff --git a/samples/openapi3/client/petstore/ruby/lib/petstore.rb b/samples/openapi3/client/petstore/ruby/lib/petstore.rb index 822ea45c06ac..12ff44084b3c 100644 --- a/samples/openapi3/client/petstore/ruby/lib/petstore.rb +++ b/samples/openapi3/client/petstore/ruby/lib/petstore.rb @@ -40,6 +40,12 @@ require 'petstore/models/format_test' require 'petstore/models/has_only_read_only' require 'petstore/models/health_check_result' +require 'petstore/models/inline_object' +require 'petstore/models/inline_object1' +require 'petstore/models/inline_object2' +require 'petstore/models/inline_object3' +require 'petstore/models/inline_object4' +require 'petstore/models/inline_object5' require 'petstore/models/inline_response_default' require 'petstore/models/list' require 'petstore/models/map_test' diff --git a/samples/openapi3/client/petstore/ruby/lib/petstore/models/inline_object.rb b/samples/openapi3/client/petstore/ruby/lib/petstore/models/inline_object.rb new file mode 100644 index 000000000000..3fc989317831 --- /dev/null +++ b/samples/openapi3/client/petstore/ruby/lib/petstore/models/inline_object.rb @@ -0,0 +1,207 @@ +=begin +#OpenAPI Petstore + +#This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + +The version of the OpenAPI document: 1.0.0 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 4.1.0-SNAPSHOT + +=end + +require 'date' + +module Petstore + class InlineObject + # Updated name of the pet + attr_accessor :name + + # Updated status of the pet + attr_accessor :status + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'name' => :'name', + :'status' => :'status' + } + end + + # Attribute type mapping. + def self.openapi_types + { + :'name' => :'String', + :'status' => :'String' + } + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Petstore::InlineObject` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Petstore::InlineObject`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'name') + self.name = attributes[:'name'] + end + + if attributes.key?(:'status') + self.status = attributes[:'status'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + name == o.name && + status == o.status + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [name, status].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + new.build_from_hash(attributes) + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + self.class.openapi_types.each_pair do |key, type| + if type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[self.class.attribute_map[key]].is_a?(Array) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + end + elsif !attributes[self.class.attribute_map[key]].nil? + self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) + end # or else data not found in attributes(hash), not an issue as the data can be optional + end + + self + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def _deserialize(type, value) + case type.to_sym + when :DateTime + DateTime.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + Petstore.const_get(type).build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + next if value.nil? + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + end +end diff --git a/samples/openapi3/client/petstore/ruby/lib/petstore/models/inline_object1.rb b/samples/openapi3/client/petstore/ruby/lib/petstore/models/inline_object1.rb new file mode 100644 index 000000000000..e61b19c09b0e --- /dev/null +++ b/samples/openapi3/client/petstore/ruby/lib/petstore/models/inline_object1.rb @@ -0,0 +1,207 @@ +=begin +#OpenAPI Petstore + +#This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + +The version of the OpenAPI document: 1.0.0 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 4.1.0-SNAPSHOT + +=end + +require 'date' + +module Petstore + class InlineObject1 + # Additional data to pass to server + attr_accessor :additional_metadata + + # file to upload + attr_accessor :file + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'additional_metadata' => :'additionalMetadata', + :'file' => :'file' + } + end + + # Attribute type mapping. + def self.openapi_types + { + :'additional_metadata' => :'String', + :'file' => :'File' + } + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Petstore::InlineObject1` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Petstore::InlineObject1`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'additional_metadata') + self.additional_metadata = attributes[:'additional_metadata'] + end + + if attributes.key?(:'file') + self.file = attributes[:'file'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + additional_metadata == o.additional_metadata && + file == o.file + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [additional_metadata, file].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + new.build_from_hash(attributes) + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + self.class.openapi_types.each_pair do |key, type| + if type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[self.class.attribute_map[key]].is_a?(Array) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + end + elsif !attributes[self.class.attribute_map[key]].nil? + self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) + end # or else data not found in attributes(hash), not an issue as the data can be optional + end + + self + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def _deserialize(type, value) + case type.to_sym + when :DateTime + DateTime.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + Petstore.const_get(type).build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + next if value.nil? + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + end +end diff --git a/samples/openapi3/client/petstore/ruby/lib/petstore/models/inline_object2.rb b/samples/openapi3/client/petstore/ruby/lib/petstore/models/inline_object2.rb new file mode 100644 index 000000000000..50514beacece --- /dev/null +++ b/samples/openapi3/client/petstore/ruby/lib/petstore/models/inline_object2.rb @@ -0,0 +1,245 @@ +=begin +#OpenAPI Petstore + +#This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + +The version of the OpenAPI document: 1.0.0 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 4.1.0-SNAPSHOT + +=end + +require 'date' + +module Petstore + class InlineObject2 + # Form parameter enum test (string array) + attr_accessor :enum_form_string_array + + # Form parameter enum test (string) + attr_accessor :enum_form_string + + class EnumAttributeValidator + attr_reader :datatype + attr_reader :allowable_values + + def initialize(datatype, allowable_values) + @allowable_values = allowable_values.map do |value| + case datatype.to_s + when /Integer/i + value.to_i + when /Float/i + value.to_f + else + value + end + end + end + + def valid?(value) + !value || allowable_values.include?(value) + end + end + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'enum_form_string_array' => :'enum_form_string_array', + :'enum_form_string' => :'enum_form_string' + } + end + + # Attribute type mapping. + def self.openapi_types + { + :'enum_form_string_array' => :'Array', + :'enum_form_string' => :'String' + } + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Petstore::InlineObject2` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Petstore::InlineObject2`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'enum_form_string_array') + if (value = attributes[:'enum_form_string_array']).is_a?(Array) + self.enum_form_string_array = value + end + end + + if attributes.key?(:'enum_form_string') + self.enum_form_string = attributes[:'enum_form_string'] + else + self.enum_form_string = '-efg' + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + enum_form_string_validator = EnumAttributeValidator.new('String', ["_abc", "-efg", "(xyz)"]) + return false unless enum_form_string_validator.valid?(@enum_form_string) + true + end + + # Custom attribute writer method checking allowed values (enum). + # @param [Object] enum_form_string Object to be assigned + def enum_form_string=(enum_form_string) + validator = EnumAttributeValidator.new('String', ["_abc", "-efg", "(xyz)"]) + unless validator.valid?(enum_form_string) + fail ArgumentError, "invalid value for \"enum_form_string\", must be one of #{validator.allowable_values}." + end + @enum_form_string = enum_form_string + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + enum_form_string_array == o.enum_form_string_array && + enum_form_string == o.enum_form_string + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [enum_form_string_array, enum_form_string].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + new.build_from_hash(attributes) + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + self.class.openapi_types.each_pair do |key, type| + if type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[self.class.attribute_map[key]].is_a?(Array) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + end + elsif !attributes[self.class.attribute_map[key]].nil? + self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) + end # or else data not found in attributes(hash), not an issue as the data can be optional + end + + self + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def _deserialize(type, value) + case type.to_sym + when :DateTime + DateTime.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + Petstore.const_get(type).build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + next if value.nil? + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + end +end diff --git a/samples/openapi3/client/petstore/ruby/lib/petstore/models/inline_object3.rb b/samples/openapi3/client/petstore/ruby/lib/petstore/models/inline_object3.rb new file mode 100644 index 000000000000..15245d845c65 --- /dev/null +++ b/samples/openapi3/client/petstore/ruby/lib/petstore/models/inline_object3.rb @@ -0,0 +1,528 @@ +=begin +#OpenAPI Petstore + +#This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + +The version of the OpenAPI document: 1.0.0 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 4.1.0-SNAPSHOT + +=end + +require 'date' + +module Petstore + class InlineObject3 + # None + attr_accessor :integer + + # None + attr_accessor :int32 + + # None + attr_accessor :int64 + + # None + attr_accessor :number + + # None + attr_accessor :float + + # None + attr_accessor :double + + # None + attr_accessor :string + + # None + attr_accessor :pattern_without_delimiter + + # None + attr_accessor :byte + + # None + attr_accessor :binary + + # None + attr_accessor :date + + # None + attr_accessor :date_time + + # None + attr_accessor :password + + # None + attr_accessor :callback + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'integer' => :'integer', + :'int32' => :'int32', + :'int64' => :'int64', + :'number' => :'number', + :'float' => :'float', + :'double' => :'double', + :'string' => :'string', + :'pattern_without_delimiter' => :'pattern_without_delimiter', + :'byte' => :'byte', + :'binary' => :'binary', + :'date' => :'date', + :'date_time' => :'dateTime', + :'password' => :'password', + :'callback' => :'callback' + } + end + + # Attribute type mapping. + def self.openapi_types + { + :'integer' => :'Integer', + :'int32' => :'Integer', + :'int64' => :'Integer', + :'number' => :'Float', + :'float' => :'Float', + :'double' => :'Float', + :'string' => :'String', + :'pattern_without_delimiter' => :'String', + :'byte' => :'String', + :'binary' => :'File', + :'date' => :'Date', + :'date_time' => :'DateTime', + :'password' => :'String', + :'callback' => :'String' + } + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Petstore::InlineObject3` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Petstore::InlineObject3`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'integer') + self.integer = attributes[:'integer'] + end + + if attributes.key?(:'int32') + self.int32 = attributes[:'int32'] + end + + if attributes.key?(:'int64') + self.int64 = attributes[:'int64'] + end + + if attributes.key?(:'number') + self.number = attributes[:'number'] + end + + if attributes.key?(:'float') + self.float = attributes[:'float'] + end + + if attributes.key?(:'double') + self.double = attributes[:'double'] + end + + if attributes.key?(:'string') + self.string = attributes[:'string'] + end + + if attributes.key?(:'pattern_without_delimiter') + self.pattern_without_delimiter = attributes[:'pattern_without_delimiter'] + end + + if attributes.key?(:'byte') + self.byte = attributes[:'byte'] + end + + if attributes.key?(:'binary') + self.binary = attributes[:'binary'] + end + + if attributes.key?(:'date') + self.date = attributes[:'date'] + end + + if attributes.key?(:'date_time') + self.date_time = attributes[:'date_time'] + end + + if attributes.key?(:'password') + self.password = attributes[:'password'] + end + + if attributes.key?(:'callback') + self.callback = attributes[:'callback'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array.new + if !@integer.nil? && @integer > 100 + invalid_properties.push('invalid value for "integer", must be smaller than or equal to 100.') + end + + if !@integer.nil? && @integer < 10 + invalid_properties.push('invalid value for "integer", must be greater than or equal to 10.') + end + + if !@int32.nil? && @int32 > 200 + invalid_properties.push('invalid value for "int32", must be smaller than or equal to 200.') + end + + if !@int32.nil? && @int32 < 20 + invalid_properties.push('invalid value for "int32", must be greater than or equal to 20.') + end + + if @number.nil? + invalid_properties.push('invalid value for "number", number cannot be nil.') + end + + if @number > 543.2 + invalid_properties.push('invalid value for "number", must be smaller than or equal to 543.2.') + end + + if @number < 32.1 + invalid_properties.push('invalid value for "number", must be greater than or equal to 32.1.') + end + + if !@float.nil? && @float > 987.6 + invalid_properties.push('invalid value for "float", must be smaller than or equal to 987.6.') + end + + if @double.nil? + invalid_properties.push('invalid value for "double", double cannot be nil.') + end + + if @double > 123.4 + invalid_properties.push('invalid value for "double", must be smaller than or equal to 123.4.') + end + + if @double < 67.8 + invalid_properties.push('invalid value for "double", must be greater than or equal to 67.8.') + end + + pattern = Regexp.new(/[a-z]/i) + if !@string.nil? && @string !~ pattern + invalid_properties.push("invalid value for \"string\", must conform to the pattern #{pattern}.") + end + + if @pattern_without_delimiter.nil? + invalid_properties.push('invalid value for "pattern_without_delimiter", pattern_without_delimiter cannot be nil.') + end + + pattern = Regexp.new(/^[A-Z].*/) + if @pattern_without_delimiter !~ pattern + invalid_properties.push("invalid value for \"pattern_without_delimiter\", must conform to the pattern #{pattern}.") + end + + if @byte.nil? + invalid_properties.push('invalid value for "byte", byte cannot be nil.') + end + + if !@password.nil? && @password.to_s.length > 64 + invalid_properties.push('invalid value for "password", the character length must be smaller than or equal to 64.') + end + + if !@password.nil? && @password.to_s.length < 10 + invalid_properties.push('invalid value for "password", the character length must be great than or equal to 10.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + return false if !@integer.nil? && @integer > 100 + return false if !@integer.nil? && @integer < 10 + return false if !@int32.nil? && @int32 > 200 + return false if !@int32.nil? && @int32 < 20 + return false if @number.nil? + return false if @number > 543.2 + return false if @number < 32.1 + return false if !@float.nil? && @float > 987.6 + return false if @double.nil? + return false if @double > 123.4 + return false if @double < 67.8 + return false if !@string.nil? && @string !~ Regexp.new(/[a-z]/i) + return false if @pattern_without_delimiter.nil? + return false if @pattern_without_delimiter !~ Regexp.new(/^[A-Z].*/) + return false if @byte.nil? + return false if !@password.nil? && @password.to_s.length > 64 + return false if !@password.nil? && @password.to_s.length < 10 + true + end + + # Custom attribute writer method with validation + # @param [Object] integer Value to be assigned + def integer=(integer) + if !integer.nil? && integer > 100 + fail ArgumentError, 'invalid value for "integer", must be smaller than or equal to 100.' + end + + if !integer.nil? && integer < 10 + fail ArgumentError, 'invalid value for "integer", must be greater than or equal to 10.' + end + + @integer = integer + end + + # Custom attribute writer method with validation + # @param [Object] int32 Value to be assigned + def int32=(int32) + if !int32.nil? && int32 > 200 + fail ArgumentError, 'invalid value for "int32", must be smaller than or equal to 200.' + end + + if !int32.nil? && int32 < 20 + fail ArgumentError, 'invalid value for "int32", must be greater than or equal to 20.' + end + + @int32 = int32 + end + + # Custom attribute writer method with validation + # @param [Object] number Value to be assigned + def number=(number) + if number.nil? + fail ArgumentError, 'number cannot be nil' + end + + if number > 543.2 + fail ArgumentError, 'invalid value for "number", must be smaller than or equal to 543.2.' + end + + if number < 32.1 + fail ArgumentError, 'invalid value for "number", must be greater than or equal to 32.1.' + end + + @number = number + end + + # Custom attribute writer method with validation + # @param [Object] float Value to be assigned + def float=(float) + if !float.nil? && float > 987.6 + fail ArgumentError, 'invalid value for "float", must be smaller than or equal to 987.6.' + end + + @float = float + end + + # Custom attribute writer method with validation + # @param [Object] double Value to be assigned + def double=(double) + if double.nil? + fail ArgumentError, 'double cannot be nil' + end + + if double > 123.4 + fail ArgumentError, 'invalid value for "double", must be smaller than or equal to 123.4.' + end + + if double < 67.8 + fail ArgumentError, 'invalid value for "double", must be greater than or equal to 67.8.' + end + + @double = double + end + + # Custom attribute writer method with validation + # @param [Object] string Value to be assigned + def string=(string) + pattern = Regexp.new(/[a-z]/i) + if !string.nil? && string !~ pattern + fail ArgumentError, "invalid value for \"string\", must conform to the pattern #{pattern}." + end + + @string = string + end + + # Custom attribute writer method with validation + # @param [Object] pattern_without_delimiter Value to be assigned + def pattern_without_delimiter=(pattern_without_delimiter) + if pattern_without_delimiter.nil? + fail ArgumentError, 'pattern_without_delimiter cannot be nil' + end + + pattern = Regexp.new(/^[A-Z].*/) + if pattern_without_delimiter !~ pattern + fail ArgumentError, "invalid value for \"pattern_without_delimiter\", must conform to the pattern #{pattern}." + end + + @pattern_without_delimiter = pattern_without_delimiter + end + + # Custom attribute writer method with validation + # @param [Object] password Value to be assigned + def password=(password) + if !password.nil? && password.to_s.length > 64 + fail ArgumentError, 'invalid value for "password", the character length must be smaller than or equal to 64.' + end + + if !password.nil? && password.to_s.length < 10 + fail ArgumentError, 'invalid value for "password", the character length must be great than or equal to 10.' + end + + @password = password + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + integer == o.integer && + int32 == o.int32 && + int64 == o.int64 && + number == o.number && + float == o.float && + double == o.double && + string == o.string && + pattern_without_delimiter == o.pattern_without_delimiter && + byte == o.byte && + binary == o.binary && + date == o.date && + date_time == o.date_time && + password == o.password && + callback == o.callback + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [integer, int32, int64, number, float, double, string, pattern_without_delimiter, byte, binary, date, date_time, password, callback].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + new.build_from_hash(attributes) + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + self.class.openapi_types.each_pair do |key, type| + if type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[self.class.attribute_map[key]].is_a?(Array) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + end + elsif !attributes[self.class.attribute_map[key]].nil? + self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) + end # or else data not found in attributes(hash), not an issue as the data can be optional + end + + self + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def _deserialize(type, value) + case type.to_sym + when :DateTime + DateTime.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + Petstore.const_get(type).build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + next if value.nil? + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + end +end diff --git a/samples/openapi3/client/petstore/ruby/lib/petstore/models/inline_object4.rb b/samples/openapi3/client/petstore/ruby/lib/petstore/models/inline_object4.rb new file mode 100644 index 000000000000..72c7595b8586 --- /dev/null +++ b/samples/openapi3/client/petstore/ruby/lib/petstore/models/inline_object4.rb @@ -0,0 +1,217 @@ +=begin +#OpenAPI Petstore + +#This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + +The version of the OpenAPI document: 1.0.0 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 4.1.0-SNAPSHOT + +=end + +require 'date' + +module Petstore + class InlineObject4 + # field1 + attr_accessor :param + + # field2 + attr_accessor :param2 + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'param' => :'param', + :'param2' => :'param2' + } + end + + # Attribute type mapping. + def self.openapi_types + { + :'param' => :'String', + :'param2' => :'String' + } + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Petstore::InlineObject4` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Petstore::InlineObject4`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'param') + self.param = attributes[:'param'] + end + + if attributes.key?(:'param2') + self.param2 = attributes[:'param2'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array.new + if @param.nil? + invalid_properties.push('invalid value for "param", param cannot be nil.') + end + + if @param2.nil? + invalid_properties.push('invalid value for "param2", param2 cannot be nil.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + return false if @param.nil? + return false if @param2.nil? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + param == o.param && + param2 == o.param2 + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [param, param2].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + new.build_from_hash(attributes) + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + self.class.openapi_types.each_pair do |key, type| + if type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[self.class.attribute_map[key]].is_a?(Array) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + end + elsif !attributes[self.class.attribute_map[key]].nil? + self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) + end # or else data not found in attributes(hash), not an issue as the data can be optional + end + + self + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def _deserialize(type, value) + case type.to_sym + when :DateTime + DateTime.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + Petstore.const_get(type).build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + next if value.nil? + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + end +end diff --git a/samples/openapi3/client/petstore/ruby/lib/petstore/models/inline_object5.rb b/samples/openapi3/client/petstore/ruby/lib/petstore/models/inline_object5.rb new file mode 100644 index 000000000000..fdff4997056d --- /dev/null +++ b/samples/openapi3/client/petstore/ruby/lib/petstore/models/inline_object5.rb @@ -0,0 +1,212 @@ +=begin +#OpenAPI Petstore + +#This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + +The version of the OpenAPI document: 1.0.0 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 4.1.0-SNAPSHOT + +=end + +require 'date' + +module Petstore + class InlineObject5 + # Additional data to pass to server + attr_accessor :additional_metadata + + # file to upload + attr_accessor :required_file + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'additional_metadata' => :'additionalMetadata', + :'required_file' => :'requiredFile' + } + end + + # Attribute type mapping. + def self.openapi_types + { + :'additional_metadata' => :'String', + :'required_file' => :'File' + } + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Petstore::InlineObject5` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Petstore::InlineObject5`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'additional_metadata') + self.additional_metadata = attributes[:'additional_metadata'] + end + + if attributes.key?(:'required_file') + self.required_file = attributes[:'required_file'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array.new + if @required_file.nil? + invalid_properties.push('invalid value for "required_file", required_file cannot be nil.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + return false if @required_file.nil? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + additional_metadata == o.additional_metadata && + required_file == o.required_file + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [additional_metadata, required_file].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + new.build_from_hash(attributes) + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + self.class.openapi_types.each_pair do |key, type| + if type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[self.class.attribute_map[key]].is_a?(Array) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + end + elsif !attributes[self.class.attribute_map[key]].nil? + self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) + end # or else data not found in attributes(hash), not an issue as the data can be optional + end + + self + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def _deserialize(type, value) + case type.to_sym + when :DateTime + DateTime.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + Petstore.const_get(type).build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + next if value.nil? + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + end +end diff --git a/samples/openapi3/client/petstore/ruby/spec/models/inline_object1_spec.rb b/samples/openapi3/client/petstore/ruby/spec/models/inline_object1_spec.rb new file mode 100644 index 000000000000..40d5f80b322d --- /dev/null +++ b/samples/openapi3/client/petstore/ruby/spec/models/inline_object1_spec.rb @@ -0,0 +1,47 @@ +=begin +#OpenAPI Petstore + +#This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + +The version of the OpenAPI document: 1.0.0 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 4.1.0-SNAPSHOT + +=end + +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for Petstore::InlineObject1 +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe 'InlineObject1' do + before do + # run before each test + @instance = Petstore::InlineObject1.new + end + + after do + # run after each test + end + + describe 'test an instance of InlineObject1' do + it 'should create an instance of InlineObject1' do + expect(@instance).to be_instance_of(Petstore::InlineObject1) + end + end + describe 'test attribute "additional_metadata"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "file"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + +end diff --git a/samples/openapi3/client/petstore/ruby/spec/models/inline_object2_spec.rb b/samples/openapi3/client/petstore/ruby/spec/models/inline_object2_spec.rb new file mode 100644 index 000000000000..d9ee4e8d6bdd --- /dev/null +++ b/samples/openapi3/client/petstore/ruby/spec/models/inline_object2_spec.rb @@ -0,0 +1,55 @@ +=begin +#OpenAPI Petstore + +#This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + +The version of the OpenAPI document: 1.0.0 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 4.1.0-SNAPSHOT + +=end + +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for Petstore::InlineObject2 +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe 'InlineObject2' do + before do + # run before each test + @instance = Petstore::InlineObject2.new + end + + after do + # run after each test + end + + describe 'test an instance of InlineObject2' do + it 'should create an instance of InlineObject2' do + expect(@instance).to be_instance_of(Petstore::InlineObject2) + end + end + describe 'test attribute "enum_form_string_array"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + # validator = Petstore::EnumTest::EnumAttributeValidator.new('Array', [">", "$"]) + # validator.allowable_values.each do |value| + # expect { @instance.enum_form_string_array = value }.not_to raise_error + # end + end + end + + describe 'test attribute "enum_form_string"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + # validator = Petstore::EnumTest::EnumAttributeValidator.new('String', ["_abc", "-efg", "(xyz)"]) + # validator.allowable_values.each do |value| + # expect { @instance.enum_form_string = value }.not_to raise_error + # end + end + end + +end diff --git a/samples/openapi3/client/petstore/ruby/spec/models/inline_object3_spec.rb b/samples/openapi3/client/petstore/ruby/spec/models/inline_object3_spec.rb new file mode 100644 index 000000000000..2fb2d0acd0a6 --- /dev/null +++ b/samples/openapi3/client/petstore/ruby/spec/models/inline_object3_spec.rb @@ -0,0 +1,119 @@ +=begin +#OpenAPI Petstore + +#This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + +The version of the OpenAPI document: 1.0.0 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 4.1.0-SNAPSHOT + +=end + +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for Petstore::InlineObject3 +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe 'InlineObject3' do + before do + # run before each test + @instance = Petstore::InlineObject3.new + end + + after do + # run after each test + end + + describe 'test an instance of InlineObject3' do + it 'should create an instance of InlineObject3' do + expect(@instance).to be_instance_of(Petstore::InlineObject3) + end + end + describe 'test attribute "integer"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "int32"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "int64"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "number"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "float"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "double"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "string"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "pattern_without_delimiter"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "byte"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "binary"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "date"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "date_time"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "password"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "callback"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + +end diff --git a/samples/openapi3/client/petstore/ruby/spec/models/inline_object4_spec.rb b/samples/openapi3/client/petstore/ruby/spec/models/inline_object4_spec.rb new file mode 100644 index 000000000000..467108f38b78 --- /dev/null +++ b/samples/openapi3/client/petstore/ruby/spec/models/inline_object4_spec.rb @@ -0,0 +1,47 @@ +=begin +#OpenAPI Petstore + +#This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + +The version of the OpenAPI document: 1.0.0 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 4.1.0-SNAPSHOT + +=end + +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for Petstore::InlineObject4 +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe 'InlineObject4' do + before do + # run before each test + @instance = Petstore::InlineObject4.new + end + + after do + # run after each test + end + + describe 'test an instance of InlineObject4' do + it 'should create an instance of InlineObject4' do + expect(@instance).to be_instance_of(Petstore::InlineObject4) + end + end + describe 'test attribute "param"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "param2"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + +end diff --git a/samples/openapi3/client/petstore/ruby/spec/models/inline_object5_spec.rb b/samples/openapi3/client/petstore/ruby/spec/models/inline_object5_spec.rb new file mode 100644 index 000000000000..76b646c19496 --- /dev/null +++ b/samples/openapi3/client/petstore/ruby/spec/models/inline_object5_spec.rb @@ -0,0 +1,47 @@ +=begin +#OpenAPI Petstore + +#This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + +The version of the OpenAPI document: 1.0.0 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 4.1.0-SNAPSHOT + +=end + +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for Petstore::InlineObject5 +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe 'InlineObject5' do + before do + # run before each test + @instance = Petstore::InlineObject5.new + end + + after do + # run after each test + end + + describe 'test an instance of InlineObject5' do + it 'should create an instance of InlineObject5' do + expect(@instance).to be_instance_of(Petstore::InlineObject5) + end + end + describe 'test attribute "additional_metadata"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "required_file"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + +end diff --git a/samples/openapi3/client/petstore/ruby/spec/models/inline_object_spec.rb b/samples/openapi3/client/petstore/ruby/spec/models/inline_object_spec.rb new file mode 100644 index 000000000000..ccb47629bd31 --- /dev/null +++ b/samples/openapi3/client/petstore/ruby/spec/models/inline_object_spec.rb @@ -0,0 +1,47 @@ +=begin +#OpenAPI Petstore + +#This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + +The version of the OpenAPI document: 1.0.0 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 4.1.0-SNAPSHOT + +=end + +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for Petstore::InlineObject +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe 'InlineObject' do + before do + # run before each test + @instance = Petstore::InlineObject.new + end + + after do + # run after each test + end + + describe 'test an instance of InlineObject' do + it 'should create an instance of InlineObject' do + expect(@instance).to be_instance_of(Petstore::InlineObject) + end + end + describe 'test attribute "name"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "status"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + +end diff --git a/samples/server/petstore/php-symfony/SymfonyBundle-php/.gitignore b/samples/server/petstore/php-symfony/SymfonyBundle-php/.gitignore deleted file mode 100644 index 20b7b9897609..000000000000 --- a/samples/server/petstore/php-symfony/SymfonyBundle-php/.gitignore +++ /dev/null @@ -1,54 +0,0 @@ -# ref: https://github.com/github/gitignore/blob/master/Symfony.gitignore - -# Cache and logs (Symfony2) -/app/cache/* -/app/logs/* -!app/cache/.gitkeep -!app/logs/.gitkeep - -# Email spool folder -/app/spool/* - -# Cache, session files and logs (Symfony3) -/var/cache/* -/var/logs/* -/var/sessions/* -!var/cache/.gitkeep -!var/logs/.gitkeep -!var/sessions/.gitkeep - -# Parameters -/app/config/parameters.yml -/app/config/parameters.ini - -# Managed by Composer -/app/bootstrap.php.cache -/var/bootstrap.php.cache -/bin/* -!bin/console -!bin/symfony_requirements -/vendor/ - -# Assets and user uploads -/web/bundles/ -/web/uploads/ - -# PHPUnit -/app/phpunit.xml -/phpunit.xml - -# Build data -/build/ - -# Composer PHAR -/composer.phar - -# Backup entities generated with doctrine:generate:entities command -**/Entity/*~ - -# Embedded web-server pid file -/.web-server-pid - -# From root gitignore -/Tests/cache/ -/Tests/logs/ \ No newline at end of file