Fork me on GitHub
#reitit
<
2022-04-04
>
rovanion09:04:06

When I add a malli schema for an optionar query parameter like:

:parameters {:query [:map [:år {:optional true} int?]]}}
My tests that call the ring-handler directly start failing due to the absence of the query map:
(handler/app-routes {:request-method :get, :uri "/kassar"})
 :errors ({:path [], :in [], :schema [:map {:closed true} [:år int?]], :value nil, :type :malli.core/invalid-type}),
I guess I could wrap the map schema in a [:maybe ] but that seems overly verbose. Just having the :maybe does not work as, for some reason, an empty set of query-params is coerced into {} rather than nil which makes malli complain about the type error.