Apologies if this has come up before, I’m new to meander. Something that struck me as I read through the meander docs was how in some ways, meander could be seen as a generalization of validation tools like malli or spec, in that it can do transformation in addition to validation. in other words, meander is (could be?) a data parser. Has anyone tried using meander as a validator in a role that would normally be reserved for spec or malli?? If so, how did it go? Are there any tools out work with meander patterns as data similar to how you would for malli or spec, such as generating JSON schemas or producing example data fitting the pattern a la spec-gen?
> meander could be seen as a generalization of validation tools like malli or spec
Almost! At the moment, I would say that it could be used where one might use s/conform
e.g. where one wishes to parse something.
> meander as a validator
I have done this with m/search
with good results. Where left side of each rule represents the shape of a particular error, and the right side builds and error object i.e. {:type :error ,,,}
, (ex-info "BAD" ,,,)
, etc.
The future holds two important things for the library which I’ve been working on and hope to release by the end of the year: data generation, and an API for programming.
That sounds awesome! I’m glad to see we’re on the same wavelength 〰️
Where I work we use spec and spec-tools to parse incoming requests and it’s never felt like a great fit. Spec coercion is really limited, and as a Haskell refugee, it trips my https://lexi-lambda.github.io/blog/2019/11/05/parse-don-t-validate/ spidey sense. I’ve been thinking for a while on how in Haskell there are special-purpose data parsers (e.g. aeson), but Clojure really needs more of a general-purpose data parser since it has stronger built-in data types. I tried playing around with an aeson-like model a bit, but Clojure really isn’t amenable to applicative-style parsing. Meander seems like it accomplishes most of that goal, so I’m excited to see where it goes!