jenkins-bot has submitted this change and it was merged.

Change subject: GeometryCollection is a subset of Geometry
......................................................................


GeometryCollection is a subset of Geometry

https://tools.ietf.org/html/rfc7946#section-3.1.8

Bug: T146157
Change-Id: I60b36c87350eb428780729e7e1cc5d252e94ad4c
(cherry picked from commit 765fc650da4c78b83921ad5e1729993dfac279ba)
---
M schemas/geojson.json
A tests/phpunit/data/bad-schemas/41-nested-geometry-collections.json
A tests/phpunit/data/good-schemas/09-geometry-collection.json
3 files changed, 70 insertions(+), 2 deletions(-)

Approvals:
  Hashar: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/schemas/geojson.json b/schemas/geojson.json
index 567ccc6..0063cae 100644
--- a/schemas/geojson.json
+++ b/schemas/geojson.json
@@ -16,7 +16,6 @@
                        },
                        "oneOf": [
                                { "$ref": "#/definitions/geometry" },
-                               { "$ref": "#/definitions/geometryCollection" },
                                { "$ref": "#/definitions/feature" },
                                { "$ref": "#/definitions/featureCollection" },
                                { "$ref": "#/definitions/externalData" }
@@ -50,7 +49,17 @@
                        "title": "geometry",
                        "description": "One geometry as defined by GeoJSON",
                        "type": "object",
-                       "required": [ "type", "coordinates" ],
+                       "required": [ "type" ],
+                       "oneOf": [
+                               { "$ref": "#/definitions/primitiveGeometry" },
+                               { "$ref": "#/definitions/geometryCollection" }
+                       ]
+               },
+               "primitiveGeometry": {
+                       "title": "primitiveGeometry",
+                       "description": "All the non-collection Geometry types",
+                       "type": "object",
+                       "required": [ "coordinates" ],
                        "oneOf": [
                                {
                                        "title": "Point",
diff --git a/tests/phpunit/data/bad-schemas/41-nested-geometry-collections.json 
b/tests/phpunit/data/bad-schemas/41-nested-geometry-collections.json
new file mode 100644
index 0000000..5de9976
--- /dev/null
+++ b/tests/phpunit/data/bad-schemas/41-nested-geometry-collections.json
@@ -0,0 +1,18 @@
+{
+       "type": "GeometryCollection",
+       "geometries": [
+               {
+                       "type": "GeometryCollection",
+                       "geometries": [
+                               {
+                                       "type": "Point",
+                                       "coordinates": [
+                                               10,
+                                               20,
+                                               "fail"
+                                       ]
+                               }
+                       ]
+               }
+       ]
+}
\ No newline at end of file
diff --git a/tests/phpunit/data/good-schemas/09-geometry-collection.json 
b/tests/phpunit/data/good-schemas/09-geometry-collection.json
new file mode 100644
index 0000000..2e8aa2c
--- /dev/null
+++ b/tests/phpunit/data/good-schemas/09-geometry-collection.json
@@ -0,0 +1,41 @@
+{
+       "type": "Feature",
+       "geometry": {
+               "type": "GeometryCollection",
+               "geometries": [
+                       {
+                               "type": "LineString",
+                               "coordinates": [
+                                       [
+                                               -20.78146426141457,
+                                               -20.24797277602244
+                                       ],
+                                       [
+                                               20.80974825712424,
+                                               30.094641604394508
+                                       ]
+                               ]
+                       },
+                       {
+                               "type": "Point",
+                               "coordinates": [
+                                       10,
+                                       20
+                               ]
+                       },
+                       {
+                               "type": "GeometryCollection",
+                               "properties": {},
+                               "geometries": [
+                                       {
+                                               "type": "Point",
+                                               "coordinates": [
+                                                       30,
+                                                       40
+                                               ]
+                                       }
+                               ]
+                       }
+               ]
+       }
+}

-- 
To view, visit https://gerrit.wikimedia.org/r/311980
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I60b36c87350eb428780729e7e1cc5d252e94ad4c
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Kartographer
Gerrit-Branch: wmf/1.28.0-wmf.18
Gerrit-Owner: Yurik <yu...@wikimedia.org>
Gerrit-Reviewer: Hashar <has...@free.fr>
Gerrit-Reviewer: MaxSem <maxsem.w...@gmail.com>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to