aboutsummaryrefslogtreecommitdiffstats
path: root/openapi/build.gradle
blob: ee9ac9653be3deb2362dc81fb7a7dcb0ead9532e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
apply plugin: 'org.openapi.generator'

void createOpenApiGenerateClientTask(Project project, String apiDefinition, String packageName, String dtoSuffix) {
  String taskName = "openApiGenerate_$packageName"
  tasks.create(taskName, org.openapitools.generator.gradle.plugin.tasks.GenerateTask) {
    generatorName = "java"
    library = "webclient"
    inputSpec = "${project.projectDir}/src/$apiDefinition".toString()
    outputDir = "${project.buildDir}/openapi".toString()
    configOptions = [
      openApiNullable     : "false",
      dateLibrary         : "java8",
      serializationLibrary: "jackson"
    ]
    typeMappings = [
            "File": "org.springframework.core.io.buffer.DataBuffer"
    ]
    generateApiTests = false
    generateApiDocumentation = false
    generateModelTests = false
    generateModelDocumentation = false
    invokerPackage = "org.onap.portal.bff.openapi.$packageName"
    apiPackage = "org.onap.portal.bff.openapi.${packageName}.api"
    modelPackage = "org.onap.portal.bff.openapi.${packageName}.model"
    modelNameSuffix = dtoSuffix
  }
}