forked from loafle/openapi-generator-original
* [breaking] Enforce vendor extension naming convention * [breaking] Rename system properties to global properties * [docs] Update site with global properties list and usage explanation * Use proper vendor extension casing in all templates * Set remaining vendor extensions to convention of lower kebab-cased with x- prefix * [samples] Regenerate * Update modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/RustServerCodegen.java Before we were adding hasPathParams twice, once with !op.pathParams.isEmpty(), and then again with hasPathParams. This was probably caused by a mistaken merge. This is causing the difference in samples Co-authored-by: Richard Whitehouse <richard.whitehouse@metaswitch.com> * [Samples] Regenerated! * Fix -D conversion to additional-properties, missed in bat files * JERSEY2 option changed * [samples] Regenerate * [scala][finch] Fix remaining vendor extensions format to conventino * [scala] The -D option was replaced with --global-property * [samples] Regenerate * Fix -DskipFormModel usage which has been moved to --global-property skipFormModel=true * [samples] Regenerate Co-authored-by: Richard Whitehouse <richard.whitehouse@metaswitch.com>
105 lines
3.2 KiB
Groovy
105 lines
3.2 KiB
Groovy
buildscript {
|
|
repositories {
|
|
mavenLocal()
|
|
maven { url "https://repo1.maven.org/maven2" }
|
|
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()
|
|
recommend = true
|
|
}
|
|
|
|
// 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"
|
|
]
|
|
globalProperties = [
|
|
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()
|
|
globalProperties = [
|
|
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"
|
|
]
|
|
}
|
|
|
|
task validateGoodSpec(type: org.openapitools.generator.gradle.plugin.tasks.ValidateTask){
|
|
inputSpec = "$rootDir/petstore-v3.0.yaml".toString()
|
|
}
|
|
|
|
task validateBadSpec(type: org.openapitools.generator.gradle.plugin.tasks.ValidateTask){
|
|
inputSpec = "$rootDir/petstore-v3.0-invalid.yaml".toString()
|
|
}
|
|
|
|
task validateSpecs(dependsOn: ['validateGoodSpec', 'validateBadSpec'])
|