@mping has joined the channel
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
@mping those should be removed. PR welcome.
it was pre clojure 1.9.0 where the spec was optional. we could require 1.9.0 and it would always be available
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
there’s probably a require somewhere thats under my radar or something
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
but, clojure is imperative at the core (multimethods and protocol extensions) and that’s whats happening:
(defmethod cc/named-coercion :schema [_] default-coercion)
e.g. you load a namespace, and the schema coercion gets registered. it’s a side-effect.
here’s the other one like that: https://github.com/metosin/compojure-api/blob/85738b802c7f150f4f550ffca91a4782c75f8091/src/compojure/api/coercion/spec.clj#L149
I see, I’ll put up a PR whenever I can
thanks for the explanation and plz keep up the good work