Page MenuHomePhabricator

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

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

phuedx created this task.Dec 5 2017, 2:00 PM
Restricted Application added a project: Analytics. · View Herald TranscriptDec 5 2017, 2:00 PM
Restricted Application added a subscriber: Aklapper. · View Herald Transcript
phuedx added a comment.Dec 5 2017, 2:12 PM

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.

phuedx added a comment.EditedDec 5 2017, 2:23 PM

@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 edited projects, added Analytics-Kanban; removed Analytics.Dec 11 2017, 5:00 PM
phuedx updated the task description. (Show Details)Jan 5 2018, 10:40 AM
phuedx updated the task description. (Show Details)Jan 5 2018, 11:08 AM
phuedx updated the task description. (Show Details)Jan 8 2018, 1:02 PM
Nuria edited projects, added Analytics; removed Analytics-Kanban.Mar 22 2018, 4:31 PM
fdans triaged this task as Low priority.

(removing Tracking-Neverending tag as there are no subtasks)