Skip to content

Commit

Permalink
[CLI] Initial implementation for batch generation (#3789)
Browse files Browse the repository at this point in the history
* [CLI] Initial implementation for batch generation

Allows for generating multiple outputs via config. Just specify multiple
config files on command line.

Intent for this is to reduce CI times to generate outputs as well as to
reduce time for users to run ensure-up-to-date to meet PR standards.

Example command:

  openapi-generator batch --includes-base-dir `pwd` --fail-fast  -- bin/ci/*

---

As part of this implementation, the batch command support a customized
JSON key, `!include`. If this key's value refers to an existing file,
that file's contents are "unwrapped" into the config during
deserialization. This allows us to easily point to the same configs used
by our sample scripts without modifying the CLI generate task's switches
or assumptions.

* Allow for path-relative outputs
* Add batch JSON objects
* Include INFO log about threads used and includes/root
* Ensure GlobalSettings.reset()
* Improved thread-safety of ModelUtils
  • Loading branch information
jimschubert authored Oct 9, 2019
1 parent 081383c commit 54d7e8c
Show file tree
Hide file tree
Showing 359 changed files with 3,250 additions and 1,585 deletions.
6 changes: 6 additions & 0 deletions bin/ci/apex-petstore.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"generatorName": "apex",
"inputSpec": "modules/openapi-generator/src/test/resources/2_0/petstore.yaml",
"outputDir": "samples/client/petstore/apex",
"templateDir": "modules/openapi-generator/src/main/resources/apex"
}
11 changes: 11 additions & 0 deletions bin/ci/csharp-netcore-petstore-1.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"generatorName": "csharp-netcore",
"inputSpec": "modules/openapi-generator/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml",
"outputDir": "samples/client/petstore/csharp-netcore/OpenAPIClientCore",
"templateDir": "modules/openapi-generator/src/main/resources/csharp-netcore/",
"additionalProperties": {
"packageGuid": "{321C8C3F-0156-40C1-AE42-D59761FB9B6C}",
"useCompareNetObjects": true,
"targetFramework": "netcoreapp2.0"
}
}
10 changes: 10 additions & 0 deletions bin/ci/csharp-netcore-petstore.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"generatorName": "csharp-netcore",
"inputSpec": "modules/openapi-generator/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml",
"outputDir": "samples/client/petstore/csharp-netcore/OpenAPIClient",
"templateDir": "modules/openapi-generator/src/main/resources/csharp-netcore/",
"additionalProperties": {
"packageGuid": "{321C8C3F-0156-40C1-AE42-D59761FB9B6C}",
"useCompareNetObjects": true
}
}
8 changes: 8 additions & 0 deletions bin/ci/csharp-petstore.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"generatorName": "csharp",
"inputSpec": "modules/openapi-generator/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml",
"outputDir": "samples/client/petstore/csharp/OpenAPIClient",
"additionalProperties": {
"packageGuid": "{321C8C3F-0156-40C1-AE42-D59761FB9B6C}"
}
}
11 changes: 11 additions & 0 deletions bin/ci/dart-flutter-petstore.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"generatorName": "dart",
"inputSpec": "modules/openapi-generator/src/test/resources/2_0/petstore.yaml",
"outputDir": "samples/client/petstore/dart/flutter_petstore/openapi",
"templateDir": "modules/openapi-generator/src/main/resources/dart",
"additionalProperties": {
"hideGenerationTimestamp": true,
"browserClient": false,
"supportDart2": false
}
}
10 changes: 10 additions & 0 deletions bin/ci/dart-jaguar-petstore-1.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"generatorName": "dart-jaguar",
"inputSpec": "modules/openapi-generator/src/test/resources/2_0/petstore.yaml",
"outputDir": "samples/client/petstore/dart-jaguar/flutter_petstore/openapi",
"templateDir": "modules/openapi-generator/src/main/resources/dart-jaguar",
"additionalProperties": {
"hideGenerationTimestamp": true,
"pubName": "openapi"
}
}
11 changes: 11 additions & 0 deletions bin/ci/dart-jaguar-petstore-2.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"generatorName": "dart-jaguar",
"inputSpec": "modules/openapi-generator/src/test/resources/2_0/petstore-proto.yaml",
"outputDir": "samples/client/petstore/dart-jaguar/flutter_proto_petstore/openapi",
"templateDir": "modules/openapi-generator/src/main/resources/dart-jaguar",
"additionalProperties": {
"serialization": "proto",
"hideGenerationTimestamp": true,
"pubName": "openapi"
}
}
11 changes: 11 additions & 0 deletions bin/ci/dart-jaguar-petstore-3.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"generatorName": "dart-jaguar",
"inputSpec": "modules/openapi-generator/src/test/resources/2_0/petstore-proto.yaml",
"outputDir": "samples/client/petstore/dart-jaguar/openapi_proto",
"templateDir": "modules/openapi-generator/src/main/resources/dart-jaguar",
"additionalProperties": {
"serialization": "proto",
"hideGenerationTimestamp": true,
"pubName": "openapi"
}
}
10 changes: 10 additions & 0 deletions bin/ci/dart-jaguar-petstore.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"generatorName": "dart-jaguar",
"inputSpec": "modules/openapi-generator/src/test/resources/2_0/petstore.yaml",
"outputDir": "samples/client/petstore/dart-jaguar/openapi",
"templateDir": "modules/openapi-generator/src/main/resources/dart-jaguar",
"additionalProperties": {
"hideGenerationTimestamp": true,
"pubName": "openapi"
}
}
11 changes: 11 additions & 0 deletions bin/ci/dart-petstore-flutter.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"generatorName": "dart",
"inputSpec": "modules/openapi-generator/src/test/resources/2_0/petstore.yaml",
"outputDir": "samples/client/petstore/dart/flutter_petstore/openapi",
"templateDir": "modules/openapi-generator/src/main/resources/dart",
"additionalProperties": {
"hideGenerationTimestamp": true,
"browserClient": false,
"supportDart2": false
}
}
11 changes: 11 additions & 0 deletions bin/ci/dart-petstore-openapi-browser-client.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"generatorName": "dart",
"inputSpec": "modules/openapi-generator/src/test/resources/2_0/petstore.yaml",
"outputDir": "samples/client/petstore/dart/openapi-browser-client",
"templateDir": "modules/openapi-generator/src/main/resources/dart",
"additionalProperties": {
"hideGenerationTimestamp": true,
"browserClient": true,
"supportDart2": false
}
}
11 changes: 11 additions & 0 deletions bin/ci/dart-petstore.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"generatorName": "dart",
"inputSpec": "modules/openapi-generator/src/test/resources/2_0/petstore.yaml",
"outputDir": "samples/client/petstore/dart/openapi",
"templateDir": "modules/openapi-generator/src/main/resources/dart",
"additionalProperties": {
"hideGenerationTimestamp": true,
"browserClient": false,
"supportDart2": false
}
}
9 changes: 9 additions & 0 deletions bin/ci/dart2-petstore.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"generatorName": "dart",
"inputSpec": "modules/openapi-generator/src/test/resources/2_0/petstore.yaml",
"outputDir": "samples/client/petstore/dart2/openapi",
"templateDir": "modules/openapi-generator/src/main/resources/dart2",
"additionalProperties": {
"hideGenerationTimestamp": true
}
}
9 changes: 9 additions & 0 deletions bin/ci/elixir-petstore.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"generatorName": "elixir",
"inputSpec": "modules/openapi-generator/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml",
"outputDir": "samples/client/petstore/elixir/",
"templateDir": "modules/openapi-generator/src/main/resources/elixir",
"additionalProperties": {
"invokerPackage": "OpenapiPetstore"
}
}
10 changes: 10 additions & 0 deletions bin/ci/go-gin-petstore-server.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"generatorName": "go-gin-server",
"inputSpec": "modules/openapi-generator/src/test/resources/2_0/petstore.yaml",
"outputDir": "samples/server/petstore/go-gin-api-server",
"templateDir": "modules/openapi-generator/src/main/resources/go-gin-server",
"additionalProperties": {
"packageName": "petstoreserver",
"hideGenerationTimestamp": true
}
}
11 changes: 11 additions & 0 deletions bin/ci/go-petstore-withxml.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"generatorName": "go",
"inputSpec": "modules/openapi-generator/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml",
"outputDir": "samples/client/petstore/go/go-petstore-withXml",
"templateDir": "modules/openapi-generator/src/main/resources/go",
"additionalProperties": {
"packageName": "petstore",
"withXml": true,
"withGoCodegenComment": true
}
}
9 changes: 9 additions & 0 deletions bin/ci/go-petstore.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"generatorName": "go",
"inputSpec": "modules/openapi-generator/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml",
"outputDir": "samples/client/petstore/go/go-petstore",
"templateDir": "modules/openapi-generator/src/main/resources/go",
"additionalProperties": {
"packageName": "petstore"
}
}
9 changes: 9 additions & 0 deletions bin/ci/groovy-petstore.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"generatorName": "groovy",
"inputSpec": "modules/openapi-generator/src/test/resources/2_0/petstore.yaml",
"outputDir": "samples/client/petstore/groovy",
"templateDir": "modules/openapi-generator/src/main/resources/Groovy/",
"additionalProperties": {
"hideGenerationTimestamp": true
}
}
6 changes: 6 additions & 0 deletions bin/ci/haskell-http-client-petstore.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"generatorName": "haskell-http-client",
"inputSpec": "modules/openapi-generator/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml",
"outputDir": "samples/client/petstore/haskell-http-client",
"templateDir": "modules/openapi-generator/src/main/resources/haskell-http-client"
}
11 changes: 11 additions & 0 deletions bin/ci/java-feign.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"!include": "bin/java-petstore-feign-9x.json",
"generatorName": "java",
"inputSpec": "modules/openapi-generator/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml",
"outputDir": "samples/client/petstore/java/feign",
"templateDir": "modules/openapi-generator/src/main/resources/Java/libraries/feign",
"additionalProperties": {
"hideGenerationTimestamp": true,
"booleanGetterPrefix": "is"
}
}
11 changes: 11 additions & 0 deletions bin/ci/java-feign10x.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"!include": "bin/java-petstore-feign-10x.json",
"generatorName": "java",
"inputSpec": "modules/openapi-generator/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml",
"outputDir": "samples/client/petstore/java/feign10x",
"templateDir": "modules/openapi-generator/src/main/resources/Java/libraries/feign",
"additionalProperties": {
"hideGenerationTimestamp": true,
"booleanGetterPrefix": "is"
}
}
10 changes: 10 additions & 0 deletions bin/ci/java-google-api-client.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"!include": "bin/java-petstore-google-api-client.json",
"generatorName": "java",
"inputSpec": "modules/openapi-generator/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml",
"outputDir": "samples/client/petstore/java/google-api-client",
"templateDir": "modules/openapi-generator/src/main/resources/Java/libraries/google-api-client",
"additionalProperties": {
"hideGenerationTimestamp": true
}
}
12 changes: 12 additions & 0 deletions bin/ci/java-jaxrs-cxf-annotated-base-path.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"artifactId": "cxf-annotated-basepath",
"generatorName": "jaxrs-cxf",
"inputSpec": "modules/openapi-generator/src/test/resources/2_0/petstore.yaml",
"outputDir": "samples/server/petstore/jaxrs-cxf-annotated-base-path",
"templateDir": "modules/openapi-generator/src/main/resources/JavaJaxRS/cxf",
"additionalProperties": {
"hideGenerationTimestamp": true,
"useAnnotatedBasePath": true,
"serverPort": "8082"
}
}
9 changes: 9 additions & 0 deletions bin/ci/java-jaxrs-cxf-cdi.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"generatorName": "jaxrs-cxf-cdi",
"inputSpec": "modules/openapi-generator/src/test/resources/2_0/petstore.yaml",
"outputDir": "samples/server/petstore/jaxrs-cxf-cdi",
"templateDir": "modules/openapi-generator/src/main/resources/JavaJaxRS/cxf-cdi",
"additionalProperties": {
"hideGenerationTimestamp": true
}
}
12 changes: 12 additions & 0 deletions bin/ci/java-jaxrs-cxf-non-spring-app.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"artifactId": "cxf-server-non-spring",
"generatorName": "jaxrs-cxf",
"inputSpec": "modules/openapi-generator/src/test/resources/2_0/petstore.yaml",
"outputDir": "samples/server/petstore/jaxrs-cxf-non-spring-app",
"templateDir": "modules/openapi-generator/src/main/resources/JavaJaxRS/cxf",
"additionalProperties": {
"hideGenerationTimestamp": true,
"generateNonSpringApplication": true,
"serverPort": "8082"
}
}
10 changes: 10 additions & 0 deletions bin/ci/java-jaxrs-cxf.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"generatorName": "jaxrs-cxf",
"inputSpec": "modules/openapi-generator/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml",
"outputDir": "samples/server/petstore/jaxrs-cxf",
"templateDir": "modules/openapi-generator/src/main/resources/JavaJaxRS/cxf",
"additionalProperties": {
"hideGenerationTimestamp": true,
"serverPort": "8082"
}
}
11 changes: 11 additions & 0 deletions bin/ci/java-jaxrs-datelib-j8.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"!include": "./bin/jaxrs-datelib-j8.json",
"generatorName": "jaxrs-jersey",
"inputSpec": "modules/openapi-generator/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml",
"outputDir": "samples/server/petstore/jaxrs-datelib-j8/",
"templateDir": "modules/openapi-generator/src/main/resources/JavaJaxRS/",
"additionalProperties": {
"hideGenerationTimestamp": true,
"serverPort": "8082"
}
}
10 changes: 10 additions & 0 deletions bin/ci/java-jaxrs-jersey.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"artifactId": "openapiv3-jaxrs-jersey-petstore-server",
"generatorName": "jaxrs-jersey",
"inputSpec": "modules/openapi-generator/src/test/resources/3_0/petstore-with-fake-endpoints-models-for-testing.yaml",
"outputDir": "samples/server/petstore/jaxrs-jersey",
"templateDir": "modules/openapi-generator/src/main/resources/JavaJaxRS/",
"additionalProperties": {
"hideGenerationTimestamp": true
}
}
13 changes: 13 additions & 0 deletions bin/ci/java-jaxrs-jersey1-useTags.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"artifactId": "jaxrs-jersey1-useTags",
"generatorName": "jaxrs-jersey",
"inputSpec": "modules/openapi-generator/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml",
"library": "jersey1",
"outputDir": "samples/server/petstore/jaxrs/jersey1-useTags",
"templateDir": "modules/openapi-generator/src/main/resources/JavaJaxRS",
"additionalProperties": {
"hideGenerationTimestamp": true,
"serverPort": "8082",
"useTags": true
}
}
12 changes: 12 additions & 0 deletions bin/ci/java-jaxrs-jersey1.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"artifactId": "jaxrs-jersey1-server",
"generatorName": "jaxrs-jersey",
"inputSpec": "modules/openapi-generator/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml",
"library": "jersey1",
"outputDir": "samples/server/petstore/jaxrs/jersey1",
"templateDir": "modules/openapi-generator/src/main/resources/JavaJaxRS",
"additionalProperties": {
"hideGenerationTimestamp": true,
"serverPort": "8082"
}
}
12 changes: 12 additions & 0 deletions bin/ci/java-jaxrs-jersey2-useTags.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"artifactId": "jaxrs-jersey2-useTags",
"generatorName": "jaxrs-jersey",
"inputSpec": "modules/openapi-generator/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml",
"outputDir": "samples/server/petstore/jaxrs/jersey2-useTags",
"templateDir": "modules/openapi-generator/src/main/resources/JavaJaxRS",
"additionalProperties": {
"hideGenerationTimestamp": true,
"serverPort": "8082",
"useTags": true
}
}
11 changes: 11 additions & 0 deletions bin/ci/java-jaxrs-jersey2.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"artifactId": "jaxrs-jersey-petstore-server",
"generatorName": "jaxrs-jersey",
"inputSpec": "modules/openapi-generator/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml",
"outputDir": "samples/server/petstore/jaxrs/jersey2",
"templateDir": "modules/openapi-generator/src/main/resources/JavaJaxRS",
"additionalProperties": {
"hideGenerationTimestamp": true,
"serverPort": "8082"
}
}
Loading

0 comments on commit 54d7e8c

Please sign in to comment.