forked from loafle/openapi-generator-original
* [gradle] Add 4 boolean properties supported by codegenConfigurator * [gradle] Add Windows workaround for Android Studio After release 3.0.0, a guava dependency was updated and this exposed an issue in Windows where Guava's CharMatcher.ASCII is called to validate a path. The version of Guava referenced by OpenAPI Generator causes a 'NoSuchField' error because the referenced dependency names this static field CharMatcher.Ascii. This error is not surfaced on macOS, and appears to be Windows-specific. This adds a potential workaround to the Gradle plugin's readme. See #1818 for more details.
80 lines
2.4 KiB
Groovy
80 lines
2.4 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 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"
|
|
]
|
|
}
|