Fork me on GitHub
#malli
<
2021-09-12
>
Ben Sless11:09:30

This is somewhere between malli and #reitit, is there a way to know the schema with which validation passed in cases of or and multi?

respatialized14:09:22

I asked this question a while back; there's not a good way to do this without orn. If you know all the validation paths at compile time they can be enumerated. But the use case I was thinking about, of sum types that are created at runtime, was still tricky to match on. @U055NJ5CC suggested a simple function for converting the or to orn with numbers as the keys so that I could know which was matched. Not sure if anything has changed in the library since I asked about it, so this solution may be out of date.

Ben Sless14:09:38

Ended up going with orn and parse in the end I wonder how it interacts with decoding. Are conflicts possible?

rutledgepaulv18:09:42

I've used a custom decoder for this that attaches the schema to the value as metadata

😮 4