bigmlcom/closchema — pull request #13 by charleslparker (2012-07-20 18:19:50+00:00)
Title: Better Errors

This gives us nicer error messages for union types. Basically, you get the `:instance` that failed along with the `:errors` for the thing in the union that came closest to matching (on a number-of-errors basis).

Here's a sample:

```none
2012-07-20 17:35:09,202 WARN wintermute.rest.client - JSON validation error for :dataset:
({:key :matches-no-type-in-union, :ref nil,
:data {:instance {:preferred true, :summary {:median 27.16667, :minimum 0, :sum_squares 153720, :missing_count 0, :bins [[0.5 4] [2.5 4] [4.5 4] [6.5 4] [8.5 4] [10.6 5] [12.5 6] [14.5 6] [16.5 6] [18.5 6] [20.5 6] [22.5 6] [24.5 6] [26.5 6] [28.5 6] [30.5 6] [32.5 6] [34.4 5] [36.5 4] [38.5 4] [40.5 4] [42.5 4] [44.5 4] [46.5 4] [48.5 4] [50.5 4] [52.5 4] [54.5 4] [56 2] [57 2] [58 2] [59 2]], :sum 4080, :population 144, :maximum 59, :splits [1.75 4 6.25 8.5 10.64575 12.16667 13.66667 15.16667 16.66667 18.16667 19.66667 21.16667 22.66667 24.16667 25.66667 27.16667 28.66667 30.16667 31.66667 33.16667 34.76393 37 39.25 41.5 43.75 46 48.25 50.5 52.75 55 57.25]}, :optype "numeric", :datatype "minute", :parent_ids ["000001"], :auto_generated true, :name "field2 (minute)"},
:errors ({:key :value-not-in-enum, :ref nil, :data {:enum ["integer" "int8" "int16" "int32" "int64" "float" "double" "day" "month" "year" "hour" "sec" "milli" "day-of-week" "day-of-month"], :value "minute"}, :path [nil]})}, :path [nil]})
```