Skip to content
Permalink
Browse files

[CLI] Initial implementation for batch generation (#3789)

* [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 committed Oct 9, 2019
1 parent 081383c commit 54d7e8c48813b559afb1a08597dd0474fd06be2b
Showing 359 changed files with 3,250 additions and 1,585 deletions.
@@ -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"
}
@@ -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"
}
}
@@ -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
}
}
@@ -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}"
}
}
@@ -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
}
}
@@ -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"
}
}
@@ -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"
}
}
@@ -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"
}
}
@@ -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"
}
}
@@ -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
}
}
@@ -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
}
}
@@ -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
}
}
@@ -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
}
}
@@ -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"
}
}
@@ -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
}
}
@@ -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
}
}
@@ -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"
}
}
@@ -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
}
}
@@ -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"
}
@@ -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"
}
}
@@ -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"
}
}
@@ -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
}
}
@@ -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"
}
}
@@ -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
}
}
@@ -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"
}
}
@@ -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"
}
}
@@ -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"
}
}
@@ -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
}
}
@@ -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
}
}
@@ -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"
}
}
@@ -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
}
}
@@ -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"
}
}

0 comments on commit 54d7e8c

Please sign in to comment.
You can’t perform that action at this time.