Don't include "OrderedDict" in schema validation error messages in glean_parser
Categories
(Data Platform and Tools :: Glean: SDK, defect, P3)
Tracking
(Not tracked)
People
(Reporter: mdroettboom, Assigned: mdroettboom)
Details
(Whiteboard: [telemetry:glean-rs:m?])
Attachments
(1 file)
We currently use "OrderedDict" to load the schemas in glean_parser so the order of elements in the original file is preserved. Unfortunately, when the jsonschema
library prints validation error messages, these messages have explicit OrderedDict([('foo', 'bar')])
reprs rather than the JSON-like {'foo': 'bar'}
that our users would expect.
Besides being confusing, this bloats the error messages and makes our unit tests more susceptible to breakage across different versions of jsonschema
.
This OrderedDict
workaround is only required on Python 3.6 and earlier, since in Python 3.7, dicts
are order-preserving by default. Since Python 3.6 is rather far in the past now, it probably makes sense to only do this workaround there, which would improve the error messages on newer Python versions.
Comment 1•4 years ago
|
||
Comment 2•4 years ago
|
||
Description
•