diff --git a/.gitignore b/.gitignore index fd191d36195..55ef266102f 100644 --- a/.gitignore +++ b/.gitignore @@ -93,21 +93,6 @@ samples/client/petstore/java/jersey2-java6/project/ samples/client/petstore/java/jersey2-java8/project/ samples/client/petstore/java/jersey2/project/ -#PHP -samples/client/petstore/php/OpenAPIToolsClient-php/composer.lock -samples/client/petstore/php/OpenAPIToolsClient-php/vendor/ -samples/client/petstore/silex/SwaggerServer/composer.lock -samples/client/petstore/silex/SwaggerServer/venodr/ -**/vendor/ -**/composer.lock - -#PHP-Symfony -samples/server/petstore/php-symfony/SymfonyBundle-php/Tests/cache/ -samples/server/petstore/php-symfony/SymfonyBundle-php/Tests/logs/ - -#PHP-laravel -samples/server/petstore/php-laravel/node_modules - # Perl samples/client/petstore/perl/deep_module_test/ diff --git a/.hub.cli.dockerfile b/.hub.cli.dockerfile new file mode 100644 index 00000000000..a3686f52ee3 --- /dev/null +++ b/.hub.cli.dockerfile @@ -0,0 +1,36 @@ +## The builder labeled image acts as a transient container which is meant to +## hold all non-artifact code. +## +## You can build _just_ this part with: +## docker --target builder -t container-name:builder -f .hub.cli.dockerfile . +FROM jimschubert/8-jdk-alpine-mvn:1.0 as builder + +RUN set -x && \ + apk add --no-cache bash + +ENV GEN_DIR /opt/openapi-generator +WORKDIR ${GEN_DIR} +COPY . ${GEN_DIR} + +# Pre-compile openapi-generator-cli +RUN mvn -am -pl "modules/openapi-generator-cli" package + +## The final (release) image +## The resulting container here only needs the target jar +## and ca-certificates (to be able to query HTTPS hosted specs) +FROM openjdk:8-jre-alpine + +ENV GEN_DIR /opt/openapi-generator + +RUN apk --no-cache add ca-certificates bash +RUN mkdir -p ${GEN_DIR}/modules/openapi-generator-cli/target + +WORKDIR ${GEN_DIR}/modules/openapi-generator-cli/target + +COPY --from=builder ${GEN_DIR}/modules/openapi-generator-cli/target/openapi-generator-cli.jar ${GEN_DIR}/modules/openapi-generator-cli/target/openapi-generator-cli.jar + +COPY docker-entrypoint.sh /usr/local/bin/ + +ENTRYPOINT ["docker-entrypoint.sh"] + +CMD ["help"] diff --git a/.hub.online.dockerfile b/.hub.online.dockerfile new file mode 100644 index 00000000000..96eda34d32b --- /dev/null +++ b/.hub.online.dockerfile @@ -0,0 +1,35 @@ +## The builder labeled image acts as a transient container which is meant to +## hold all non-artifact code. +## +## You can build _just_ this part with: +## docker --target builder -t container-name:builder -f .hub.online.dockerfile . +FROM jimschubert/8-jdk-alpine-mvn:1.0 as builder + +RUN set -x && \ + apk add --no-cache bash + +ENV GEN_DIR /opt/openapi-generator +WORKDIR ${GEN_DIR} +COPY . ${GEN_DIR} + +# Pre-compile openapi-generator-online +RUN mvn -am -pl "modules/openapi-generator-online" package + +## The final (release) image +## The resulting container here only needs the target jar +FROM openjdk:8-jre-alpine + +ENV GEN_DIR /opt/openapi-generator +ENV TARGET_DIR /generator + +RUN mkdir -p ${TARGET_DIR} + +WORKDIR ${TARGET_DIR} + +COPY --from=builder ${GEN_DIR}/modules/openapi-generator-online/target/openapi-generator-*.jar ${TARGET_DIR}/openapi-generator-online.jar + +ENV GENERATOR_HOST=http://localhost + +EXPOSE 8080 + +CMD ["java", "-jar", "/generator/openapi-generator-online.jar"] diff --git a/.travis.yml b/.travis.yml index 159d08b7a1c..9d83b1a1bb4 100644 --- a/.travis.yml +++ b/.travis.yml @@ -31,6 +31,8 @@ cache: - $HOME/.cargo - $HOME/.stack - $HOME/samples/server/petstore/cpp-pistache/pistache + - $HOME/.npm + - $HOME/.rvm/gems/ruby-2.4.1 services: - docker @@ -57,7 +59,7 @@ before_install: - gem install bundler - npm install -g typescript - npm install -g npm - - npm install -g elm + - npm install -g elm@0.18.0-exp5 - npm config set registry http://registry.npmjs.org/ # set python 3.6.3 as default - source ~/virtualenv/python3.6/bin/activate diff --git a/CI/samples.ci/client/petstore/java/test-manual/jersey1/ApiClientTest.java b/CI/samples.ci/client/petstore/java/test-manual/jersey1/ApiClientTest.java index a890ead935f..405267d4131 100644 --- a/CI/samples.ci/client/petstore/java/test-manual/jersey1/ApiClientTest.java +++ b/CI/samples.ci/client/petstore/java/test-manual/jersey1/ApiClientTest.java @@ -28,7 +28,7 @@ public class ApiClientTest { assertEquals(dateStr, apiClient.formatDate(apiClient.parseDate("2015-11-07T02:49:09.356-01:00"))); // custom date format: without milli-seconds, custom time zone - DateFormat format = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssXXX"); + DateFormat format = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssXXX", Locale.ROOT); format.setTimeZone(TimeZone.getTimeZone("GMT+10")); apiClient.setDateFormat(format); dateStr = "2015-11-07T13:49:09+10:00"; diff --git a/CI/samples.ci/client/petstore/java/test-manual/jersey2/ApiClientTest.java b/CI/samples.ci/client/petstore/java/test-manual/jersey2/ApiClientTest.java index 6fb1e54b679..09659fb4700 100644 --- a/CI/samples.ci/client/petstore/java/test-manual/jersey2/ApiClientTest.java +++ b/CI/samples.ci/client/petstore/java/test-manual/jersey2/ApiClientTest.java @@ -28,7 +28,7 @@ public class ApiClientTest { assertEquals(dateStr, apiClient.formatDate(apiClient.parseDate("2015-11-07T02:49:09.356-01:00"))); // custom date format: without milli-seconds, custom time zone - DateFormat format = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssXXX"); + DateFormat format = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssXXX", Locale.ROOT); format.setTimeZone(TimeZone.getTimeZone("GMT+10")); apiClient.setDateFormat(format); dateStr = "2015-11-07T13:49:09+10:00"; diff --git a/CI/samples.ci/client/petstore/java/test-manual/okhttp-gson/JSONTest.java b/CI/samples.ci/client/petstore/java/test-manual/okhttp-gson/JSONTest.java index e7687d0b33b..1c825e39256 100644 --- a/CI/samples.ci/client/petstore/java/test-manual/okhttp-gson/JSONTest.java +++ b/CI/samples.ci/client/petstore/java/test-manual/okhttp-gson/JSONTest.java @@ -12,6 +12,7 @@ import java.text.SimpleDateFormat; import java.util.Calendar; import java.util.Date; import java.util.GregorianCalendar; +import java.util.Locale; import java.util.TimeZone; import okio.ByteString; @@ -46,7 +47,7 @@ public class JSONTest { assertEquals(json.deserialize("\"2015-11-07T03:49:09.356" + getCurrentTimezoneOffset() + "\"", java.sql.Date.class).toString(), date.toString()); // custom date format: without day - DateFormat format = new SimpleDateFormat("yyyy-MM"); + DateFormat format = new SimpleDateFormat("yyyy-MM", Locale.ROOT); apiClient.setSqlDateFormat(format); String dateStr = "\"2015-11\""; assertEquals(dateStr, json.serialize(json.deserialize("\"2015-11-07T03:49:09Z\"", java.sql.Date.class))); @@ -79,7 +80,7 @@ public class JSONTest { assertEquals(utcDate, json.serialize(date)); // custom datetime format: without milli-seconds, custom time zone - DateFormat format = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssXXX"); + DateFormat format = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssXXX", Locale.ROOT); format.setTimeZone(TimeZone.getTimeZone("GMT+10")); apiClient.setDateFormat(format); @@ -190,10 +191,10 @@ public class JSONTest { public static String getCurrentTimezoneOffset() { TimeZone tz = TimeZone.getDefault(); - Calendar cal = GregorianCalendar.getInstance(tz); + Calendar cal = GregorianCalendar.getInstance(tz, Locale.ROOT); int offsetInMillis = tz.getOffset(cal.getTimeInMillis()); - String offset = String.format("%02d:%02d", Math.abs(offsetInMillis / 3600000), Math.abs((offsetInMillis / 60000) % 60)); + String offset = String.format(Locale.ROOT,"%02d:%02d", Math.abs(offsetInMillis / 3600000), Math.abs((offsetInMillis / 60000) % 60)); offset = (offsetInMillis >= 0 ? "+" : "-") + offset; return offset; diff --git a/CI/samples.ci/client/petstore/java/test-manual/resttemplate/ApiClientTest.java b/CI/samples.ci/client/petstore/java/test-manual/resttemplate/ApiClientTest.java index 2113f5d2453..a6bedae3e95 100644 --- a/CI/samples.ci/client/petstore/java/test-manual/resttemplate/ApiClientTest.java +++ b/CI/samples.ci/client/petstore/java/test-manual/resttemplate/ApiClientTest.java @@ -34,7 +34,7 @@ public class ApiClientTest { assertEquals(dateStr, apiClient.formatDate(apiClient.parseDate("2015-11-07T02:49:09.356-01:00"))); // custom date format: without milli-seconds, custom time zone - DateFormat format = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssXXX"); + DateFormat format = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssXXX", Locale.ROOT); format.setTimeZone(TimeZone.getTimeZone("GMT+10")); apiClient.setDateFormat(format); dateStr = "2015-11-07T13:49:09+10:00"; diff --git a/README.md b/README.md index 45f98af8552..ee102011cb2 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@
-[Master](https://github.com/OpenAPITools/openapi-generator/tree/master) (`3.2.2`): [![Build Status](https://img.shields.io/travis/OpenAPITools/openapi-generator/master.svg?label=Integration%20Test)](https://travis-ci.org/OpenAPITools/openapi-generator) +[Master](https://github.com/OpenAPITools/openapi-generator/tree/master) (`3.2.3`): [![Build Status](https://img.shields.io/travis/OpenAPITools/openapi-generator/master.svg?label=Integration%20Test)](https://travis-ci.org/OpenAPITools/openapi-generator) [![Integration Test2](https://circleci.com/gh/OpenAPITools/openapi-generator.svg?style=shield)](https://circleci.com/gh/OpenAPITools/openapi-generator) [![Run Status](https://api.shippable.com/projects/5af6bf74e790f4070084a115/badge?branch=master)](https://app.shippable.com/github/OpenAPITools/openapi-generator) [![Windows Test](https://ci.appveyor.com/api/projects/status/github/openapitools/openapi-generator?branch=master&svg=true&passingText=Windows%20Test%20-%20OK&failingText=Windows%20Test%20-%20Fails)](https://ci.appveyor.com/project/WilliamCheng/openapi-generator-wh2wu) @@ -84,8 +84,8 @@ OpenAPI Generator Version | Release Date | Notes ---------------------------- | ------------ | ----- 4.0.0 (upcoming major release) [SNAPSHOT](https://oss.sonatype.org/content/repositories/snapshots/org/openapitools/openapi-generator-cli/4.0.0-SNAPSHOT/)| TBD | Major release with breaking changes (no fallback) 3.3.0 (upcoming minor release)| TBD | Minor release (breaking changes with fallbacks) -3.2.2 (current master, upcoming patch release) [SNAPSHOT](https://oss.sonatype.org/content/repositories/snapshots/org/openapitools/openapi-generator-cli/3.2.2-SNAPSHOT/)| TBD | Bugfix release -[3.2.1](https://github.com/OpenAPITools/openapi-generator/releases/tag/v3.2.1) (latest stable release) | 14.08.2018 | Bugfix release +3.2.3 (current master, upcoming patch release) [SNAPSHOT](https://oss.sonatype.org/content/repositories/snapshots/org/openapitools/openapi-generator-cli/3.2.3-SNAPSHOT/)| TBD | Bugfix release +[3.2.2](https://github.com/OpenAPITools/openapi-generator/releases/tag/v3.2.2) (latest stable release) | 22.08.2018 | Bugfix release OpenAPI Spec compatibility: 1.0, 1.1, 1.2, 2.0, 3.0 @@ -141,16 +141,16 @@ See the different versions of the [openapi-generator-cli](https://mvnrepository. If you're looking for the latest stable version, you can grab it directly from Maven.org (Java 8 runtime at a minimum): -JAR location: `http://central.maven.org/maven2/org/openapitools/openapi-generator-cli/3.2.1/openapi-generator-cli-3.2.1.jar` +JAR location: `http://central.maven.org/maven2/org/openapitools/openapi-generator-cli/3.2.2/openapi-generator-cli-3.2.2.jar` For **Mac/Linux** users: ```sh -wget http://central.maven.org/maven2/org/openapitools/openapi-generator-cli/3.2.1/openapi-generator-cli-3.2.1.jar -O openapi-generator-cli.jar +wget http://central.maven.org/maven2/org/openapitools/openapi-generator-cli/3.2.2/openapi-generator-cli-3.2.2.jar -O openapi-generator-cli.jar ``` For **Windows** users, you will need to install [wget](http://gnuwin32.sourceforge.net/packages/wget.htm) or you can use Invoke-WebRequest in PowerShell (3.0+), e.g. ``` -Invoke-WebRequest -OutFile openapi-generator-cli.jar http://central.maven.org/maven2/org/openapitools/openapi-generator-cli/3.2.1/openapi-generator-cli-3.2.1.jar +Invoke-WebRequest -OutFile openapi-generator-cli.jar http://central.maven.org/maven2/org/openapitools/openapi-generator-cli/3.2.2/openapi-generator-cli-3.2.2.jar ``` After downloading the JAR, run `java -jar openapi-generator-cli.jar help` to show the usage. @@ -163,7 +163,7 @@ export PATH=${JAVA_HOME}/bin:$PATH ### Launcher Script -One downside to manual jar downloads is that you don't keep up-to-date with the latest released version. We have a Bash launcher script at [bin/utils/openapi-generator.cli.sh](./bin/utils/openapi-generator.cli.sh) which resolves this issue. +One downside to manual jar downloads is that you don't keep up-to-date with the latest released version. We have a Bash launcher script at [bin/utils/openapi-generator.cli.sh](./bin/utils/openapi-generator-cli.sh) which resolves this issue. To install the launcher script, copy the contents of the script to a location on your path and make the script executable. @@ -406,13 +406,14 @@ SYNOPSIS [--invoker-package ] [(-l | --lang )] [--language-specific-primitives ...] - [--library ] [--model-name-prefix ] + [--library ] [--log-to-stderr] + [--model-name-prefix ] [--model-name-suffix ] [--model-package ] [(-o | --output )] [--release-note ] [--remove-operation-id-prefix] [--reserved-words-mappings ...] - [(-s | --skip-overwrite)] + [(-s | --skip-overwrite)] [--skip-validate-spec] [(-t