Fork me on GitHub
#clojure-spec
<
2017-05-16
>
zane00:05:27

That the incoming values will be in that set when conformed, and that strings will be conformed to keywords.

zane00:05:03

I'm trying to make my example more DRY.

Alex Miller (Clojure team)00:05:45

(def vs #{:some :specific :values}) (s/def ::example (into vs (map name) vs))

Alex Miller (Clojure team)00:05:33

That doesn't conform to keywords but transformation is not really the point of spec

odinodin06:05:59

does anyone know of any efforts that present clojure spec validation errors in a nice way? I’m looking for ideas and inspiration for a web based error message component I’m working on

rmuslimov07:05:06

@odinodin just spent some time looking into the same issue, found this https://www.slideshare.net/alexanderkiel/form-validation-with-clojure-spec and can recommend this approach

odinodin07:05:03

@rmuslimov thanks. I was thinking more about how to present raw clojure.spec validation errors in a nicer way during development

rmuslimov07:05:24

ah ok, interesting. Not sure how standard can be improved, may be you already have any ideas - how it may look like?

odinodin07:05:16

Just started digging, not sure where it will lead yet

urbank11:05:20

why has cljs.spec been renamed to cljs.spec.alpha?

curlyfry13:05:47

Any news on https://dev.clojure.org/jira/browse/CLJ-2123 or something similar? Having some issues right now with name clashes on specs (that we still want in the same file). We're specing a re-frame db and want to keep the specs for a specific page in the same file. Often parts of specs for input field and similar end up having the same names as other parts of the state. The solution right now is either to create an artificial and verbose namespaced keyword (:my-page.input.domain/id) or to add a new file just for the clashing specs.

stathissideris13:05:28

@curlyfry in a similar vein: when you refactor clashing keywords to have different namespaces, does the rename mean that you get rippling changes throughout your code?

pseud14:05:07

I've got a map where all entries should follow some template (e.g. (s/map-of string? number?) except one optional key, let's call it :foo. I tried something like s/merge, but it seems like it was designed with multiple s/keys specs in mind. (s/merge (s/map-of string? number?) (s/keys :opt-un [::foo])). I can of course write my own predicate function to split the map in two and check against each spec with s/valid?, but I'll lose a lot of contextual information in case of failures. Is there no better way ?

Alex Miller (Clojure team)15:05:13

yours is a bit simpler than the one described there

pseud16:05:15

@alexmiller cool, a bit too tired to digest, but bookmarked.

grierson18:05:42

Hey, does (s/exercise) work with CLJS?

grierson19:05:17

do I need to import anything else apart from cljs.spec?

grierson19:05:06

Fixed it. Need to import [clojure.test.check.generators]. I was only using Spacemacs inline eval I wasn’t looking at the REPL.