diff --git a/shared/src/main/resources/schema/com/google/ground/shared/schema/geometry/nested-coordinates.schema.json b/shared/src/main/resources/schema/com/google/ground/shared/schema/geometry/nested-coordinates.schema.json new file mode 100644 index 0000000000..0d83209f88 --- /dev/null +++ b/shared/src/main/resources/schema/com/google/ground/shared/schema/geometry/nested-coordinates.schema.json @@ -0,0 +1,19 @@ +{ + "$schema": "https://json-schema.org/draft/2020-12/schema", + "$id": "https://groundplatform.org/schema/geometry/nested-coordinates.schema.json", + "$comment": "Converted to GeoPoint in Firestore representation as an optimization.", + "title": "Coordinates", + "type": "object", + "required": [ + "latitude", + "longitude" + ], + "properties": { + "x": { + "type": "number" + }, + "y": { + "type": "number" + } + } +} \ No newline at end of file diff --git a/shared/src/main/resources/schema/com/google/ground/shared/schema/geometry/nested-geometry.schema.json b/shared/src/main/resources/schema/com/google/ground/shared/schema/geometry/nested-geometry.schema.json new file mode 100644 index 0000000000..6eb6626c0a --- /dev/null +++ b/shared/src/main/resources/schema/com/google/ground/shared/schema/geometry/nested-geometry.schema.json @@ -0,0 +1,9 @@ +{ + "$schema": "https://json-schema.org/draft/2020-12/schema", + "$id": "https://groundplatform.org/schema/geometry/nested-geometry.schema.json", + "title": "Geometry", + "oneOf": [ + { "$ref": "https://groundplatform.org/schema/geometry/nested-point.schema.json" }, + { "$ref": "https://groundplatform.org/schema/geometry/nested-polygon.schema.json" } + ] +} \ No newline at end of file diff --git a/shared/src/main/resources/schema/com/google/ground/shared/schema/geometry/nested-linear-ring.schema.json b/shared/src/main/resources/schema/com/google/ground/shared/schema/geometry/nested-linear-ring.schema.json new file mode 100644 index 0000000000..d00797a8af --- /dev/null +++ b/shared/src/main/resources/schema/com/google/ground/shared/schema/geometry/nested-linear-ring.schema.json @@ -0,0 +1,17 @@ +{ + "$schema": "https://json-schema.org/draft/2020-12/schema", + "$id": "https://groundplatform.org/schema/geometry/nested-linear-ring.schema.json", + "title": "Linear Ring", + "type": "object", + "required": [ + "coordinates" + ], + "properties": { + "coordinates": { + "type": "array", + "items": { + "$ref": "https://groundplatform.org/schema/geometry/nested-coordinates.schema.json" + } + } + } +} diff --git a/shared/src/main/resources/schema/com/google/ground/shared/schema/geometry/nested-point.schema.json b/shared/src/main/resources/schema/com/google/ground/shared/schema/geometry/nested-point.schema.json new file mode 100644 index 0000000000..6a931676a0 --- /dev/null +++ b/shared/src/main/resources/schema/com/google/ground/shared/schema/geometry/nested-point.schema.json @@ -0,0 +1,21 @@ +{ + "$schema": "https://json-schema.org/draft/2020-12/schema", + "$id": "https://groundplatform.org/schema/geometry/nested-point.schema.json", + "title": "Point", + "type": "object", + "required": [ + "type", + "coordinates" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "Point" + ] + }, + "coordinates": { + "$ref": "https://groundplatform.org/schema/geometry/nested-coordinates.schema.json" + } + } +} \ No newline at end of file diff --git a/shared/src/main/resources/schema/com/google/ground/shared/schema/geometry/nested-polygon.schema.json b/shared/src/main/resources/schema/com/google/ground/shared/schema/geometry/nested-polygon.schema.json new file mode 100644 index 0000000000..d86022fd39 --- /dev/null +++ b/shared/src/main/resources/schema/com/google/ground/shared/schema/geometry/nested-polygon.schema.json @@ -0,0 +1,27 @@ +{ + "$schema": "https://json-schema.org/draft/2020-12/schema", + "$id": "https://groundplatform.org/schema/geometry/nested-polygon.schema.json", + "title": "Polygon", + "type": "object", + "required": [ + "type", + "shell" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "Polygon" + ] + }, + "shell": { + "$ref": "https://groundplatform.org/schema/geometry/nested-linear-ring.schema.json" + }, + "holes": { + "type": "array", + "items": { + "$ref": "https://groundplatform.org/schema/geometry/nested-linear-ring.schema.json" + } + } + } +} \ No newline at end of file diff --git a/shared/src/main/resources/schema/com/google/ground/shared/schema/loi/loi-document.schema.json b/shared/src/main/resources/schema/com/google/ground/shared/schema/loi/loi-document.schema.json index a7c625c679..370d226ad2 100644 --- a/shared/src/main/resources/schema/com/google/ground/shared/schema/loi/loi-document.schema.json +++ b/shared/src/main/resources/schema/com/google/ground/shared/schema/loi/loi-document.schema.json @@ -1,6 +1,6 @@ { - "$id": "https://groundplatform.org/loi-document.schema.json", "$schema": "https://json-schema.org/draft/2020-12/schema", + "$id": "https://groundplatform.org/schema/loi/loi-document.schema.json", "title": "Location of Interest", "type": "object", "properties": { @@ -11,8 +11,7 @@ "type": "string" }, "geometry": { - "type": "object", - "x-kt-type": "map" + "$ref": "https://groundplatform.org/schema/geometry/nested-geometry.schema.json" }, "properties": { "type": "object",