diff --git a/src/JsonSchema/Constraints/UndefinedConstraint.php b/src/JsonSchema/Constraints/UndefinedConstraint.php index a86afcac..c0606ff9 100644 --- a/src/JsonSchema/Constraints/UndefinedConstraint.php +++ b/src/JsonSchema/Constraints/UndefinedConstraint.php @@ -142,7 +142,13 @@ protected function validateCommonProperties(&$value, $schema = null, JsonPointer } elseif (isset($schema->required) && !is_array($schema->required)) { // Draft 3 - Required attribute - e.g. "foo": {"type": "string", "required": true} if ($schema->required && $value instanceof self) { - $this->addError($path, 'Is missing and it is required', 'required'); + $propertyPaths = $path->getPropertyPaths(); + $propertyName = end($propertyPaths); + $this->addError( + $path, + 'The property ' . $propertyName . ' is required', + 'required' + ); } } }