Fork me on GitHub
#reitit
<
2022-01-18
>
dharrigan07:01:17

Have you tried removing :parameters {} and try again?

MikeE12:01:06

thanks @U11EL3P9U no luck there.. I think its as @U49RJG1L0 said it’s because i’m not using coll-of but I cant’ find any sample on the metosin site or the github repos for this project that show that use case - they’re all extremely simple samples that don’t show the use of things like rendering out collections in your response. (map of list of maps) my goal for the response is to have it look like { "users": [{"id": 1… }, {"id": 2}]} (map with a list of maps) but I can’t even figure out how to just render a list yet.

wegi12:01:36

You can define a spec for it elsewhere and the use the spec for example:

(s/def ::user :your-user-definition)
(s/def ::users (s/coll-of ::user))
(s/def ::response (s/keys :req-un [::users]))
You can then use ::response in your route spec definition

MikeE12:01:22

thank you for that clarity.. i will test (and I have to dive deeper into spec 🙂 )..

MikeE15:01:25

@U49RJG1L0 thanks again! - that worked great.

👍 1
Hukka09:01:43

Ugh, I'm getting a java.lang.ClassCastException if reitit.ring.middleware.muuntaja/format-request-middleware is on, but there's no trace in the exception

Hukka10:01:29

Hm, if I enable coercion, I'm getting a malli error with no path in :errors 😕 I wonder if that's related

Hukka10:01:23

Ok, seems like I can produce these traceless ClassCastExceptions quite easily in my dev repl, while the same exact snippet gives the trace in a vanilla, or even an nrepl shell that isn't launched in this project

Hukka11:01:23

Got a hint that I got bitten by omitstactraceinfastthrow