Quick question: how do I define a custom response coercion? I have a Java class that I want to coerce to BigDecimal
just before serialization.
I'm using Schema, btw.
I know how to extend the request coercion using json-coercion-matcher
but I have no idea how to add a custom coercion matcher to the response .
Any help would be much appreciated
After some digging, it seems overriding :matchers / :response / :default
should do the trick: https://github.com/metosin/reitit/blob/master/modules/reitit-schema/src/reitit/coercion/schema.cljc#L42
Yes, that was it. Just override the default matcher and add your own.
@https://app.slack.com/team/U055NJ5CC I could submit a PR with instructions for this particular case if you get this question a lot (the docs only provide instructions for request coercion).
@rlander would be great, looking forward to it!
@ikitommi asking here since there's no #pohjavirta (yet). How do you normally deal with having those .java
files in the project? I'm using a local checkout now and javac
'd them manually
@plexus just that too. Deps is so far from the lein experience still. I recall someone made a plugin for this?
also: https://github.com/metosin/pohjavirta/issues/18#issuecomment-561758351
thanks! I just did this
for x in **/*.java; do javac -cp `clojure -Spath` $x ; done
@ikitommi I started to use #tilakone this week and it really helped to deal with several integration branches I had in a project. are you guys serializing the whole state machine ? if so, what are you using?
A colleague maintains https://github.com/EwenG/badigeon , might be useful.