Fork me on GitHub
#clojure-uk
<
2016-08-21
>
otfrom16:08:29

anyone done much with clojure.spec conformers and using them for data conversion (similar to the way you can coerce in plumatic/schema)?

seancorfield17:08:47

Yes, we're using them to map from an input domain to our internal domain model.

otfrom17:08:04

seancorfield cool

seancorfield17:08:51

It can be a bit fussy if you're dealing with all string input and need to verify numeric ranges etc. We're still trying to figure out the best idiom for that sort of thing.

seancorfield17:08:09

And mapping explain-data back to error codes to respond to callers can be hairy too.

otfrom17:08:59

I'm wondering about going from string -> (nil | [string string int float float float]) and writing generators for that too that will have some positive test cases. 😉

otfrom17:08:33

but I am very early days in thinking about this

otfrom17:08:36

(and thinking about it now I should probably add in string -> [string string string string string string] and then [string string string string string string] -> [string string int float float float])

seancorfield17:08:07

Yeah, you end up having to wrap every input spec with a generator (so they generate conforming data and then call str on it).

otfrom17:08:35

seancorfield that mind flip makes you my current hero. thx!