reitit

vemv 2024-03-12T13:36:30.839009Z

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?

Ben Sless 2024-03-12T15:48:14.446159Z

:200 vs 200

vemv 2024-03-12T15:59:04.978539Z

That was it :o I guess that reitit could use some Malli checking internally :)

Ben Sless 2024-03-12T16:16:49.038179Z

You can turn on spec checking for some parts, not sure if response specs are covered

vemv 2024-03-12T16:18:14.964339Z

How do I do that?

Ben Sless 2024-03-12T16:18:45.984539Z

Open a MR, probably 😄

vemv 2024-03-12T16:23:28.453069Z

Started with a humble iss for now https://github.com/metosin/reitit/issues/667

👍 1
Ben Sless 2024-03-12T17:39:31.547159Z

Neighbor of the beast

6️⃣ 1