mirror of
https://github.com/OpenAPITools/openapi-generator.git
synced 2025-05-28 04:20:51 +00:00
When WorkflowSettings was constructed from an existing instance, as is the case when we deserialize from an external configuration file, it would result in an error: Caused by: java.lang.UnsupportedOperationException at com.google.common.collect.ImmutableMap.put(ImmutableMap.java:450) at org.openapitools.codegen.config.WorkflowSettings$Builder.withSystemProperty(WorkflowSettings.java:465) This was due to an error in `newBuilder(WorkflowSettings copy)` which assigned builder.systemProperties with an immutable map. This is incorrect because everything in the builder should be mutable until .build() is invoked. This likely affects CLI/Maven plugin as well for version 4.1.1 through 4.2.0.
94 lines
2.8 KiB
Groovy
94 lines
2.8 KiB
Groovy
buildscript {
|
|
repositories {
|
|
mavenLocal()
|
|
mavenCentral()
|
|
maven {
|
|
url "https://plugins.gradle.org/m2/"
|
|
}
|
|
maven {
|
|
url "https://oss.sonatype.org/content/repositories/releases/"
|
|
}
|
|
maven {
|
|
url "https://oss.sonatype.org/content/repositories/snapshots/"
|
|
}
|
|
}
|
|
dependencies {
|
|
// Updated version can be passed via command line arg as -PopenApiGeneratorVersion=VERSION
|
|
classpath "org.openapitools:openapi-generator-gradle-plugin:$openApiGeneratorVersion"
|
|
}
|
|
}
|
|
|
|
apply plugin: 'org.openapi.generator'
|
|
|
|
openApiMeta {
|
|
generatorName = "Sample"
|
|
packageName = "org.openapitools.example"
|
|
outputFolder = "$buildDir/meta".toString()
|
|
}
|
|
|
|
openApiValidate {
|
|
inputSpec = "$rootDir/petstore-v3.0-invalid.yaml".toString()
|
|
}
|
|
|
|
// Builds a Kotlin client by default.
|
|
openApiGenerate {
|
|
generatorName = "kotlin"
|
|
inputSpec = "$rootDir/petstore-v3.0.yaml".toString()
|
|
outputDir = "$buildDir/kotlin".toString()
|
|
apiPackage = "org.openapitools.example.api"
|
|
invokerPackage = "org.openapitools.example.invoker"
|
|
modelPackage = "org.openapitools.example.model"
|
|
configOptions = [
|
|
dateLibrary: "java8"
|
|
]
|
|
systemProperties = [
|
|
modelDocs: "false"
|
|
]
|
|
skipValidateSpec = true
|
|
logToStderr = true
|
|
generateAliasAsModel = false
|
|
// set to true and set environment variable {LANG}_POST_PROCESS_FILE
|
|
// (e.g. SCALA_POST_PROCESS_FILE) to the linter/formatter to be processed.
|
|
// This command will be passed one file at a time for most supported post processors.
|
|
enablePostProcessFile = false
|
|
}
|
|
|
|
task buildGoSdk(type: org.openapitools.generator.gradle.plugin.tasks.GenerateTask){
|
|
generatorName = "go"
|
|
inputSpec = "$rootDir/petstore-v3.0.yaml".toString()
|
|
additionalProperties = [
|
|
packageName: "petstore"
|
|
]
|
|
outputDir = "$buildDir/go".toString()
|
|
configOptions = [
|
|
dateLibrary: "threetenp"
|
|
]
|
|
}
|
|
|
|
task buildDotnetSdk(type: org.openapitools.generator.gradle.plugin.tasks.GenerateTask){
|
|
generatorName = "csharp-netcore"
|
|
inputSpec = "$rootDir/petstore-v3.0.yaml".toString()
|
|
additionalProperties = [
|
|
packageGuid: "{321C8C3F-0156-40C1-AE42-D59761FB9B6C}",
|
|
useCompareNetObjects: "true"
|
|
]
|
|
outputDir = "$buildDir/csharp-netcore".toString()
|
|
systemProperties = [
|
|
models: "",
|
|
apis : "",
|
|
]
|
|
}
|
|
|
|
task generateGoWithInvalidSpec(type: org.openapitools.generator.gradle.plugin.tasks.GenerateTask){
|
|
validateSpec = true
|
|
generatorName = "go"
|
|
inputSpec = "$rootDir/petstore-v3.0-invalid.yaml".toString()
|
|
additionalProperties = [
|
|
packageName: "petstore"
|
|
]
|
|
outputDir = "$buildDir/go".toString()
|
|
configOptions = [
|
|
dateLibrary: "threetenp"
|
|
]
|
|
}
|