aboutsummaryrefslogtreecommitdiffstats
path: root/openapi/build.gradle
blob: 505ac7be8b6d9f298479ab6b2e9bc4cc8c77a15b (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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
plugins {
    id 'org.onap.portal.history.java-application-conventions'
    id 'org.openapi.generator'
}

ext {
    openapiVersion = '6.0.1'
}

dependencies {
    implementation "org.openapitools:openapi-generator:$openapiVersion"
    // NOTE(KE) needed to add these dependencies, check in next version whether its removable...
    // https://github.com/OpenAPITools/openapi-generator/issues/8360
    compileOnly "io.springfox:springfox-swagger2:3.0.0"
}

// https://github.com/OpenAPITools/openapi-generator/blob/master/modules/openapi-generator-gradle-plugin/README.adoc
openApiGenerate {
    generatorName = "spring"
    library = "spring-boot"
    inputSpec = "$projectDir/src/main/resources/api/api.yml"
    outputDir = "$buildDir/openapi"
    configOptions = [
            openApiNullable: "false",
            skipDefaultInterface: "true",
            dateLibrary: "java8",
            interfaceOnly: "true",
            useTags: "true",
            useOptional: "true",
            reactive: "true"
    ]
    generateApiTests = false
    generateApiDocumentation = false
    generateModelTests = false
    generateModelDocumentation = false
    invokerPackage = "org.onap.portal.history.openapi"
    apiPackage = "org.onap.portal.history.openapi.api"
    modelPackage = "org.onap.portal.history.openapi.model"
}

compileJava {
    dependsOn tasks.openApiGenerate
}

sourceSets {
    main {
        java {
            srcDirs += file("$buildDir/openapi/src/main/java")
        }
    }
}