Hello:

I ran into an issue where I can't conform (or anything else) to a schema 
which contains "aliased" specs:

(ns foo)
=> nil
(require '[clojure.alpha.spec :as s]
 '[clojure.alpha.spec.gen :as gen])
=> nil
(s/def ::id int?)
=> :foo/id
(s/def ::tag-id ::id)
=> :foo/tag-id
(s/def ::child-tag ::tag-id)
=> :foo/child-tag
(s/conform ::child-tag 22)
=> 22
(s/conform ::child-tag "a")
=> :clojure.alpha.spec/invalid
(s/conform (s/schema [::child-tag]) {::child-tag 22})
Execution error (IllegalArgumentException) at 
clojure.alpha.spec.protocols/eval1458$fn$G 
(protocols.clj:11).
No implementation of method: :conform* of protocol: 
#'clojure.alpha.spec.protocols/Spec 
found for class: clojure.lang.Keyword
(s/conform (s/schema [::tag-id]) {::tag-id 22})
Execution error (IllegalArgumentException) at 
clojure.alpha.spec.protocols/eval1458$fn$G 
(protocols.clj:11).
No implementation of method: :conform* of protocol: 
#'clojure.alpha.spec.protocols/Spec 
found for class: clojure.lang.Keyword
(s/conform (s/schema [::id]) {::id 22})
=> #:foo{:id 22}

Notice I have created a kind of spec alias chain.

I'm not sure what the problem is since I can conform values to the 
alias-of-alias specs, but once I use them in a schema, conformance doesn't 
work.

Thanks for taking a look.

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/clojure/aa554d30-b170-434d-98c8-57c8a44d6aed%40googlegroups.com.

Reply via email to