Budapest Clojure User Group - meetup presentation proposal for 2016-11-24
Validating data in dynamic typed programming languages is an important aspect of making sure our programs are safe and correct. In the short presentation we will take a look at two solutions for validating data in Clojure.
Prismatic Schema is a mature library with simple syntax and strong support in the Clojure ecosystem. The new competitor is core.specs supporting in the core language with promising new features. After the presentation we will discuss personal experiences with the advantages and disadvantages of both solutions.
TODO: slides are to be uploaded on this gist.
Spec
Basics
:s/invalid
conform?
andvalid?
Defining specs
s/def
Data
int?
,string?
, etc...s/cat
, alt, *, +, ?s/keys
and ...Composing specs
Conformers for coercion
s/conform
ands/conformer
Generative tests
check
andgen