Fork me on GitHub
#reitit
<
2020-07-02
>
ikitommi10:07:06

@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

Ilari Tuominen10:07:18

@U055NJ5CC Thanks for this and especially the direct documentation link. I was kinda lost in the documentation and somehow managed to miss it.

ikitommi10:07:31

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.

👍 3
ikitommi10:07:45

PR welcome.

oly15:07:50

can anyone point me at handling query arrays ?

oly15:07:05

(def email-request-params (ds/spec {:name ::email-request :spec {:html string? :subject string? (ds/req :to) (s/coll-of string?) :from string?}}))

oly15:07:59

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

oly15:07:45

been hunting the docs of retit and spec-tools but I am not finding anything or using the wrong terminology

oly15:07:49

not sure which 🙂

gekkostate20:07:36

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.

gekkostate20:07:24

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.