This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2016-07-21
Channels
- # admin-announcements (4)
- # beginners (41)
- # boot (46)
- # cider (8)
- # clojure (132)
- # clojure-austin (15)
- # clojure-belgium (3)
- # clojure-greece (3)
- # clojure-hk (1)
- # clojure-mexico (4)
- # clojure-quebec (5)
- # clojure-russia (46)
- # clojure-spec (225)
- # clojure-taiwan (1)
- # clojure-uk (17)
- # clojurescript (46)
- # clojurewerkz (1)
- # core-async (28)
- # cursive (9)
- # datascript (3)
- # datomic (5)
- # defnpodcast (42)
- # devcards (60)
- # emacs (27)
- # hoplon (7)
- # lein-figwheel (5)
- # leiningen (12)
- # mount (8)
- # om (13)
- # play-clj (2)
- # reagent (47)
- # rethinkdb (5)
- # ring-swagger (7)
- # spacemacs (9)
- # specter (12)
- # testing (1)
- # untangled (1)
- # vim (11)
- # yada (31)
@quimrstorres: hi. there is a way, overriding the :coercion
for api, context or endpoint. Nowhere near computer, but here are some pointers: https://github.com/metosin/compojure-api/wiki/Building-Documented-Apis#coercion, https://github.com/metosin/compojure-api/blob/master/test/compojure/api/coercion_test.clj#L139. I think there should be an easier way, or at least better examples but hope this helps. I would start with creating an string->vector
schema matcher (see the plumatic schema guides), test it separately and only after then plug it into c-api.
Schema matchers don't compose easily, to get your own matcher + default matchers, you have to use something like (schema-tools.coerce/or-matcher my-string->vector-matcher ring.swagger.coerce/query-schema-coercion-matcher)
.
Hi @ikitommi . I’ve been through that pages but I was wondering because I also thought there might be an easier way. Thanks for the great help. If you think I could contribute with the examples or even in submitting any kind of improvement, let me know. 🙂
@quimrstorres: contributions welcome! I think a great start would be to cut&paste the coersion-part of the old README into a separate wiki page + possible more examples on real life cases (Wiki is open for all to modify).
if you think there is an easier way to customize coercion, please share :) Discussed some time ago about :matchers
, but couldn't make it work on paper good enough.