isa schema not working correctly for keywords without hierarchy
camsaul opened this issue · 3 comments
Not sure if I'm using this wrong, but it's not working as I'd expect.
(derive :type/Integer :type/Number)
;; -> nil
(isa? :type/Integer :type/Number)
;; -> true
(s/validate (s/isa :type/Number) :type/Integer)
;; -> ExceptionInfo Value does not match schema: (throws? (isa? :type/Integer :type/Number)) schema.core/validator/fn--8446 (core.clj:155)
I can work around it using pred
, so it's not a deal-breaker.
(s/validate (s/pred #(isa? % :type/Number)) :type/Integer)
;; -> :type/Integer
Yes, seems like this is a problem with isa
and the default hierarchy --
thanks for the report. Since global-hierarchy
is private, I guess the
best solution is probably to avoid referencing it and passing the
precondition directly into Isa. PR welcome!
On Wed, Sep 7, 2016 at 10:30 PM, Cam Saül notifications@github.com wrote:
Not sure if I'm using this wrong, but it's not working as I'd expect.
(derive :type/Integer :type/Number) ;; -> nil
(isa? :type/Integer :type/Number);; -> true
(s/validate (s/isa :type/Number) :type/Integer);; -> ExceptionInfo Value does not match schema: (throws? (isa? :type/Integer :type/Number)) schema.core/validator/fn--8446 (core.clj:155)
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
#369, or mute the thread
https://github.com/notifications/unsubscribe-auth/AAIPphuoXxDKtTB3Q7aiWxyEMUWUHBJjks5qnx74gaJpZM4J3Utq
.
Makes sense. I'll try to submit a PR for this when I get a chance
Great, thanks!