This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2017-06-02
Channels
- # aleph (5)
- # beginners (112)
- # boot (137)
- # cider (10)
- # cljs-dev (36)
- # cljsrn (2)
- # clojure (118)
- # clojure-argentina (1)
- # clojure-berlin (1)
- # clojure-brasil (3)
- # clojure-dev (4)
- # clojure-italy (2)
- # clojure-nl (13)
- # clojure-russia (23)
- # clojure-spec (5)
- # clojure-uk (53)
- # clojurescript (344)
- # clojutre (1)
- # core-async (65)
- # cursive (9)
- # datascript (7)
- # datomic (28)
- # devops (1)
- # emacs (16)
- # events (1)
- # jobs (5)
- # keechma (18)
- # lumo (56)
- # off-topic (7)
- # om (3)
- # onyx (14)
- # protorepl (21)
- # re-frame (3)
- # reagent (20)
- # ring (12)
- # ring-swagger (9)
- # specter (17)
- # unrepl (14)
- # vim (14)
- # yada (22)
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 https://github.com/metosin/compojure-api/pull/311
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.
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
.