Skip to content
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

Fix constraint errors getter #98

Merged

Conversation

alexmmm
Copy link
Contributor

@alexmmm alexmmm commented May 1, 2014

This request removes unexpected behaviour from the Constraint::getErrors method and fixes #97:

There is validation logic that depends on error state and determines the failure of more complex validation processes by comparing error counts before and after. If getErrors removes information from error state such logic may fail.

Issue #97 illustrates such a circumstance, see added unit tests.

alexmmm added 3 commits May 1, 2014 15:40
- remove presentation logic from implementation and dont filter returned errors by array_unique, business logic requires getErrors to return all existing errors, even if it contains duplicates
- make Validator::getErrors() return the same filtered result as before and apply array_unique when setting errors on Validator instance
@alexmmm
Copy link
Contributor Author

alexmmm commented May 1, 2014

Issue #76 shows another example where validation logic actually failed and points out that getErrors is the source of the issue.

Issue #76 was fixed by pull request #95 by means of a workaround that avoids the original problematic call to getErrors.

@alexmmm
Copy link
Contributor Author

alexmmm commented May 1, 2014

Added unit test to validate issue #76, 0c39a5b

Test fails for 1.3.5

@bighappyface
Copy link
Collaborator

👍

justinrainbow added a commit that referenced this pull request Aug 25, 2014
@justinrainbow justinrainbow merged commit 04fed36 into jsonrainbow:master Aug 25, 2014
hakre pushed a commit to hakre/json-schema that referenced this pull request Mar 26, 2015
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.

Doesn't catch invalid null field when field uses anyOf with a regex
3 participants