cddr / integrity

tools for operating on schemas
https://github.com/cddr/integrity
Eclipse Public License 1.0
68 stars 8 forks source link

human-explain doesn't work with "complex" schemas #9

Closed mpenet closed 10 years ago

mpenet commented 10 years ago

human-explain now only works with simple schema types. If you try to use it against a schema such as {:a String} it will fail as the protocol doesn't dispatch on maps.

It's probably possible to just extend the protocol to collection types and recur until we find valid dispatch values.

cddr commented 10 years ago

Sorry about the delay in replying.

So given that (human-explain (check Str) 42) returns "42 is not a java.lang.String", what do you think should be returned then by something like (human-explain (check {:name Str} {:name 42})?

I'm thinking it should be {:name "is not a java.lang.String}

cddr commented 10 years ago

37d8e77ff489cf475063994175dca941a50f1764 ensures that map schemas can be human-explained. Hope this is what you were after. Please re-open if you have an example of a schema still not supported.