Skip to content

Fix a case of 2 invalid oneOf were considered valid #95

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Mar 3, 2014

Conversation

gwagner
Copy link
Contributor

@gwagner gwagner commented Feb 25, 2014

  • When using oneOf, one of the schemas should be considered valid for things to be successful. The old logic would take a schema (that could have had an error) and evaluate against a clean object that could have also contained an error (meaning the logic would assume no error existed)

* When using oneOf, one of the schemas should be considered valid for things to be successful.  The old logic would take a schema (that could have had an error) and evaluate against a clean object that could have also contained an error (meaning the logic would assume no error existed)
$matchedSchemas = 0;
$startErrors = $this->getErrors();
foreach ($schema->oneOf as $oneOf) {
$initErrors = $this->getErrors();
$this->errors = [];
Copy link
Collaborator

Choose a reason for hiding this comment

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

Could you change the [] to array() for PHP 5.3 support?

Fix the php < 5.4 compatability
@gwagner
Copy link
Contributor Author

gwagner commented Mar 3, 2014

Should now be fixed, i thought i had updated all of those

@@ -230,17 +230,28 @@ protected function validateOfProperties($value, $schema, $path, $i = "")
}

if (isset($schema->oneOf)) {
$allErrors = [];
Copy link
Collaborator

Choose a reason for hiding this comment

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

Sorry, didn't catch this one before. Could you change this to array(), too? Then we should be all good for merge.

Doh, missed another php < 5.4 compatibility bug
justinrainbow added a commit that referenced this pull request Mar 3, 2014
Fix a case of 2 invalid oneOf were considered valid
@justinrainbow justinrainbow merged commit cb428b3 into jsonrainbow:master Mar 3, 2014
hakre pushed a commit to hakre/json-schema that referenced this pull request Mar 26, 2015
Fix a case of 2 invalid oneOf were considered valid
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