Skip to content

Conversation

krishnaprasadmg
Copy link

Same as #91 the property names are missing in errors for draft 3 schema

Same as #91 the property names are missing in errors for draft 3 schema
@erayd
Copy link
Contributor

erayd commented Jun 1, 2017

Well spotted :-).

Please change the base branch for this PR to 6.0.0-dev, and use the new error handler.

// 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');
$this->addError($path, "The property " . $schema->name . " is required", 'required');
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

$schema->name does not exist, and causes test failures.
Noting this is the draft-03 boolean require you have added this for, the property name will not be available via $schema - you will need to obtain it from elsewhere.

Copy link
Contributor

@erayd erayd left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please change the base branch for this PR to be 6.0.0-dev.

Changes are no longer being merged directly to master, as we are preparing for the 6.0.0-release. If a change is applicable to 5.x.x (which yours is), then it will be backported after merging to 6.0.0-dev.

if ($schema->required && $value instanceof self) {
$this->addError($path, 'Is missing and it is required', 'required');
$propertyName = current($path->getPropertyPaths());
$this->addError($path, "The property " . $propertyName . " is required", 'required');
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Per my previous comments, please alter this line to use the new error handler. The syntax you are currently using is deprecated and from 6.0.0 is no longer supported.

@krishnaprasadmg
Copy link
Author

Sorry for the confusion, I've created a new PR, I'll close this. Thank you for looking into this!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants