@ilari.tuominen you can scope the swagger using route data in path [:swagger :id]
, e.g. add {:swagger {:id "public"}}
to you /public
path fragment and the /private
routes are not collected. See https://cljdoc.org/d/metosin/reitit/0.5.2/doc/ring/swagger-support#multiple-swagger-apis for more details
RE: reusing routes in frontend. One good add-on would be to do a reverse-http-router route in the backend. Kinda like match-by-name
over the wire. Good for cases where you must have a http/rest api but also do the client-side. Same could be done using swagger + swagger-client, but this would be much simpler.
issue here: https://github.com/metosin/reitit/issues/227
PR welcome.
@ikitommi Thanks for this and especially the direct documentation link. I was kinda lost in the documentation and somehow managed to miss it.
can anyone point me at handling query arrays ?
(def email-request-params
(ds/spec {:name ::email-request
:spec {:html string?
:subject string?
(ds/req :to) (s/coll-of string?)
:from string?}}))
so that works in swagger gives me a list and asks for a parameter per line, but the spec fails on submit because its a string and not cast to a list
been hunting the docs of retit and spec-tools but I am not finding anything or using the wrong terminology
not sure which 🙂
Hi all, I hope everyone is well. I’m facing a rather cryptic error which I’m finding difficult to debug:
java.lang.RuntimeException: class java.lang.Integer is not understandable
at org.httpkit.HttpUtils.bodyBuffer(HttpUtils.java:121)
at org.httpkit.HttpUtils.HttpEncode(HttpUtils.java:442)
I’m making a fairly standard POST request. The handler for the endpoint, works fine. That is, the code in the handler executes successfully and doesn’t return the above error. Instead, the error is coming from elsewhere (possible from the response/ok
, I’m not entirely sure). I’m wondering if someone has encountered this issue and can point in some directions to prod.Solved! Ahhh the wonders of writing out the problem. 🙂 The issue was indeed inside response/ok
. Instead of returning some kind of JSON, we were just returning an integer.