summaryrefslogtreecommitdiffstats
path: root/openapi/build.gradle
blob: fc5e1dc7d563fa1d095167e1e734fcc469a67272 (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
54
55
56
57
58
59
plugins {
    id 'java'
    id 'idea'
    id 'org.openapi.generator'
}

repositories {
	mavenCentral()
}

dependencies {
	implementation 'org.openapitools:openapi-generator:7.0.0-beta'
	implementation 'org.springframework.boot:spring-boot-starter-webflux:3.1.2'
    implementation 'jakarta.validation:jakarta.validation-api:3.0.2'

    constraints {
        implementation('io.swagger.core.v3:swagger-annotations:2.2.5') {
            because 'there is a dependency conflict between swagger-parser versions 2 and 3 (https://github.com/OpenAPITools/openapi-generator/issues/14901)'
        }
    }
}

// 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 = [
        hideGenerationTimestamp: "true",
		openApiNullable: "false",
		skipDefaultInterface: "true",
		dateLibrary: "java8",
		interfaceOnly: "true",
		useTags: "true",
		useOptional: "true",
		reactive: "true",
        useSpringBoot3: "true"
    ]
    generateApiTests = false
    generateApiDocumentation = false
    generateModelTests = false
    generateModelDocumentation = false
    invokerPackage = "org.onap.portalng.preferences.openapi"
    apiPackage = "org.onap.portalng.preferences.openapi.api"
    modelPackage = "org.onap.portalng.preferences.openapi.model"
}

compileJava {
    dependsOn tasks.openApiGenerate
}

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