biff 2024-11-01

Question on malli in biff: I have a schema that uses doubles, uuids and enums. When I create an htmx-post request, these values arrive at the server as strings. I would expect malli to do the appropriate coercion but it doesn't and I still need to manually coerce these values before running submit-tx. There was a potentially related thread that mentioned updating the routes to `

(def routes ["" {:coercion r.c.malli/coercion}
             ["" {:middleware [mid/wrap-site-defaults]}
              (keep :routes modules)]
             ["" {:middleware [mid/wrap-api-defaults r.r.coercion/coerce-request-middleware]}
              (keep :api-routes modules)]])
but that didn't work for me...any pointers?

yeah, submit-tx doesn't do any coercion. You'll have to add additional schema to your routes, e.g. see the :parameters {:query ...} bit in this post: https://clojurians.slack.com/archives/C013Y4VG20J/p1728770815530479?thread_ts=1728742333.237249&cid=C013Y4VG20J If you start a fresh project and make the changes from that diff verbatim, you should end up with a working example that you can then compare to your current app.

🙏 1