This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2017-02-08
Channels
- # aleph (11)
- # arachne (7)
- # aws (1)
- # bangalore-clj (4)
- # beginners (24)
- # boot (128)
- # bristol-clojurians (23)
- # cider (1)
- # cljs-dev (43)
- # cljsrn (6)
- # clojure (178)
- # clojure-austin (3)
- # clojure-chicago (1)
- # clojure-dusseldorf (14)
- # clojure-finland (15)
- # clojure-france (6)
- # clojure-italy (18)
- # clojure-portugal (2)
- # clojure-russia (67)
- # clojure-spec (148)
- # clojure-uk (55)
- # clojurescript (199)
- # core-async (4)
- # cursive (18)
- # datascript (5)
- # datomic (120)
- # devcards (3)
- # dirac (53)
- # emacs (11)
- # events (3)
- # gsoc (7)
- # jobs (1)
- # lein-figwheel (25)
- # leiningen (5)
- # lumo (12)
- # off-topic (29)
- # om (174)
- # om-next (2)
- # onyx (7)
- # perun (10)
- # protorepl (6)
- # re-frame (12)
- # remote-jobs (1)
- # ring (19)
- # ring-swagger (25)
- # rum (6)
- # spacemacs (13)
- # sql (3)
- # untangled (88)
- # yada (7)
Let's say I have a schema customer (defschema Customer .....)
, that has a field that may come invalid but I want to return null
when is invalid... is there a way I could do that with coercion?
Bumped into something a bit nasty with compojure-api (and compojure). If one calls a method with wrong number of arguments inside the endpoint declarations eg. (GET "/foo/bar" ... the compiler doesn't say anything. 😕
no, it should work ok. Thanks to awesomeness of @cfleming, Cursive also does static analysis on compojure & compojure-api syntax.
it would be cool if the compiler could complain as well @ikitommi, then it wouldn't be just relying on a coders tired eyes 😉
I agree! You have to poke Rich Hickey thou 😉 Spec should help, with help of tools like Spectrum (https://github.com/arohner/spectrum). I think Eastwood can help here already now (https://github.com/jonase/eastwood).
@ikitommi I am using s/maybe
, for example s/maybe IpAddress
.... however some of my data contains invalid IpAddress
.... and I want to return in that case nil
.... I was wondering if I can do it with coercion
@abarylko I think you can. You can add a matcher that matches for IpAddress
and does custom validation for it.
You have to compose a matcher with your matcher + json-matcher. something like this:
it’s a coercion
thing. strips out extra keys. but it was just to demonstrate how to compose matchers. c-api coercion
takas a matcher, so you can use that in there.