[spec] Better explain reporting on a failed zero or one match with an embedded spec.

Description

Problem:

When attempting to validate a vector containing an optional map, the spec will validate correctly if the vector contains a valid map. If however the optional map does not satisfy the spec misleading error messages are produced. It would be nice if on a partial match of an optional map that some indication of this would be given to the user.

Example REPL session to illustrate problem:

The optional nested map (:optional-nested-map) below fails validation because :nested-element-b is a string instead of an int however the explain report says the spec fails at the parent predicate: :user/vector-schema at: [:element-value] predicate: string?.

It would be more helpful for the user in this case if spec reported that the optional nested map at :optional-nested-map had failed due to ::nested-element-b failing the int? predicate.

Environment

OSX, Java 8, Clojure 1.9.0-alpha10

Assignee

Unassigned

Reporter

nick.jones

Labels

Approval

Triaged

Patch

None

Affects versions

Priority

Minor
Configure