Skip to content

Commit 93a1fdd

Browse files
authored
Add json schemas to source (#41)
1 parent 922acfc commit 93a1fdd

19 files changed

+233
-61
lines changed

dataline-config-persistence/src/main/java/io/dataline/config/persistence/ConfigPersistenceImpl.java

Lines changed: 18 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -114,24 +114,32 @@ private String getFilename(String id) {
114114
private ConfigSchema standardConfigTypeToConfigSchema(
115115
PersistenceConfigType persistenceConfigType) {
116116
switch (persistenceConfigType) {
117-
case SOURCE_CONNECTION_CONFIGURATION:
118-
return ConfigSchema.SOURCE_CONNECTION_CONFIGURATION;
117+
case STANDARD_WORKSPACE:
118+
return ConfigSchema.STANDARD_WORKSPACE;
119+
case STANDARD_SOURCE:
120+
return ConfigSchema.STANDARD_SOURCE;
121+
case SOURCE_CONNECTION_SPECIFICATION:
122+
return ConfigSchema.SOURCE_CONNECTION_SPECIFICATION;
123+
case SOURCE_CONNECTION_IMPLEMENTATION:
124+
return ConfigSchema.SOURCE_CONNECTION_IMPLEMENTATION;
125+
case STANDARD_DESTINATION:
126+
return ConfigSchema.STANDARD_DESTINATION;
127+
case DESTINATION_CONNECTION_SPECIFICATION:
128+
return ConfigSchema.DESTINATION_CONNECTION_SPECIFICATION;
129+
case DESTINATION_CONNECTION_IMPLEMENTATION:
130+
return ConfigSchema.DESTINATION_CONNECTION_IMPLEMENTATION;
119131
case STANDARD_CONNECTION_STATUS:
120132
return ConfigSchema.STANDARD_CONNECTION_STATUS;
121133
case STANDARD_DISCOVERY_OUTPUT:
122134
return ConfigSchema.STANDARD_DISCOVERY_OUTPUT;
123-
case DESTINATION_CONNECTION_CONFIGURATION:
124-
return ConfigSchema.DESTINATION_CONNECTION_CONFIGURATION;
125-
case STANDARD_SYNC_CONFIGURATION:
126-
return ConfigSchema.STANDARD_SYNC_CONFIGURATION;
135+
case STANDARD_SYNC:
136+
return ConfigSchema.STANDARD_SYNC;
127137
case STANDARD_SYNC_SUMMARY:
128138
return ConfigSchema.STANDARD_SYNC_SUMMARY;
129-
case STANDARD_SYNC_STATE:
130-
return ConfigSchema.STANDARD_SYNC_STATE;
131-
case STATE:
132-
return ConfigSchema.STATE;
133139
case STANDARD_SYNC_SCHEDULE:
134140
return ConfigSchema.STANDARD_SYNC_SCHEDULE;
141+
case STATE:
142+
return ConfigSchema.STATE;
135143
default:
136144
throw new RuntimeException(
137145
String.format(
Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,28 @@
11
package io.dataline.config.persistence;
22

33
public enum PersistenceConfigType {
4-
SOURCE_CONNECTION_CONFIGURATION,
4+
// workspace
5+
STANDARD_WORKSPACE,
6+
7+
// source
8+
STANDARD_SOURCE,
9+
SOURCE_CONNECTION_SPECIFICATION,
10+
SOURCE_CONNECTION_IMPLEMENTATION,
11+
12+
// destination
13+
STANDARD_DESTINATION,
14+
DESTINATION_CONNECTION_SPECIFICATION,
15+
DESTINATION_CONNECTION_IMPLEMENTATION,
16+
17+
// test connection
518
STANDARD_CONNECTION_STATUS,
19+
20+
// discover schema
621
STANDARD_DISCOVERY_OUTPUT,
7-
DESTINATION_CONNECTION_CONFIGURATION,
8-
STANDARD_SYNC_CONFIGURATION,
22+
23+
// sync
24+
STANDARD_SYNC,
925
STANDARD_SYNC_SUMMARY,
10-
STANDARD_SYNC_STATE,
26+
STANDARD_SYNC_SCHEDULE,
1127
STATE,
12-
STANDARD_SYNC_SCHEDULE
1328
}

dataline-config/src/main/java/io/dataline/config/ConfigSchema.java

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,28 @@
11
package io.dataline.config;
22

33
public enum ConfigSchema {
4-
SOURCE_CONNECTION_CONFIGURATION("SourceConnectionConfiguration.json"),
4+
// workspace
5+
STANDARD_WORKSPACE("StandardWorkspace.json"),
6+
7+
// source
8+
STANDARD_SOURCE("StandardSource.json"),
9+
SOURCE_CONNECTION_SPECIFICATION("SourceConnectionSpecification.json"),
10+
SOURCE_CONNECTION_IMPLEMENTATION("SourceConnectionImplementation.json"),
11+
12+
// destination
13+
STANDARD_DESTINATION("StandardDestination.json"),
14+
DESTINATION_CONNECTION_SPECIFICATION("DestinationConnectionSpecification.json"),
15+
DESTINATION_CONNECTION_IMPLEMENTATION("DestinationConnectionImplementation.json"),
16+
17+
// test connection
518
STANDARD_CONNECTION_STATUS("StandardConnectionStatus.json"),
19+
20+
// discover schema
621
STANDARD_DISCOVERY_OUTPUT("StandardDiscoveryOutput.json"),
7-
DESTINATION_CONNECTION_CONFIGURATION("DestinationConnectionConfiguration.json"),
8-
STANDARD_SYNC_CONFIGURATION("StandardSyncConfiguration.json"),
22+
23+
// sync
24+
STANDARD_SYNC("StandardSync.json"),
925
STANDARD_SYNC_SUMMARY("StandardSyncSummary.json"),
10-
STANDARD_SYNC_STATE("StandardSyncState.json"),
1126
STANDARD_SYNC_SCHEDULE("StandardSyncSchedule.json"),
1227
STATE("State.json");
1328

dataline-config/src/main/resources/json/DestinationConnectionConfiguration.json

Lines changed: 0 additions & 17 deletions
This file was deleted.
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
{
2+
"$schema": "http://json-schema.org/draft-07/schema#",
3+
"$id": "https://github.com/datalineio/dataline/blob/master/dataline-config/src/main/resources/json/DestinationConnectionImplementation.json",
4+
"title": "DestinationConnectionImplementation",
5+
"description": "information required for connection to a destination.",
6+
"type": "object",
7+
"required": ["destinationSpecificationId", "destinationImplementationId", "configuration"],
8+
"additionalProperties": false,
9+
"properties": {
10+
"destinationSpecificationId": {
11+
"type": "string",
12+
"format": "uuid"
13+
},
14+
"destinationImplementationId": {
15+
"type": "string",
16+
"format": "uuid"
17+
},
18+
"configuration": {
19+
"description": "type any. information here varies by integration. this data is validated against a specification"
20+
}
21+
}
22+
}
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
{
2+
"$schema": "http://json-schema.org/draft-07/schema#",
3+
"$id": "https://github.com/datalineio/dataline/blob/master/dataline-config/src/main/resources/json/DestinationSpecification.json",
4+
"title": "DestinationConnectionSpecification",
5+
"description": "specification for how to configure a connection to a destination",
6+
"type": "object",
7+
"required": ["destinationId", "destinationSpecificationId", "specification"],
8+
"additionalProperties": false,
9+
"properties": {
10+
"destinationId": {
11+
"type": "string",
12+
"format": "uuid"
13+
},
14+
"destinationSpecificationId": {
15+
"type": "string",
16+
"format": "uuid"
17+
},
18+
"specification": {
19+
"description": "type any. information here varies by integration"
20+
}
21+
}
22+
}

dataline-config/src/main/resources/json/SourceConnectionConfiguration.json

Lines changed: 0 additions & 16 deletions
This file was deleted.
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
{
2+
"$schema": "http://json-schema.org/draft-07/schema#",
3+
"$id": "https://github.com/datalineio/dataline/blob/master/dataline-config/src/main/resources/json/SourceConnectionConfiguration.json",
4+
"title": "SourceConnectionConfiguration",
5+
"description": "information required for connection to a destination.", "type": "object",
6+
"required": ["sourceSpecificationId", "sourceImplementationId", "configuration"],
7+
"additionalProperties": false,
8+
"properties": {
9+
"sourceSpecificationId": {
10+
"type": "string",
11+
"format": "uuid"
12+
},
13+
"sourceImplementationId": {
14+
"type": "string",
15+
"format": "uuid"
16+
},
17+
"configuration": {
18+
"description": "type any. information here varies by integration. this data is validated against a specification"
19+
}
20+
}
21+
}
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
{
2+
"$schema": "http://json-schema.org/draft-07/schema#",
3+
"$id": "https://github.com/datalineio/dataline/blob/master/dataline-config/src/main/resources/json/SourceSpecification.json",
4+
"title": "SourceConnectionSpecification",
5+
"description": "specification for how to configure a connection to a source",
6+
"type": "object",
7+
"required": ["sourceId", "sourceSpecificationId", "specification"],
8+
"additionalProperties": false,
9+
"properties": {
10+
"sourceId": {
11+
"type": "string",
12+
"format": "uuid"
13+
},
14+
"sourceSpecificationId": {
15+
"type": "string",
16+
"format": "uuid"
17+
},
18+
"specification": {
19+
"description": "type any. information here varies by integration"
20+
}
21+
}
22+
}

dataline-config/src/main/resources/json/StandardConnectionStatus.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"$schema": "http://json-schema.org/draft-07/schema#",
3-
"$id": "StandardConnectionStatus",
3+
"$id": "https://github.com/datalineio/dataline/blob/master/dataline-config/src/main/resources/json/StandardConnectionStatus.json",
44
"title": "StandardConnectionStatus",
55
"description": "describes the result of a 'test connection' action.",
66
"type": "object",

dataline-config/src/main/resources/json/StandardDataSchema.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"$schema": "http://json-schema.org/draft-07/schema#",
3-
"$id": "StandardDataSchema",
3+
"$id": "https://github.com/datalineio/dataline/blob/master/dataline-config/src/main/resources/json/StandardDataSchema.json",
44
"title": "StandardDataSchema",
55
"type": "object",
66
"definitions": {
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
{
2+
"$schema": "http://json-schema.org/draft-07/schema#",
3+
"$id": "https://github.com/datalineio/dataline/blob/master/dataline-config/src/main/resources/json/Destination.json",
4+
"title": "Source",
5+
"description": "describes a destination",
6+
"type": "object",
7+
"required": [
8+
"destinationId",
9+
"name"
10+
],
11+
"additionalProperties": false,
12+
"properties": {
13+
"destinationId": {
14+
"type": "string",
15+
"format": "uuid"
16+
},
17+
"name": {
18+
"type": "string"
19+
}
20+
}
21+
}

dataline-config/src/main/resources/json/StandardDiscoveryOutput.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"$schema": "http://json-schema.org/draft-07/schema#",
3-
"$id": "StandardDiscoveryOutput",
3+
"$id": "https://github.com/datalineio/dataline/blob/master/dataline-config/src/main/resources/json/StandardDiscoveryOutput.json",
44
"title": "StandardDiscoveryOutput",
55
"description": "describes the standard output for any discovery run.",
66
"type": "object",
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
{
2+
"$schema": "http://json-schema.org/draft-07/schema#",
3+
"$id": "https://github.com/datalineio/dataline/blob/master/dataline-config/src/main/resources/json/Source.json",
4+
"title": "Source",
5+
"description": "describes a source",
6+
"type": "object",
7+
"required": [
8+
"sourceId",
9+
"name"
10+
],
11+
"additionalProperties": false,
12+
"properties": {
13+
"sourceId": {
14+
"type": "string",
15+
"format": "uuid"
16+
},
17+
"name": {
18+
"type": "string"
19+
}
20+
}
21+
}

dataline-config/src/main/resources/json/StandardSyncConfiguration.json renamed to dataline-config/src/main/resources/json/StandardSync.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"$schema": "http://json-schema.org/draft-07/schema#",
3-
"$id": "StandardSyncConfiguration",
4-
"title": "StandardSyncConfiguration",
3+
"$id": "https://github.com/datalineio/dataline/blob/master/dataline-config/src/main/resources/json/StandardSyncConfiguration.json",
4+
"title": "StandardSync",
55
"description": "configuration required for sync for ALL taps",
66
"type": "object",
77
"required": ["syncMode", "schema"],

dataline-config/src/main/resources/json/StandardSyncSchedule.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"$schema": "http://json-schema.org/draft-07/schema#",
3-
"$id": "https://dataline.io/docs/models/StandardScheduleConfiguration.json",
3+
"$id": "https://github.com/datalineio/dataline/blob/master/dataline-config/src/main/resources/json/StandardScheduleConfiguration.json",
44
"title": "StandardScheduleConfiguration",
55
"type": "object",
66
"required": ["timeUnit", "units"],

dataline-config/src/main/resources/json/StandardSyncSummary.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"$schema": "http://json-schema.org/draft-07/schema#",
3-
"$id": "StandardSyncSummary",
3+
"$id": "https://github.com/datalineio/dataline/blob/master/dataline-config/src/main/resources/json/StandardSyncSummary.json",
44
"title": "StandardSyncSummary",
55
"description": "standard information output by ALL taps for a sync step (our version of state.json)",
66
"type": "object",
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
{
2+
"$schema": "http://json-schema.org/draft-07/schema#",
3+
"$id": "https://github.com/datalineio/dataline/blob/master/dataline-config/src/main/resources/json/StandardWorkspaceConfiguration.json",
4+
"title": "StandardWorkspace",
5+
"description": "workspace configuration",
6+
"type": "object",
7+
"required": ["workspaceId", "name", "slug", "initialSetupComplete"],
8+
"additionalProperties": false,
9+
"properties": {
10+
"workspaceId": {
11+
"type": "string",
12+
"format": "uuid"
13+
},
14+
"name": {
15+
"type": "string"
16+
},
17+
"slug": {
18+
"type": "string"
19+
},
20+
"email": {
21+
"type": "string",
22+
"format": "email"
23+
},
24+
"initialSetupComplete": {
25+
"type": "boolean"
26+
},
27+
"anonymousDataCollection": {
28+
"type": "boolean"
29+
},
30+
"news": {
31+
"type": "boolean"
32+
},
33+
"securityUpdates": {
34+
"type": "boolean"
35+
}
36+
}
37+
}

dataline-config/src/main/resources/json/State.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"$schema": "http://json-schema.org/draft-07/schema#",
3-
"$id": "DestinationConnectionConfiguration",
4-
"title": "DestinationConnectionConfiguration",
3+
"$id": "https://github.com/datalineio/dataline/blob/master/dataline-config/src/main/resources/json/State.json",
4+
"title": "State",
55
"description": "information output by the connection.",
66
"type": "object",
77
"required": ["connectionId", "state"],
@@ -12,6 +12,7 @@
1212
"format": "uuid"
1313
},
1414
"state": {
15+
"description": "type any. information here varies by integration"
1516
}
1617
}
1718
}

0 commit comments

Comments
 (0)