exoscale / coax

Clojure.spec coercion library for clj(s)
Other
118 stars 4 forks source link

Unexpected results in the new closed map feature #29

Closed jmayaalv closed 10 months ago

jmayaalv commented 10 months ago

Version: 1.0.2 The new closed map feature seems to be failing in the following case:

(s/def :a/foo string?)
(s/def :a/bar string?)
(s/def :a/z string?)
(s/def :a/m (s/keys :req-un [:a/foo :a/bar]))

(exoscale.coax/coerce :a/m {:foo "f" :bar "b" :baz "z"} {:closed true})  
=>  {:foo "f", :bar "b", :baz "z"} ;; :baz not removed 

However this works as expected

(s/def :a/foo string?)
(s/def :a/bar string?)
(s/def :a/z string?)
(s/def ::m (s/keys :req-un [:a/foo :a/bar]))

(exoscale.coax/coerce ::m {:foo "f" :bar "b" :baz "z"} {:closed true})  
=> {:foo "f", :bar "b"} ;; :baz is removed 
jmayaalv commented 10 months ago

Sorry, there was a problem on my environment that was causing the issue. Everything working as expected :) Thanks a lot

mpenet commented 10 months ago

That was a caching issue I guess? It’s easy to forget about it. The readme mentions ways to circumvent it while developing.

jmayaalv commented 10 months ago

Correct, it was a caching issue. :( Would it be worthy to have a (exoscale.coax/set-no-cache!)or something like that so that there is no need to worry about the cache during development?

Anyway, thank you for the response, all the libs and work in Clojure. happy new year!