ring-swagger

ring-swagger & compojure-api
2017-11-01T16:33:05.000569Z

Hey, I got a few issues with compojure-api: 1. I get a weird Error regarding Swagger:

Assert failed: :swagger is deprecated with 2.0.0, use [:info :public] instead
   (nil? swagger)
even though i do not have a swagger key in my config map. 2. I get a
com.fasterxml.jackson.core.JsonGenerationException: Cannot JSON encode object of class: class myproject.my_resource$fn__16
if a body does not conform to the Schema described in :body property.

2017-11-01T16:46:31.000510Z

Argh, I solved the second issue. I used s/conditional in the body scheme. 😞

2017-11-01T17:00:04.000106Z

Hot damn, CodeMesh looks awesome

ikitommi 2017-11-01T17:16:51.000264Z

@vitali.henne do you have a line number of that assert error?

2017-11-01T17:28:58.000131Z

@ikitommi:

meta.clj:  645  compojure.api.meta/restructure
                  meta.clj:  617  compojure.api.meta/restructure
                  core.clj:   60  compojure.api.core/GET

ikitommi 2017-11-01T17:50:43.000750Z

@vitali.henne There is some custom restructuring that is emitting :swagger data into you route meta. Have you used custom restructuring? If not, what does your GET look like in whole?

ikitommi 2017-11-01T17:51:56.000693Z

e.g. If you evaluate your route at a repl, you should see something like this:

(GET "/kikka" []
  :swagger {:a 1}
  "kikka")
#compojure.api.routes.Route
{:childs nil
 :handler #<Fn@1e7ce1fa compojure.core/wrap_route_matches[fn]>
 :info {:public {:a 1}}
 :method :get
 :path "/kikka"}

2017-11-01T18:41:32.000020Z

I had a custom built middleware which emitted (of which I was unaware) the :swagger. Thank you very much for your help 🙂