Re:What Clojure Spec is and what you can do with it
by jwr on Thursday September 10, 2020 @04:04PM
(#24436004)
> Can you elaborate with an example for s/valid? on needing to preconfrom your data. I have not had this issue.
If you have any conformers, s/valid? will use them before validating.
So, if you have a 'set' conformer, for example, s/valid? will tell you that the data is valid even if the value is not a set, but a vector, for example.
Your code must explicitly call 'conform', checking with s/valid? is not enough.
If you have any conformers, s/valid? will use them before validating.
So, if you have a 'set' conformer, for example, s/valid? will tell you that the data is valid even if the value is not a set, but a vector, for example.
Your code must explicitly call 'conform', checking with s/valid? is not enough.