Page MenuHomePhabricator

Migrate from justinrainbow/json-schema to opis/json-schema and remove from MW vendor
Open, Stalled, Needs TriagePublic

Description

WikiLambda is using opis/json-schema - T290274: Add any necessary dependencies for WikiLambda to production vendor once they've passed Security review.

It would make sense for our other usages of justinrainbow/json-schema to opis/json-schema so we don't need to include 2 different json schema validation libraries in MediaWiki-Vendor

Event Timeline

Reedy changed the task status from Open to Stalled.Oct 18 2021, 10:06 PM

Before we can remove it from MediaWiki-Vendor various usages need removing. Sub tasks need creating, so will do that later.

Marking stalled because it's going to be a while before this can be done itself

There is also a third in require-dev of MediaWiki-Vendor of swaggest/json-schema... Which seems to be CirrusSearch related according to rMWVDf15ef20aab65: Add CirrusSearch dev dependency to require-dev.

Looks like it was removed in rECIR251c19585235: Don't validate request event schema from CirrusSearch, so we should do that too from MediaWiki-Vendor

opis/json-schema isn't a drop in replacement for justinrainbow/json-schema:

opis/json-schema works with Plain Ol' PHP Objects (POPOs) out of the box whereas justinrainbow/json-schema works with POPOs and ordered dictionaries (and transparently marshalls between the two). opis/json-schema also (helpfully!) throws a number of exceptions when passed invalid JSON Schemas.

Further, opis/json-schema supports JSON Schema draft-06 onwards whereas justinrainbow/json-schema supports draft-03/04.

To migrate each usage of justinrainbow/json-schema, we'll need to:

  1. Migrate the schema from draft $foo to at least draft-06
  2. Ensure that the schema and data are passed in as POPOs
  3. Ensure that exceptions are being handled appropriately