Skip to content

Commit

Permalink
Basic geometry schema
Browse files Browse the repository at this point in the history
  • Loading branch information
gino-m committed Feb 19, 2024
1 parent 07dab2a commit 7caabd9
Show file tree
Hide file tree
Showing 7 changed files with 98 additions and 4 deletions.
2 changes: 1 addition & 1 deletion shared/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ dependencies { implementation("org.jetbrains.kotlin", "kotlin-stdlib", "1.9.20")

buildscript {
repositories { mavenCentral() }
dependencies { classpath("net.pwall.json:json-kotlin-gradle:0.99.1") }
dependencies { classpath("net.pwall.json:json-kotlin-gradle:0.100") }
}

apply<JSONSchemaCodegenPlugin>()
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "schema:geometry/nested-coordinates",
"$comment": "Converted to GeoPoint in Firestore representation as an optimization.",
"title": "Coordinates",
"type": "object",
"required": [
"latitude",
"longitude"
],
"properties": {
"x": {
"type": "number"
},
"y": {
"type": "number"
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "schema:geometry/nested-geometry",
"type": "object",
"title": "Geometry",
"additionalProperties": false,
"unevaluatedProperties": false
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "schema:geometry/nested-linear-ring",
"$ref": "schema:geometry/nested-geometry",
"title": "Linear Ring",
"type": "object",
"required": [
"coordinates"
],
"properties": {
"coordinates": {
"type": "array",
"items": {
"$ref": "schema:geometry/nested-coordinates"
}
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "schema:geometry/nested-point",
"$ref": "schema:geometry/nested-geometry",
"title": "Point",
"type": "object",
"required": [
"type",
"coordinates"
],
"properties": {
"type": {
"type": "string",
"enum": [
"Point"
]
},
"coordinates": {
"$ref": "schema:geometry/nested-coordinates"
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "schema:geometry/nested-polygon",
"$ref": "schema:geometry/nested-geometry",
"title": "Polygon",
"type": "object",
"required": [
"type",
"shell"
],
"properties": {
"type": {
"type": "string",
"enum": [
"Polygon"
]
},
"shell": {
"$ref": "schema:geometry/nested-linear-ring"
},
"holes": {
"type": "array",
"items": {
"$ref": "schema:geometry/nested-linear-ring"
}
}
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"$id": "https://groundplatform.org/loi-document.schema.json",
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "schema:loi/loi-document",
"title": "Location of Interest",
"type": "object",
"properties": {
Expand All @@ -11,8 +11,7 @@
"type": "string"
},
"geometry": {
"type": "object",
"x-kt-type": "map"
"$ref": "schema:geometry/nested-geometry"
},
"properties": {
"type": "object",
Expand Down

0 comments on commit 7caabd9

Please sign in to comment.