Fork me on GitHub
#reitit
<
2020-09-20
>
dharrigan18:09:34

@ikitommi would you consider allowing humanized as the key that is output when there are errors, to be changed to a user-defined one (defaulting to humanized if the opts map entry is missing?)

ikitommi13:09:34

sure, there is now a option :encode-error that can have a fn of type error -> error, called last to optionally fully rewrite the error.

ikitommi13:09:07

{:encode-error (fn [error] {:errors (:humanized error)})}
==>
{:status 400, :body {:errors {:x ["missing required key"]}}}'

ikitommi13:09:24

shipped in [metosin/reitit "0.5.6"].