reitit

https://cljdoc.org/d/metosin/reitit/ https://github.com/metosin/reitit/
ikitommi 2020-07-02T10:38:06.191200Z

@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

ikitommi 2020-07-02T10:44:31.194400Z

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.

👍 1
ikitommi 2020-07-02T10:44:40.194600Z

issue here: https://github.com/metosin/reitit/issues/227

ikitommi 2020-07-02T10:44:45.194900Z

PR welcome.

Ilari Tuominen 2020-07-02T10:53:18.195500Z

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

oly 2020-07-02T15:46:50.196100Z

can anyone point me at handling query arrays ?

oly 2020-07-02T15:47:05.196400Z

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

oly 2020-07-02T15:47:59.197300Z

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

oly 2020-07-02T15:48:45.198Z

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

oly 2020-07-02T15:48:49.198200Z

not sure which 🙂

gekkostate 2020-07-02T20:46:36.198800Z

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.

gekkostate 2020-07-02T20:53:24.199300Z

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.