Liking cljdoc? Tell your friends :D

framework.coercion.core

Request and response validation by given malli rules. The rule can be defined at route definition, the schema can be defined with registry function.

Path definition example:

["/api/siege-machines/{mydomain/id}" {:hander ws/handler-fn :action mydomain.siege-machines/get-by-id :parameters {:path [:map [:mydomain/id int?]]} :responses {200 {:body :mydomain/SiegeMachine}}}]

Registry example: (registry {:mydomain/SiegeMachine [:map [:id int?] [:name keyword?] [:range {:optional true} int?] [:created {:optional true} inst?]] :mydomain/Infantry [:map [:id int?] [:name keyword?] [:attack {:optional true} int?]]})

Request and response validation by given malli rules.
The rule can be defined at route definition,
the schema can be defined with registry function.

Path definition example:

["/api/siege-machines/{mydomain/id}" {:hander     ws/handler-fn
                                        :action     mydomain.siege-machines/get-by-id
                                        :parameters {:path [:map [:mydomain/id int?]]}
                                        :responses  {200 {:body :mydomain/SiegeMachine}}}]
                                        
Registry example: 
 (registry {:mydomain/SiegeMachine [:map
                                      [:id int?]
                                      [:name keyword?]
                                      [:range {:optional true} int?]
                                      [:created {:optional true} inst?]]
             :mydomain/Infantry [:map
                                   [:id int?]
                                   [:name keyword?]
                                   [:attack {:optional true} int?]]})
raw docstring

cljdoc is a website building & hosting documentation for Clojure/Script libraries

× close