schemasafe
schemasafe copied to clipboard
Code generation that deduplicates validation logic
Use-case
Imagine you're building validator codecs for a set of inter-related schemas that define $ref
s on each other. The (awesome) code generation results in these being treated as totally isolated IIFE-enclosed validators. These validators duplicate the validation logic of all referenced schemas.
Request
It would be really interesting to have a facility whereby a set of inter-related schemas could be compiled as a unit and thereby produced smaller validation logic by referencing each other appropriately. I suspect that this would require major changes to how errors are collected as we would now have N
validator functions instead of 1
on which errors may be added.
Anyway, schemasafe is a fantastic bit of work. Really appreciate the rigour, speed and comprehensiveness. I'm using it with https://github.com/ggoodman/json-schema-to-dts to build codegen typed validation codecs.