Page MenuHomePhabricator

Simplify ExternalData parsing in Kartographer
Closed, ResolvedPublic

Description

In order to reuse the same code in both JS and Node, the code that parses ExternalData geojson should be as simple as possible, especially since we always get that data from the trusted PHP parser.

  • php should normalize service and href variants into an HREF
  • URL should always contain proper protocol and domain, e.g. https://maps.wikimedia.org/geoshape?...
  • there should always be a service tag to simplify post-processing of the request

This way the JS code can always expect these two fields:

"ExternalData": {
    "service": "geoshape",
    "href": "https://maps.wikimedia.org/geoshape?ids=Q30"
}

Event Timeline

Restricted Application added a subscriber: Aklapper. · View Herald Transcript

Is service really needed when it's duplicated in href?

@MaxSem it's not duplicated, href should use the real protocol to avoid complex parsing

Change 314147 had a related patch set uploaded (by MaxSem):
Normalize ExternalData

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

Change 314147 merged by jenkins-bot:
Normalize ExternalData

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