Fork me on GitHub

good morning @michaelblume. Didn’t know that 1-arity merge is a code smell. The endpoint macros generate the code and the merge can end up with 1+ arguments. But wanted to understand this and did a optimised merge-vector handling the 1-arity differently. FIxes the warning (thanks for the sample repo!) and is as a bonus 10x faster for the default case. See


hello everybody, i’m just getting started with compojure/swagger. I have a chestnut application (the newest release) setup, and my initial attempts all work fine. i’m having trouble understanding the swagger.json file – is this a static file resource somewhere or can i programatically generate it? how do i integrate that with my app, simply register a swagger.json route and return the json content via ring-swagger? thank you


@nicoschneider hi. the swagger-things are mostly auto generated if you use compojure-api. I think the default chestnut uses plain compojure, so you should change that.


I think the best way to see what compojure-api does is to run it’s own template: lein new compojure-api kikka


that sets up a really minimal web server, which has two endpoint with schema-validation & swagger-docs.


the readme describes how to start etc.


but the idea is that you write your compojure(-api) routes just like with compojure, wrap them in api and add some swagger-options to it. api reads the reverse-routing tree + the schemas attached to routes and creates valid swagger.json out of those. There are api-options to mount a endpoint for serving both the swagger.json and the swagger-ui.


once you have a running compojure-api sample, it should (hopefully) be streightforward to take those changes to your template project. basically just remove any json-format middlewares (compojure-api ships with it’s own), wrap the apis into api and change imports from compojure.core to compojure.api.sweet.


hope this helps to get started