I'm not seeing response coercion working with reitit.coercion.malli . (Request parameters, yes they correctly produce a HTTP 400)
It's created like this:
(reitit.coercion.malli/create
{:error-keys #{:humanized}
:compile mu/open-schema
:skip-extra-values true
:default-values true
:encode-error (fn [error]
{:success? false
:reason :bad-parameter-type-or-format
:error-details (:humanized error)})})
While an endpoint declaration looks like this:
["/all"
{:get {,,,
:parameters {:query [:map
[:foo :string]]}
:responses {:200 {:body (success-with ,,,)} ;; (success-with) returns a schema
:500 {:body (failure-with) ,,,}}}}] ;; (failure-with) returns a schema
Any usual suspect that you're aware of?:200 vs 200
That was it :o I guess that reitit could use some Malli checking internally :)
You can turn on spec checking for some parts, not sure if response specs are covered
How do I do that?
Open a MR, probably 😄
Started with a humble iss for now https://github.com/metosin/reitit/issues/667
Neighbor of the beast