Fork me on GitHub
#clojure-uk
<
2020-09-22
>
jiriknesl04:09:36

Good morning

dharrigan06:09:03

Good Morning!

folcon11:09:20

Morn' 😃...

alexlynham15:09:56

was just reading the source code of a lib we depend on p heavily

alexlynham15:09:15

and maybe i'm feeling @dominicm 's rage at js today

mccraigmccraig15:09:36

what's the guilty lib @alex.lynham?

alexlynham15:09:36

some real 'wow okay, you didn't need to reimplement that' moments

alexlynham15:09:46

the js jsonschema impl

alexlynham15:09:01

some highlights

alexlynham15:09:40

https://github.com/tdegrunt/jsonschema/blob/8bbf2c4e10c2290535f41ac9347f361649976745/lib/helpers.js#L228 ^ where instead of using the ok lodash or excellent ramda libs, they reimplement a bunch of merging utils

alexlynham15:09:35

https://github.com/tdegrunt/jsonschema/blob/8bbf2c4e10c2290535f41ac9347f361649976745/lib/helpers.js#L116 ^ where there's a random set of regexes when there are libs that cover the RFC regexes (admittedly this one isn't so bad, but I do have to trust them, as they're pretty hard to visually parse)

alexlynham15:09:17

and this lovely bit of code, which was the source of a bug AFAICT https://github.com/tdegrunt/jsonschema/blob/8bbf2c4e10c2290535f41ac9347f361649976745/lib/validator.js#L202 there's so much mutation going on it's hard to tell what's happening, plus loads of OO misdirection

alexlynham15:09:28

i worked it out in the end but HOO BOY

alexlynham15:09:38

been meaning to look at switching to the ajv lib and this has just accelerated that

dominicm16:09:41

Have used ajv, experience was mostly good. Performance wasn't great, but I suspect that is down to the size of our schema.