reitit

https://cljdoc.org/d/metosin/reitit/ https://github.com/metosin/reitit/
rlander 2020-04-28T04:10:59.246600Z

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.

rlander 2020-04-28T04:11:22.246900Z

I'm using Schema, btw.

rlander 2020-04-28T04:12:19.247800Z

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 .

rlander 2020-04-28T04:13:04.248Z

Any help would be much appreciated

rlander 2020-04-28T04:30:43.249100Z

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

rlander 2020-04-28T04:52:24.250600Z

Yes, that was it. Just override the default matcher and add your own.

rlander 2020-04-28T04:53:58.251800Z

@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).

ikitommi 2020-04-28T05:24:52.252400Z

@rlander would be great, looking forward to it!

1👍
plexus 2020-04-28T12:08:09.253600Z

@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

ikitommi 2020-04-28T15:22:05.255200Z

@plexus just that too. Deps is so far from the lein experience still. I recall someone made a plugin for this?

plexus 2020-04-28T15:35:09.255600Z

thanks! I just did this

for x in **/*.java; do javac -cp `clojure -Spath` $x ; done

bartuka 2020-04-28T17:47:46.257900Z

@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?

orestis 2020-04-28T18:41:31.258500Z

A colleague maintains https://github.com/EwenG/badigeon , might be useful.

1