OpenAPI Generator allows generation of API client libraries (SDK generation), server stubs, documentation and configuration automatically given an OpenAPI Spec (v2, v3)
[main] INFO o.o.codegen.cmd.GenerateBatch - Batch generation using up to 16 threads.
Includes: /Users/fred/openapi-generator-cli/flat
Root: /Users/fred/openapi-generator-cli/flat
[pool-1-thread-1] Generation failed: (NullPointerException) language/generatorName must be specified
java.lang.NullPointerException: language/generatorName must be specified
at org.apache.commons.lang3.Validate.notEmpty(Validate.java:395)
at org.openapitools.codegen.config.CodegenConfigurator.toContext(CodegenConfigurator.java:423)
at org.openapitools.codegen.config.CodegenConfigurator.toClientOptInput(CodegenConfigurator.java:507)
at org.openapitools.codegen.cmd.GenerateBatch$GenerationRunner.run(GenerateBatch.java:189)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)
COMPLETE.
mbp-fred:flat fred$
# java-jersey2.yaml
#### REMOVED NESTED INCLUDE
library: jersey2
# test-config.yaml
#### MOVED IT HERE
'!include': 'java-common.yaml'
'!include': 'java-jersey2.yaml'
inputSpec: petstore-v3.0.yaml
outputDir: generated/test
java -jar openapi-generator-cli-4.3.1.jar batch --verbose test_config.yaml
[main] INFO o.o.codegen.cmd.GenerateBatch - Batch generation using up to 16 threads.
Includes: /Users/fred/openapi-generator-cli/flat
Root: /Users/fred/openapi-generator-cli/flat
[pool-1-thread-1] Generation failed: (NullPointerException) **language/generatorName must be specified**
java.lang.NullPointerException: language/generatorName must be specified
at org.apache.commons.lang3.Validate.notEmpty(Validate.java:395)
at org.openapitools.codegen.config.CodegenConfigurator.toContext(CodegenConfigurator.java:423)
at org.openapitools.codegen.config.CodegenConfigurator.toClientOptInput(CodegenConfigurator.java:507)
at org.openapitools.codegen.cmd.GenerateBatch$GenerationRunner.run(GenerateBatch.java:189)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)
COMPLETE.
mbp-fred fred$
REVERSAL OF INCLUDEs WORKS?
If you reverse the two includes in test-config.yaml, the generation seems to work, but the settings in the first included file are ignored.
The generation succeeds, but note that the date library is threetenp, and the http/json libraries are the default instead of those specified in java-jersey2.yaml:
dependencies {
compile "io.swagger:swagger-annotations:$swagger_annotations_version"
compile "com.google.code.findbugs:jsr305:3.0.2"
compile "org.glassfish.jersey.core:jersey-client:$jersey_version"
compile "org.glassfish.jersey.media:jersey-media-multipart:$jersey_version"
compile "org.glassfish.jersey.media:jersey-media-json-jackson:$jersey_version"
compile "com.fasterxml.jackson.core:jackson-core:$jackson_version"
compile "com.fasterxml.jackson.core:jackson-annotations:$jackson_version"
compile "com.fasterxml.jackson.core:jackson-databind:$jackson_databind_version"
compile "org.openapitools:jackson-databind-nullable:$jackson_databind_nullable_version"
compile "com.github.joschi.jackson:jackson-datatype-threetenbp:$threetenbp_version"
compile "com.brsanthu:migbase64:2.2"
testCompile "junit:junit:$junit_version"
}
``
##### Steps to reproduce
* Create the yaml files, above.
* run the given java command.
##### Related issues/PRs
I didn't find any.
##### Suggest a fix
I think the code in [GenerateBatch.java](https://github.com/OpenAPITools/openapi-generator/blob/master/modules/openapi-generator-cli/src/main/java/org/openapitools/codegen/cmd/GenerateBatch.java), class DynamicSettingsRefSupport, method deserialize doesn't support multiple includes as it uses the TreeNode.get(String) method that can only return a single node.
Also, the code that reads in the included file does not then parse the included data for nested '!include' tokens.
Bug Report Checklist
Description
openapi-generator-cli BATCH mode does not recognize multiple or nested '!include' directives.
openapi-generator version
4.3.1
OpenAPI declaration file content or url
InputSpec is your petstore-v3.0.yaml
Generation Details
NESTED FAILURE EXAMPLE
Command line: java -jar openapi-generator-cli-4.3.1.jar batch --verbose test_config.yaml
output:
SEQUENTIAL FAILURE EXAMPLE
Command line: java -jar openapi-generator-cli-4.3.1.jar batch --verbose test_config.yaml
REVERSAL OF INCLUDEs WORKS?
If you reverse the two includes in test-config.yaml, the generation seems to work, but the settings in the first included file are ignored.
The generation succeeds, but note that the date library is threetenp, and the http/json libraries are the default instead of those specified in java-jersey2.yaml:
ACTUAL RESULTS WITHOUT INCLUDES
java -jar openapi-generator-cli-4.3.1.jar batch --verbose test_all_config.yaml