Description
I would like to propose having the error logging on the constraints checkers optionaly store a value called "element" that shows the actual value that failed the constraint, this would be valuable in understanding the violations. this could be linked to a constraints::[option] to turn it on and off.
for example
changing line 52 in the enumconstraints.php from
$this->addError($path, 'Does not have a value in the enumeration ' . json_encode($schema->enum), 'enum', array('enum' => $schema->enum));
to:
$this->addError($path, 'Does not have a value in the enumeration ' . json_encode($schema->enum), 'enum', array('enum' => $schema->enum, 'element'=>$element));
would meet this requirement, i'm sure there are lots of other places in the other constraints checkers where this would make sense.
There is one hazard, if the $element is itself the root of a large subtree it could bloat things on the output, in particular if the violation is detected on the root of the document being validated. requiredConstraint already displays the name of the violating element as does many other constraint checkers.