-
Notifications
You must be signed in to change notification settings - Fork 4.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add java codegen from json schema (#16)
- Loading branch information
Showing
8 changed files
with
198 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
group 'io.dataline.conduit' | ||
version '0.1.0' | ||
|
||
// todo: make sure we use the non-deprecated version of this. | ||
// https://github.com/joelittlejohn/jsonschema2pojo/tree/master/jsonschema2pojo-gradle-plugin | ||
apply plugin: 'jsonschema2pojo' | ||
|
||
|
||
buildscript { | ||
repositories { | ||
mavenCentral() | ||
} | ||
|
||
dependencies { | ||
classpath 'org.jsonschema2pojo:jsonschema2pojo-gradle-plugin:1.0.2' | ||
} | ||
} | ||
|
||
|
||
repositories { | ||
mavenCentral() | ||
} | ||
|
||
dependencies { | ||
testCompile group: 'junit', name: 'junit', version: '4.12' | ||
|
||
// Required if generating JSR-303 annotations | ||
compile 'javax.validation:validation-api:1.1.0.CR2' | ||
// Required if generating Jackson 2 annotations | ||
compile 'com.fasterxml.jackson.core:jackson-databind:2.9.7' | ||
} | ||
|
||
jsonSchema2Pojo { | ||
} |
17 changes: 17 additions & 0 deletions
17
conduit-config/src/main/resources/json/StandardConnectionStatus.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
{ | ||
"$schema": "http://json-schema.org/draft-07/schema#", | ||
"$id": "StandardConnectionStatus", | ||
"title": "StandardConnectionStatus", | ||
"description": "describes the result of a 'test connection' action.", | ||
"type": "object", | ||
"required": ["status"], | ||
"properties": { | ||
"status": { | ||
"type": "string", | ||
"enum": ["success", "failure"] | ||
}, | ||
"message": { | ||
"type": "string" | ||
} | ||
} | ||
} |
52 changes: 52 additions & 0 deletions
52
conduit-config/src/main/resources/json/StandardDataSchema.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
{ | ||
"$schema": "http://json-schema.org/draft-07/schema#", | ||
"$id": "StandardDataSchema", | ||
"title": "StandardDataSchema", | ||
"type": "object", | ||
"definitions": { | ||
"schema": { | ||
"description": "describes the available schema.", | ||
"type": "object", | ||
"properties": { | ||
"tables": { | ||
"type": "array", | ||
"items": { | ||
"type": "object", | ||
"required": [ | ||
"name", | ||
"columns" | ||
], | ||
"properties": { | ||
"name": { | ||
"type": "string" | ||
}, | ||
"columns": { | ||
"type": "array", | ||
"items": { | ||
"type": "object", | ||
"required": [ | ||
"name", | ||
"dataType" | ||
], | ||
"properties": { | ||
"name": { | ||
"type": "string" | ||
}, | ||
"dataType": { | ||
"type": "string", | ||
"enum": [ | ||
"string", | ||
"number", | ||
"boolean" | ||
] | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} |
14 changes: 14 additions & 0 deletions
14
conduit-config/src/main/resources/json/StandardDiscoveryOutput.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
{ | ||
"$schema": "http://json-schema.org/draft-07/schema#", | ||
"$id": "StandardDiscoveryOutput", | ||
"title": "StandardDiscoveryOutput", | ||
"description": "describes the standard output for any discovery run.", | ||
"type": "object", | ||
"required": ["schema"], | ||
"properties": { | ||
"schema": { | ||
"description": "describes the available schema.", | ||
"$ref": "StandardDataSchema.json#/definitions/schema" | ||
} | ||
} | ||
} |
15 changes: 15 additions & 0 deletions
15
conduit-config/src/main/resources/json/StandardScheduleConfiguration.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
{ | ||
"$schema": "http://json-schema.org/draft-07/schema#", | ||
"$id": "StandardScheduleConfiguration", | ||
"title": "StandardScheduleConfiguration", | ||
"type": "object", | ||
"properties": { | ||
"timeUnit": { | ||
"type": "string", | ||
"enum": ["minutes", "hours", "days", "weeks"] | ||
}, | ||
"units": { | ||
"type": "integer" | ||
} | ||
} | ||
} |
17 changes: 17 additions & 0 deletions
17
conduit-config/src/main/resources/json/StandardSyncConfiguration.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
{ | ||
"$schema": "http://json-schema.org/draft-07/schema#", | ||
"$id": "StandardSyncConfiguration", | ||
"title": "StandardSyncConfiguration", | ||
"description": "configuration required for sync for ALL taps", | ||
"type": "object", | ||
"properties": { | ||
"syncMode": { | ||
"type": "string", | ||
"enum": ["full_refresh", "append"] | ||
}, | ||
"schema": { | ||
"description": "describes the elements of the schema that will be synced.", | ||
"$ref": "StandardDataSchema.json#/definitions/schema" | ||
} | ||
} | ||
} |
47 changes: 47 additions & 0 deletions
47
conduit-config/src/main/resources/json/StandardSyncSummary.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
{ | ||
"$schema": "http://json-schema.org/draft-07/schema#", | ||
"$id": "StandardSyncSummary", | ||
"title": "StandardSyncSummary", | ||
"description": "standard information output by ALL taps for a sync step (our version of state.json)", | ||
"type": "object", | ||
"properties": { | ||
"attemptId": { | ||
"type": "string", | ||
"format": "uuid" | ||
}, | ||
"status": { | ||
"type": "string", | ||
"enum": ["pending", "in_progress","completed", "failed", "cancelled"] | ||
}, | ||
"recordsSynced": { | ||
"type": "integer", | ||
"minValue": 0 | ||
}, | ||
"version": { | ||
"type": "integer" | ||
}, | ||
"tables": { | ||
"type": "array", | ||
"items": { | ||
"type": "object", | ||
"properties": { | ||
"lastRecord": { | ||
"description": "blob of the last record", | ||
"type": "object" | ||
}, | ||
"version": { | ||
"type": "integer" | ||
} | ||
} | ||
} | ||
}, | ||
"startTime": { | ||
"type": "integer" | ||
}, | ||
"endTime": { | ||
"type": "integer" | ||
}, | ||
"logs": { | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters