Fork me on GitHub

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.


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


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



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


@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?


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

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


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