forked from airbytehq/airbyte-platform
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.gradle
145 lines (117 loc) · 5.9 KB
/
build.gradle
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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
import org.openapitools.generator.gradle.plugin.tasks.GenerateTask
plugins {
id "java-library"
alias(libs.plugins.openapi.generator)
}
def specFile = "$projectDir/src/main/openapi/config.yaml"
tasks.register('generateApiServer', GenerateTask) {
def serverOutputDir = "$buildDir/generated/api/server"
inputs.file specFile
outputs.dir serverOutputDir
generatorName = "jaxrs-spec"
inputSpec = specFile
outputDir = serverOutputDir
apiPackage = "io.airbyte.api.generated"
invokerPackage = "io.airbyte.api.invoker.generated"
modelPackage = "io.airbyte.api.model.generated"
schemaMappings = [
'OAuthConfiguration' : 'com.fasterxml.jackson.databind.JsonNode',
'SourceDefinitionSpecification' : 'com.fasterxml.jackson.databind.JsonNode',
'SourceConfiguration' : 'com.fasterxml.jackson.databind.JsonNode',
'DestinationDefinitionSpecification': 'com.fasterxml.jackson.databind.JsonNode',
'DestinationConfiguration' : 'com.fasterxml.jackson.databind.JsonNode',
'StreamJsonSchema' : 'com.fasterxml.jackson.databind.JsonNode',
'StateBlob' : 'com.fasterxml.jackson.databind.JsonNode',
'FieldSchema' : 'com.fasterxml.jackson.databind.JsonNode',
'DeclarativeManifest' : 'com.fasterxml.jackson.databind.JsonNode',
]
generateApiDocumentation = false
configOptions = [
dateLibrary : "java8",
generatePom : "false",
interfaceOnly: "true",
/*
JAX-RS generator does not respect nullable properties defined in the OpenApi Spec.
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.
The below Jackson annotation is made to only keep non null values in serialized json.
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.
Feel free to read the conversation on https://github.com/airbytehq/airbyte/pull/13370 for more details.
*/
additionalModelTypeAnnotations: "\[email protected](com.fasterxml.jackson.annotation.JsonInclude.Include.NON_NULL)",
// Generate separate classes for each endpoint "domain"
useTags: "true"
]
}
tasks.register('generateApiClient', GenerateTask) {
def clientOutputDir = "$buildDir/generated/api/client"
inputs.file specFile
outputs.dir clientOutputDir
generatorName = "java"
inputSpec = specFile
outputDir = clientOutputDir
apiPackage = "io.airbyte.api.client.generated"
invokerPackage = "io.airbyte.api.client.invoker.generated"
modelPackage = "io.airbyte.api.client.model.generated"
schemaMappings = [
'OAuthConfiguration' : 'com.fasterxml.jackson.databind.JsonNode',
'SourceDefinitionSpecification' : 'com.fasterxml.jackson.databind.JsonNode',
'SourceConfiguration' : 'com.fasterxml.jackson.databind.JsonNode',
'DestinationDefinitionSpecification': 'com.fasterxml.jackson.databind.JsonNode',
'DestinationConfiguration' : 'com.fasterxml.jackson.databind.JsonNode',
'StreamJsonSchema' : 'com.fasterxml.jackson.databind.JsonNode',
'StateBlob' : 'com.fasterxml.jackson.databind.JsonNode',
'FieldSchema' : 'com.fasterxml.jackson.databind.JsonNode',
]
library = "native"
generateApiDocumentation = false
configOptions = [
dateLibrary : "java8",
generatePom : "false",
interfaceOnly: "true"
]
}
tasks.register('generateApiDocs', GenerateTask) {
def docsOutputDir = "$buildDir/generated/api/docs"
generatorName = "html"
inputSpec = specFile
outputDir = docsOutputDir
apiPackage = "io.airbyte.api.client.generated"
invokerPackage = "io.airbyte.api.client.invoker.generated"
modelPackage = "io.airbyte.api.client.model.generated"
schemaMappings = [
'OAuthConfiguration' : 'com.fasterxml.jackson.databind.JsonNode',
'SourceDefinitionSpecification' : 'com.fasterxml.jackson.databind.JsonNode',
'SourceConfiguration' : 'com.fasterxml.jackson.databind.JsonNode',
'DestinationDefinitionSpecification': 'com.fasterxml.jackson.databind.JsonNode',
'DestinationConfiguration' : 'com.fasterxml.jackson.databind.JsonNode',
'StreamJsonSchema' : 'com.fasterxml.jackson.databind.JsonNode',
'StateBlob' : 'com.fasterxml.jackson.databind.JsonNode',
'FieldSchema' : 'com.fasterxml.jackson.databind.JsonNode',
]
generateApiDocumentation = false
configOptions = [
dateLibrary : "java8",
generatePom : "false",
interfaceOnly: "true"
]
}
compileJava.dependsOn tasks.generateApiServer, tasks.generateApiClient, tasks.generateApiDocs
dependencies {
implementation libs.jackson.datatype
implementation libs.swagger.annotations
implementation libs.javax.annotation.api
implementation libs.javax.ws.rs.api
implementation libs.javax.validation.api
implementation libs.openapi.jackson.databind.nullable
}
sourceSets {
main {
java {
srcDirs "$buildDir/generated/api/server/src/gen/java", "$buildDir/generated/api/client/src/main/java", "$projectDir/src/main/java"
}
resources {
srcDir "$projectDir/src/main/openapi/"
}
}
}
Task publishArtifactsTask = getPublishArtifactsTask("$rootProject.ext.version", project)