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.
Schema
Primitiv (Leaf) semak
s/Int
,s/Num
,s/Keyword
,s/Symbol
,s/Bool
Maps
required-key
andoptional-key
Sequeneces
s/one
,s/optional
Other schemas
maybe
,enum
,eq
,pred
,conditional
,cond-pre
,constrained
either
,both
,if
,pair
Osszegzes es belso mukodes
LeafSpec
,VariantSpec
,CollectionSpec
Definiciok
s/def
s/fn
s/defrecord
^:always-validate
a fuggveny nevehezTeszteles
with-fn-validation
(use-fixtures :once schema-test/validate-schema)
s/validate
(hibat dob),s/check
,s/checker
*asserts*
,set-fn-validation!
,set-compile-fn-validation!
Coercion
coercer
Extensions
schema-human
schema-generators
sample
,generate
,complete
Sources