This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2017-08-27
Channels
- # beginners (80)
- # boot (5)
- # cider (4)
- # cljsrn (3)
- # clojure (83)
- # clojure-russia (1)
- # clojure-spec (15)
- # clojurescript (20)
- # community-development (8)
- # cursive (6)
- # emacs (5)
- # fulcro (14)
- # hoplon (71)
- # off-topic (6)
- # om (2)
- # onyx (33)
- # parinfer (3)
- # re-frame (21)
- # reagent (20)
- # spacemacs (2)
- # specter (4)
- # vim (8)
Hi! Is there a way to get only the keys specified in a spec (req and opt) and nothing else after validating a map? And to do so with nested maps too?
Hi. The s/conformer
seems to take the optional unf
function as a second argument for unforming. It defaults to nil
currently. Would an identity
be a better default?
yes, it would still fail by giving you the wrong result
given that conformers are used to transform the input, using identity is virtually always as wrong as nil. much better to fail and tell you how to fix imo
(require '[clojure.spec.alpha :as s])
(s/def ::spec (s/conformer str))
(s/conform ::spec 1)
; => "1"
(s/unform ::spec (s/conform ::spec 1))
; CompilerException java.lang.IllegalStateException: no unform fn for conformer
@U5ZAJ15P0 I am, one of developers of the lib.
@U055NJ5CC Hi! I wanted to ask if there is a utility function to walk a (deeply nested) map together with its associated spec
I just realised it’s precisely what has been discussed here https://github.com/metosin/spec-tools/issues/65
@U5ZAJ15P0 Not yet. Just commented on the issue. If you have ideas, please share them on the issue. Contributions welcome too