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?]]})On enter: validates request parameters On leave: validates response body on request error: responds {:status 400, :body "Request coercion failed"} on response error: responds {:status 400, :body "Response validation failed"}
On enter: validates request parameters
On leave: validates response body
on request error: responds {:status 400, :body "Request coercion failed"}
on response error: responds {:status 400, :body "Response validation failed"}(registry schema)Registers a given schema in malli
Registers a given schema in malli
cljdoc builds & hosts documentation for Clojure/Script libraries
| Ctrl+k | Jump to recent docs | 
| ← | Move to previous article | 
| → | Move to next article | 
| Ctrl+/ | Jump to the search field |