Fork me on GitHub
#clojure-spec
<
2017-03-29
>
mattly00:03:13

weird, I can't reproduce it in the repl

mattly00:03:44

it's definitely happening in the call to conform though

mattly00:03:08

upgrading from alpha14 to 15 made it go away

alex.ter.weele15:03:21

What’s the easiest way to make a spec that matches {:a 1 :b 1}, {:a 1}, and {:b 1}, but not {}?

bronsa15:03:59

(s/keys :req-un [(or ::a ::b)])

alex.ter.weele15:03:09

is that regular or or spec/or?

bronsa15:03:49

it's s/keys syntax that expands to clojure.core/or

alex.ter.weele15:03:24

ok, I got it. Thanks!

manderson17:03:27

Is there a way to provide more detailed explain output for a custom conformer? In alpha15 I get a message like: val: "k" fails predicate: (conformer conform-int). I see I can supply an optional "unform", but no arity to supply an "explain"...

bja17:03:38

is there a way to turn off fdef validation for defn temporarily in -alpha14? I'm seeing a failure in a third party lib that works in another project.clj so I think I'm having classpath issues and I need to load the namespace so I can interogate some objects via the classloader

hospadar17:03:27

@manderson you can implement the Spec protocol to provide a custom explainer

hospadar17:03:56

word on the street is that the protocol may be changed in the long run

hospadar17:03:03

but for now it works fine

hospadar17:03:48

if you look at the Spec implementations included in the lib (that are used for keys and tuples, etc) you can get an idea of what kind of output they return

hospadar17:03:20

if errors, return a list of errors (like what you get from explain-data), otherwise return empty list/nothing

hospadar17:03:51

that example assumes you don't want to do any special conformation

manderson17:03:35

Gotcha, thanks @hospadar. Figured that might be the only way, but was hoping for a "published" approach instead of looking behind the curtain. I'll give that a try.

hospadar18:03:01

yeah I feel that

Alex Miller (Clojure team)20:03:04

@bja you can s/def your own spec over the top of the standard one

bja22:03:40

@alexmiller thanks. that's what I eventually settled on

bja22:03:26

found out that I had a conflict with an older version of potemkin generating non-conforming functions.