reitit

James Amberger 2025-06-02T19:44:45.068669Z

danielneal 2025-06-03T14:57:51.633089Z

I use something like this

(def collection-transformer
  (mt/transformer
   {:decoders
    {:vector (fn [x]
               (if (vector? x) x [x]))
     :sequential (fn [x]
                   (if (sequential? x) x [x]))
     :set (fn [x]
            (if (set? x) x #{x}))}}))

👀 1
danielneal 2025-06-03T14:58:14.686719Z

and then if the schema is a collection but a parameter is not, it will be wrapped in the relevant collection

danielneal 2025-06-03T14:59:23.190639Z

and include that as one of the transformers passed to the coercer

danielneal 2025-06-03T14:59:43.687779Z

then ths spec is just

[:year {:optional true}
       [:vector int?]]

2025-06-02T20:48:48.340819Z

Is there any way to use reitit format middleware muuntaja backed by cheshire?

juhoteperi 2025-06-03T07:47:22.890519Z

Yes, muuntaja has cheshire module so you'd just need to configure the middleware to refer to cheshire json format instead of the regular Jsonista json format