Seeking Alternatives for Custom Schema Combinators: Exclude, Intersection, orElse
I have an
I'd like to discountinue them in order to behave more like Schema needs, and be more in line with Schema philosophy (also don't want to keep maintaining changes to annotations, AST internals and stuff).
Is there a way to achieve all the listed custom combinators with the new schema? From what I can see there's no easy way, unless I'm missing something.
-
-
-
exclude, intersection, orElse schema combinators built in userland, that helped me declaring domain schema.I'd like to discountinue them in order to behave more like Schema needs, and be more in line with Schema philosophy (also don't want to keep maintaining changes to annotations, AST internals and stuff).
Is there a way to achieve all the listed custom combinators with the new schema? From what I can see there's no easy way, unless I'm missing something.
-
exclude: given schema A and schema B decode things that are As that are not Bs, resulting in Exclude<A, B>-
intersection: given schema A and schema B, decode things that are As and Bs at the same time resulting in A & B-
orElse: given schema<A, I> and value a of type A, try decoding I and return a if decoding fails (this may be accomplished with the default option, not sure it's available for all schema though)