Skip to content

Commit 60456ea

Browse files
author
Marius Posta
authored
java-cdk: remove airbyte-api generation, pull dependency instead (#36610)
See #36322 (comment)
1 parent 76e1057 commit 60456ea

File tree

5 files changed

+2
-480
lines changed

5 files changed

+2
-480
lines changed

airbyte-cdk/java/airbyte-cdk/db-sources/build.gradle

+1
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ dependencies {
5252
testFixturesImplementation project(':airbyte-cdk:java:airbyte-cdk:core')
5353
testFixturesApi testFixtures(project(':airbyte-cdk:java:airbyte-cdk:core'))
5454

55+
testFixturesImplementation ('io.airbyte:airbyte-api:0.55.2') { transitive = false }
5556
testFixturesImplementation 'net.sourceforge.argparse4j:argparse4j:0.9.0'
5657
testFixturesImplementation 'io.swagger:swagger-annotations:1.6.13'
5758
testFixturesImplementation 'org.hamcrest:hamcrest-all:1.3'

airbyte-cdk/java/airbyte-cdk/dependencies/build.gradle

+1-148
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,6 @@
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-
51
plugins {
62
id "com.github.eirnym.js2p" version "1.0"
7-
id "de.undercouch.download" version "5.4.0"
83
id "java-library"
9-
id "org.openapi.generator" version "6.2.1"
104
}
115

126
java {
@@ -28,127 +22,8 @@ compileTestKotlin.compilerOptions.allWarningsAsErrors = false
2822
spotbugsTest.enabled = false
2923
spotbugsTestFixtures.enabled = false
3024

31-
String specFile = "$projectDir/src/main/openapi/config.yaml"
32-
String serverOutputDir = "$buildDir/generated/api/server"
33-
String clientOutputDir = "$buildDir/generated/api/client"
34-
String docsOutputDir = "$buildDir/generated/api/docs"
35-
Map<String,String> schemaMappingsValue = [
36-
'OAuthConfiguration' : 'com.fasterxml.jackson.databind.JsonNode',
37-
'SourceDefinitionSpecification' : 'com.fasterxml.jackson.databind.JsonNode',
38-
'SourceConfiguration' : 'com.fasterxml.jackson.databind.JsonNode',
39-
'DestinationDefinitionSpecification': 'com.fasterxml.jackson.databind.JsonNode',
40-
'DestinationConfiguration' : 'com.fasterxml.jackson.databind.JsonNode',
41-
'StreamJsonSchema' : 'com.fasterxml.jackson.databind.JsonNode',
42-
'StateBlob' : 'com.fasterxml.jackson.databind.JsonNode',
43-
'FieldSchema' : 'com.fasterxml.jackson.databind.JsonNode',
44-
]
45-
4625
def generate = tasks.register('generate')
4726

48-
def generateApiServer = tasks.register('generateApiServer', GenerateTask) {
49-
50-
inputs.file specFile
51-
outputs.dir serverOutputDir
52-
53-
generatorName = "jaxrs-spec"
54-
inputSpec = specFile
55-
outputDir = serverOutputDir
56-
57-
apiPackage = "io.airbyte.api.generated"
58-
invokerPackage = "io.airbyte.api.invoker.generated"
59-
modelPackage = "io.airbyte.api.model.generated"
60-
61-
schemaMappings.set(schemaMappingsValue)
62-
63-
generateApiDocumentation = false
64-
65-
configOptions.set([
66-
dateLibrary : "java8",
67-
generatePom : "false",
68-
interfaceOnly: "true",
69-
/*
70-
JAX-RS generator does not respect nullable properties defined in the OpenApi Spec.
71-
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.
72-
The below Jackson annotation is made to only keep non null values in serialized json.
73-
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.
74-
Feel free to read the conversation on https://github.com/airbytehq/airbyte/pull/13370 for more details.
75-
*/
76-
additionalModelTypeAnnotations: "\n@com.fasterxml.jackson.annotation.JsonInclude(com.fasterxml.jackson.annotation.JsonInclude.Include.NON_NULL)",
77-
])
78-
}
79-
generate.configure {
80-
dependsOn generateApiServer
81-
}
82-
83-
def generateApiClient = tasks.register('generateApiClient', GenerateTask) {
84-
85-
inputs.file specFile
86-
outputs.dir clientOutputDir
87-
88-
generatorName = "java"
89-
inputSpec = specFile
90-
outputDir = clientOutputDir
91-
92-
apiPackage = "io.airbyte.api.client.generated"
93-
invokerPackage = "io.airbyte.api.client.invoker.generated"
94-
modelPackage = "io.airbyte.api.client.model.generated"
95-
96-
schemaMappings.set(schemaMappingsValue)
97-
98-
library = "native"
99-
100-
generateApiDocumentation = false
101-
102-
configOptions.set([
103-
dateLibrary : "java8",
104-
generatePom : "false",
105-
interfaceOnly: "true"
106-
])
107-
}
108-
generate.configure {
109-
dependsOn generateApiClient
110-
}
111-
112-
def generateApiDocs = tasks.register('generateApiDocs', GenerateTask) {
113-
114-
generatorName = "html"
115-
inputSpec = specFile
116-
outputDir = docsOutputDir
117-
118-
apiPackage = "io.airbyte.api.client.generated"
119-
invokerPackage = "io.airbyte.api.client.invoker.generated"
120-
modelPackage = "io.airbyte.api.client.model.generated"
121-
122-
schemaMappings.set(schemaMappingsValue)
123-
124-
generateApiDocumentation = false
125-
126-
configOptions.set([
127-
dateLibrary : "java8",
128-
generatePom : "false",
129-
interfaceOnly: "true"
130-
])
131-
}
132-
def deleteExistingDocs = tasks.register('deleteOldApiDocs', Delete) {
133-
delete rootProject.file("docs/reference/api/generated-api-html")
134-
}
135-
deleteExistingDocs.configure {
136-
dependsOn generateApiDocs
137-
}
138-
def copyApiDocs = tasks.register('copyApiDocs', Copy) {
139-
from(docsOutputDir) {
140-
include "**/*.html"
141-
}
142-
into rootProject.file("docs/reference/api/generated-api-html")
143-
includeEmptyDirs = false
144-
}
145-
copyApiDocs.configure {
146-
dependsOn deleteExistingDocs
147-
}
148-
generate.configure {
149-
dependsOn copyApiDocs
150-
}
151-
15227
dependencies {
15328
api platform('com.fasterxml.jackson:jackson-bom:2.15.2')
15429
api 'com.fasterxml.jackson.core:jackson-annotations'
@@ -181,6 +56,7 @@ dependencies {
18156

18257
testFixturesApi testFixtures(project(':airbyte-cdk:java:airbyte-cdk:core'))
18358

59+
testFixturesImplementation ('io.airbyte:airbyte-api:0.55.2') { transitive = false }
18460
testFixturesImplementation 'io.swagger:swagger-annotations:1.6.2'
18561
testFixturesImplementation 'org.apache.ant:ant:1.10.11'
18662

@@ -209,29 +85,6 @@ generate.configure {
20985
dependsOn tasks.named('generateJsonSchema2Pojo')
21086
}
21187

212-
213-
sourceSets {
214-
main {
215-
java {
216-
srcDirs([
217-
"$projectDir/src/main/java",
218-
"${serverOutputDir}/src/gen/java",
219-
"${clientOutputDir}/src/main/java",
220-
])
221-
}
222-
kotlin {
223-
srcDirs([
224-
"$projectDir/src/main/kotlin",
225-
"${serverOutputDir}/src/gen/kotlin",
226-
"${clientOutputDir}/src/main/kotlin",
227-
])
228-
}
229-
resources {
230-
srcDir "$projectDir/src/main/openapi/"
231-
}
232-
}
233-
}
234-
23588
tasks.named('compileJava').configure {
23689
dependsOn generate
23790
}

airbyte-cdk/java/airbyte-cdk/dependencies/src/main/kotlin/io/airbyte/api/client/AirbyteApiClient.kt

-124
This file was deleted.

0 commit comments

Comments
 (0)