Page MenuHomePhabricator

Incorrect id in mapframe should give a simpler error message
Closed, ResolvedPublic

Description

https://en.wikipedia.org/w/index.php?title=Western_Sahara&diff=896779929&oldid=896544122&diffmode=source

When using an invalid wikidata id, it reports:
<mapframe>: The JSON content is not valid GeoJSON+simplestyle

took me way too long to figure out the missing Q caused it to not load entity json at all.

Event Timeline

Was looking into this a bit. My first idea was to just dump them with status->warning inline, but unfortunately, due to the loose JSON schema used, validation errors can be incredible long that way. For example in this specific case of a missing Q in the id...

⧼[[0].ids] Does not match the regex pattern ^Q[1-9]\d{0,19}(\s*,\s*Q[1-9]\d{0,19})*$⧽
⧼[[0].ids] String value found, but an array is required⧽
⧼[[0].ids] Failed to match exactly one schema⧽
⧼[[0].title] The property title is required⧽
⧼[[0].service] Does not have a value in the enumeration ["page"]⧽
⧼0 Failed to match exactly one schema⧽
⧼[[0].geometries] The property geometries is required⧽
⧼[[0].type] Does not have a value in the enumeration ["GeometryCollection"]⧽
⧼[[0].type] Does not have a value in the enumeration ["MultiPolygon"]⧽
⧼[[0].type] Does not have a value in the enumeration ["Point"]⧽
⧼[[0].type] Does not have a value in the enumeration ["MultiPoint"]⧽
⧼[[0].type] Does not have a value in the enumeration ["LineString"]⧽
⧼[[0].type] Does not have a value in the enumeration ["MultiLineString"]⧽
⧼[[0].type] Does not have a value in the enumeration ["Polygon"]⧽
⧼[[0].coordinates] The property coordinates is required⧽
⧼[[0].geometry] The property geometry is required⧽
⧼[[0].type] Does not have a value in the enumeration ["Feature"]⧽
⧼[[0].features] The property features is required⧽
⧼[[0].type] Does not have a value in the enumeration ["FeatureCollection"]⧽

Then considered passing them separately, much like the scribunto stack traces. But that means implementing something parallel to the Status report handling, which also is less than ideal..

Change 673976 had a related patch set uploaded (by TheDJ; author: Thiemo Kreuz (WMDE)):

[mediawiki/extensions/Kartographer@master] [POC] Expose JSON validation errors to the user

https://gerrit.wikimedia.org/r/673976

Change 673976 merged by jenkins-bot:

[mediawiki/extensions/Kartographer@master] Expose first JSON validation error to the user

https://gerrit.wikimedia.org/r/673976

Change 826520 had a related patch set uploaded (by Thiemo Kreuz (WMDE); author: Thiemo Kreuz (WMDE)):

[mediawiki/extensions/Kartographer@master] Show all GeoJSON validation errors

https://gerrit.wikimedia.org/r/826520

Change 826520 merged by jenkins-bot:

[mediawiki/extensions/Kartographer@master] Show all GeoJSON validation errors

https://gerrit.wikimedia.org/r/826520