1
- import org.jetbrains.kotlin.gradle.dsl.JvmTarget
2
- import org.jetbrains.kotlin.gradle.dsl.KotlinVersion
3
- import org.openapitools.generator.gradle.plugin.tasks.GenerateTask
4
-
5
1
plugins {
6
2
id " com.github.eirnym.js2p" version " 1.0"
7
- id " de.undercouch.download" version " 5.4.0"
8
3
id " java-library"
9
- id " org.openapi.generator" version " 6.2.1"
10
4
}
11
5
12
6
java {
@@ -25,127 +19,11 @@ compileKotlin.compilerOptions.allWarningsAsErrors = false
25
19
compileTestFixturesKotlin. compilerOptions. allWarningsAsErrors = false
26
20
compileTestKotlin. compilerOptions. allWarningsAsErrors = false
27
21
28
- String specFile = " $projectDir /src/main/openapi/config.yaml"
29
- String serverOutputDir = " $buildDir /generated/api/server"
30
- String clientOutputDir = " $buildDir /generated/api/client"
31
- String docsOutputDir = " $buildDir /generated/api/docs"
32
- Map<String ,String > schemaMappingsValue = [
33
- ' OAuthConfiguration' : ' com.fasterxml.jackson.databind.JsonNode' ,
34
- ' SourceDefinitionSpecification' : ' com.fasterxml.jackson.databind.JsonNode' ,
35
- ' SourceConfiguration' : ' com.fasterxml.jackson.databind.JsonNode' ,
36
- ' DestinationDefinitionSpecification' : ' com.fasterxml.jackson.databind.JsonNode' ,
37
- ' DestinationConfiguration' : ' com.fasterxml.jackson.databind.JsonNode' ,
38
- ' StreamJsonSchema' : ' com.fasterxml.jackson.databind.JsonNode' ,
39
- ' StateBlob' : ' com.fasterxml.jackson.databind.JsonNode' ,
40
- ' FieldSchema' : ' com.fasterxml.jackson.databind.JsonNode' ,
41
- ]
22
+ spotbugsTest. enabled = false
23
+ spotbugsTestFixtures. enabled = false
42
24
43
25
def generate = tasks. register(' generate' )
44
26
45
- def generateApiServer = tasks. register(' generateApiServer' , GenerateTask ) {
46
-
47
- inputs. file specFile
48
- outputs. dir serverOutputDir
49
-
50
- generatorName = " jaxrs-spec"
51
- inputSpec = specFile
52
- outputDir = serverOutputDir
53
-
54
- apiPackage = " io.airbyte.api.generated"
55
- invokerPackage = " io.airbyte.api.invoker.generated"
56
- modelPackage = " io.airbyte.api.model.generated"
57
-
58
- schemaMappings. set(schemaMappingsValue)
59
-
60
- generateApiDocumentation = false
61
-
62
- configOptions. set([
63
- dateLibrary : " java8" ,
64
- generatePom : " false" ,
65
- interfaceOnly : " true" ,
66
- /*
67
- JAX-RS generator does not respect nullable properties defined in the OpenApi Spec.
68
- It means that if a field is not nullable but not set it is still returning a null value for this field in the serialized json.
69
- The below Jackson annotation is made to only keep non null values in serialized json.
70
- We are not yet using nullable=true properties in our OpenApi so this is a valid workaround at the moment to circumvent the default JAX-RS behavior described above.
71
- Feel free to read the conversation on https://github.com/airbytehq/airbyte/pull/13370 for more details.
72
- */
73
- additionalModelTypeAnnotations : " \n @com.fasterxml.jackson.annotation.JsonInclude(com.fasterxml.jackson.annotation.JsonInclude.Include.NON_NULL)" ,
74
- ])
75
- }
76
- generate. configure {
77
- dependsOn generateApiServer
78
- }
79
-
80
- def generateApiClient = tasks. register(' generateApiClient' , GenerateTask ) {
81
-
82
- inputs. file specFile
83
- outputs. dir clientOutputDir
84
-
85
- generatorName = " java"
86
- inputSpec = specFile
87
- outputDir = clientOutputDir
88
-
89
- apiPackage = " io.airbyte.api.client.generated"
90
- invokerPackage = " io.airbyte.api.client.invoker.generated"
91
- modelPackage = " io.airbyte.api.client.model.generated"
92
-
93
- schemaMappings. set(schemaMappingsValue)
94
-
95
- library = " native"
96
-
97
- generateApiDocumentation = false
98
-
99
- configOptions. set([
100
- dateLibrary : " java8" ,
101
- generatePom : " false" ,
102
- interfaceOnly : " true"
103
- ])
104
- }
105
- generate. configure {
106
- dependsOn generateApiClient
107
- }
108
-
109
- def generateApiDocs = tasks. register(' generateApiDocs' , GenerateTask ) {
110
-
111
- generatorName = " html"
112
- inputSpec = specFile
113
- outputDir = docsOutputDir
114
-
115
- apiPackage = " io.airbyte.api.client.generated"
116
- invokerPackage = " io.airbyte.api.client.invoker.generated"
117
- modelPackage = " io.airbyte.api.client.model.generated"
118
-
119
- schemaMappings. set(schemaMappingsValue)
120
-
121
- generateApiDocumentation = false
122
-
123
- configOptions. set([
124
- dateLibrary : " java8" ,
125
- generatePom : " false" ,
126
- interfaceOnly : " true"
127
- ])
128
- }
129
- def deleteExistingDocs = tasks. register(' deleteOldApiDocs' , Delete ) {
130
- delete rootProject. file(" docs/reference/api/generated-api-html" )
131
- }
132
- deleteExistingDocs. configure {
133
- dependsOn generateApiDocs
134
- }
135
- def copyApiDocs = tasks. register(' copyApiDocs' , Copy ) {
136
- from(docsOutputDir) {
137
- include " **/*.html"
138
- }
139
- into rootProject. file(" docs/reference/api/generated-api-html" )
140
- includeEmptyDirs = false
141
- }
142
- copyApiDocs. configure {
143
- dependsOn deleteExistingDocs
144
- }
145
- generate. configure {
146
- dependsOn copyApiDocs
147
- }
148
-
149
27
dependencies {
150
28
api platform(' com.fasterxml.jackson:jackson-bom:2.15.2' )
151
29
api ' com.fasterxml.jackson.core:jackson-annotations'
@@ -178,6 +56,7 @@ dependencies {
178
56
179
57
testFixturesApi testFixtures(project(' :airbyte-cdk:java:airbyte-cdk:core' ))
180
58
59
+ testFixturesImplementation (' io.airbyte:airbyte-api:0.55.2' ) { transitive = false }
181
60
testFixturesImplementation ' io.swagger:swagger-annotations:1.6.2'
182
61
testFixturesImplementation ' org.apache.ant:ant:1.10.11'
183
62
@@ -206,29 +85,6 @@ generate.configure {
206
85
dependsOn tasks. named(' generateJsonSchema2Pojo' )
207
86
}
208
87
209
-
210
- sourceSets {
211
- main {
212
- java {
213
- srcDirs([
214
- " $projectDir /src/main/java" ,
215
- " ${ serverOutputDir} /src/gen/java" ,
216
- " ${ clientOutputDir} /src/main/java" ,
217
- ])
218
- }
219
- kotlin {
220
- srcDirs([
221
- " $projectDir /src/main/kotlin" ,
222
- " ${ serverOutputDir} /src/gen/kotlin" ,
223
- " ${ clientOutputDir} /src/main/kotlin" ,
224
- ])
225
- }
226
- resources {
227
- srcDir " $projectDir /src/main/openapi/"
228
- }
229
- }
230
- }
231
-
232
88
tasks. named(' compileJava' ). configure {
233
89
dependsOn generate
234
90
}
0 commit comments