ring-swagger

ring-swagger & compojure-api
2018-09-26T11:58:29.000100Z

Hi, is there a way to fine tune compojure-api coercion? Whenever I run a main class, I get a bunch of compojure.api.coercion.schema - :schema coercion enabled in compojure.api hinting that some how I’m starting compojure-api

ikitommi 2018-09-26T11:59:04.000100Z

@mping those should be removed. PR welcome.

ikitommi 2018-09-26T11:59:32.000100Z

it was pre clojure 1.9.0 where the spec was optional. we could require 1.9.0 and it would always be available

2018-09-26T12:00:22.000100Z

@ikitommi thanks, I enjoy using compojure-api, I can try a PR

1👍
2018-09-26T12:01:06.000100Z

but what really bothers me is that it seems that somehow I’m running some compojure-api code even though I’m just doing lein run -m some.main.class

2018-09-26T12:01:23.000100Z

there’s probably a require somewhere thats under my radar or something

ikitommi 2018-09-26T12:05:14.000100Z

it’s happening when a require is followed and a namespace is loaded. just an extra log-line: https://github.com/metosin/compojure-api/blob/85738b802c7f150f4f550ffca91a4782c75f8091/src/compojure/api/coercion/schema.clj#L93

ikitommi 2018-09-26T12:06:24.000100Z

but, clojure is imperative at the core (multimethods and protocol extensions) and that’s whats happening:

(defmethod cc/named-coercion :schema [_] default-coercion)

ikitommi 2018-09-26T12:07:00.000100Z

e.g. you load a namespace, and the schema coercion gets registered. it’s a side-effect.

ikitommi 2018-09-26T12:07:31.000100Z

but, no missiles fired here 😉

1😄
2018-09-26T12:11:05.000100Z

I see, I’ll put up a PR whenever I can

2018-09-26T12:11:14.000100Z

thanks for the explanation and plz keep up the good work