Skip to content

Commit 90cdb1b

Browse files
committed
V0.
1 parent c501898 commit 90cdb1b

File tree

3 files changed

+189
-0
lines changed

3 files changed

+189
-0
lines changed

protocol-models/build.gradle

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,15 @@
11
import org.jsonschema2pojo.SourceType
22

33
plugins {
4+
id 'com.google.protobuf' version '0.9.4'
45
id 'com.github.eirnym.js2p' version '1.0'
56
}
67

78
dependencies {
89
implementation 'javax.validation:validation-api:1.1.0.Final'
910
implementation 'org.apache.commons:commons-lang3:3.11'
11+
12+
implementation 'com.google.protobuf:protobuf-java:3.25.1'
1013
}
1114

1215
jsonSchema2Pojo {
@@ -40,3 +43,14 @@ task generateTypescriptProtocolClassFiles(type: Exec) {
4043

4144
commandLine 'bin/generate-typescript-classes-docker.sh'
4245
}
46+
47+
protobuf {
48+
protoc {
49+
artifact = 'com.google.protobuf:protoc:3.25.1' // Use the appropriate version
50+
}
51+
52+
generateProtoTasks {
53+
ofSourceSet('main')*.protoPath = 'src/main/resources/airbyte_protocol_proto/v0'
54+
// ofSourceSet('test')*.protoPath = 'src/test/proto'
55+
}
56+
}
Lines changed: 174 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,174 @@
1+
syntax = "proto3";
2+
3+
package airbyte;
4+
5+
import "google/protobuf/any.proto";
6+
import "google/protobuf/timestamp.proto";
7+
8+
// Enumerations
9+
enum SyncMode {
10+
FULL_REFRESH = 0;
11+
INCREMENTAL = 1;
12+
// ... other sync modes
13+
}
14+
15+
enum DestinationSyncMode {
16+
APPEND = 0;
17+
OVERWRITE = 1;
18+
APPEND_DEDUP = 2;
19+
// ... other destination sync modes
20+
}
21+
22+
enum AirbyteStreamStatus {
23+
ACTIVE = 0;
24+
DEPRECATED = 1;
25+
// ... other stream statuses
26+
}
27+
28+
// Message Definitions
29+
message AirbyteMessage {
30+
oneof message {
31+
AirbyteRecordMessage record = 1;
32+
AirbyteStateMessage state = 2;
33+
AirbyteLogMessage log = 3;
34+
AirbyteTraceMessage trace = 4;
35+
AirbyteControlMessage control = 5;
36+
// ... other message types
37+
}
38+
}
39+
40+
message AirbyteRecordMessage {
41+
string stream = 1;
42+
google.protobuf.Timestamp emitted_at = 2;
43+
google.protobuf.Any data = 3;
44+
// ... other fields as necessary
45+
}
46+
47+
message AirbyteStateMessage {
48+
AirbyteStateBlob data = 1;
49+
// ... other fields as necessary
50+
}
51+
52+
message AirbyteLogMessage {
53+
string level = 1;
54+
string message = 2;
55+
google.protobuf.Timestamp emitted_at = 3;
56+
// ... other fields as necessary
57+
}
58+
59+
message AirbyteTraceMessage {
60+
oneof trace_type {
61+
AirbyteErrorTraceMessage error = 1;
62+
AirbyteEstimateTraceMessage estimate = 2;
63+
AirbyteStreamStatusTraceMessage stream_status = 3;
64+
AirbyteAnalyticsTraceMessage analytics = 4;
65+
// ... other trace types
66+
}
67+
}
68+
69+
// Additional message definitions based on JSON schema
70+
message AirbyteStreamState {
71+
StreamDescriptor stream_descriptor = 1;
72+
AirbyteStateBlob stream_state = 2;
73+
// ... other fields as necessary
74+
}
75+
76+
message AirbyteGlobalState {
77+
AirbyteStateBlob shared_state = 1;
78+
repeated AirbyteStreamState stream_states = 2;
79+
// ... other fields as necessary
80+
}
81+
82+
message StreamDescriptor {
83+
string name = 1;
84+
string namespace = 2;
85+
// ... other fields as necessary
86+
}
87+
88+
message AirbyteStateBlob {
89+
google.protobuf.Any data = 1;
90+
// ... other fields as necessary
91+
}
92+
93+
message AirbyteStateStats {
94+
double recordCount = 1;
95+
// ... other fields as necessary
96+
}
97+
98+
message AirbyteErrorTraceMessage {
99+
string message = 1;
100+
string internal_message = 2;
101+
string stack_trace = 3;
102+
string failure_type = 4;
103+
StreamDescriptor stream_descriptor = 5;
104+
// ... other fields as necessary
105+
}
106+
107+
message AirbyteEstimateTraceMessage {
108+
string name = 1;
109+
string type = 2;
110+
string namespace = 3;
111+
int64 row_estimate = 4;
112+
int64 byte_estimate = 5;
113+
// ... other fields as necessary
114+
}
115+
116+
message AirbyteStreamStatusTraceMessage {
117+
StreamDescriptor stream_descriptor = 1;
118+
AirbyteStreamStatus status = 2;
119+
// ... other fields as necessary
120+
}
121+
122+
message AirbyteAnalyticsTraceMessage {
123+
string type = 1;
124+
string value = 2;
125+
// ... other fields as necessary
126+
}
127+
128+
message AirbyteControlMessage {
129+
string type = 1;
130+
google.protobuf.Timestamp emitted_at = 2;
131+
AirbyteControlConnectorConfigMessage connectorConfig = 3;
132+
// ... other fields as necessary
133+
}
134+
135+
message AirbyteControlConnectorConfigMessage {
136+
map<string, google.protobuf.Any> config = 1;
137+
// ... other fields as necessary
138+
}
139+
140+
message AirbyteConnectionStatus {
141+
string status = 1;
142+
string message = 2;
143+
// ... other fields as necessary
144+
}
145+
146+
message AirbyteCatalog {
147+
repeated AirbyteStream streams = 1;
148+
// ... other fields as necessary
149+
}
150+
151+
message AirbyteStream {
152+
string name = 1;
153+
google.protobuf.Any json_schema = 2;
154+
repeated SyncMode supported_sync_modes = 3;
155+
bool source_defined_cursor = 4;
156+
repeated string default_cursor_field = 5;
157+
repeated string source_defined_primary_key = 6;
158+
string namespace = 7;
159+
// ... other fields as necessary
160+
}
161+
162+
message ConfiguredAirbyteCatalog {
163+
repeated ConfiguredAirbyteStream streams = 1;
164+
// ... other fields as necessary
165+
}
166+
167+
message ConfiguredAirbyteStream {
168+
AirbyteStream stream = 1;
169+
SyncMode sync_mode = 2;
170+
repeated string cursor_field = 3;
171+
DestinationSyncMode destination_sync_mode = 4;
172+
repeated string primary_key = 5;
173+
// ... other fields as necessary
174+
}

protocol-models/src/test/java/io/airbyte/protocol/models/CatalogHelpersTest.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -310,4 +310,5 @@ void testCatalogDiffStreamChangeWithNoFieldTransform() throws IOException {
310310

311311
Assertions.assertThat(actualDiff).containsExactlyInAnyOrderElementsOf(expectedDiff);
312312
}
313+
313314
}

0 commit comments

Comments
 (0)