Page MenuHomePhabricator

Update client-side event validator to support (at least) draft 3 of JSON Schema
Closed, DeclinedPublic

Description

NOTE: Draft 7 of JSON Schema was published on 2017/11/19.

Background

In T182000: Popups timestamp field contains multiple types, we discovered that data being sent by the EventLogging client couldn't be refined and imported into Hive. Hive was/is expecting a property to be a double but, because of the way JavaScript represents numbers and how they're encoded in JSON, received both integers and doubles.

In T182000#3809548, @Ottomata pointed out that we could encode "a number that isn't an integer" in a draft 3+ JSON Schema and so should be able to catch this issue sooner (during the implementation phase at worst). However, the EventLogging client doesn't implement a draft 3 compatible JSON Schema validator.

Strawman Solution

Switch out the JSON Schema validator in the EventLogging client for the jsonschema package in debug mode.

The jsonschema package is well-used, well-tested, and supports drafts 3, 4 and 6 of JSON Schema and has had a version published recently (4 weeks ago at the time of writing – Friday, 5th January 2018).

Event Timeline

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

There are performance penalties for delivering heavyweight libraries to the client but they're far outweighed by the gains developers get from having a really tight feedback loop while implementing instrumentation.

Hm, wait, the client side validator doesn't already support draft 3? What version is it using? AFAIK the EventLogging schemas are all draft 3.

@Ottomata: I think I've provided the correct link to the client-side validator code. If that's the case, then it doesn't seem to support all of draft 3 of JSON Schema but a strict subset.

fdans moved this task from Incoming to Smart Tools for Better Data on the Analytics board.

Closing this; Modern Event Platform uses draft-07. Won't change for EventLogging.

👌 Also, the client-side event validation was removed some time ago anyway! Thanks for tidying up, @Ottomata.