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

Allow format checkers to raise custom ValidationErrors #71

Closed

Conversation

gazpachoking
Copy link
Contributor

Well, this is my simplest solution for #70. Let me know if you have some other idea in mind.

@gazpachoking
Copy link
Contributor Author

I guess that test is a bit shit, since it would pass before the changes, let me fix that.

@Julian
Copy link
Member

Julian commented Feb 28, 2013

I don't like using ValidationError as the thing checkers raise. Maybe an
API like:

FormatChecker.checks("ipv4", raises=socket.error)(socket.inet_pton)

works for your use case?

Then in validate_format do except raises: and convert to a
ValidationError.

Does that sound reasonable to you?
On Feb 27, 2013 7:17 PM, "Chase Sterling" notifications@github.com wrote:

I guess that test is a bit shit, since it would pass before the changes,
let me fix that.


Reply to this email directly or view it on GitHubhttps://github.com//pull/71#issuecomment-14209035
.

@gazpachoking
Copy link
Contributor Author

Hmm, that does sound better. No need to raise a custom error if your checker would already raise one then either. I'll make a new PR

@gazpachoking gazpachoking deleted the format_errors branch February 28, 2013 00:26
Julian added a commit that referenced this pull request Mar 22, 2015
0b657e8 Merge pull request #86 from kylef/patch-1
1bd4151 [README] JSONSchema.swift uses these tests too
8f86716 Revert "Add jon, JSON parser for the fishshell."
db9c629 Merge pull request #82 from bucaran/patch-1
875fa42 Add jon, JSON parser for the fishshell.
64c556c Merge pull request #81 from s-panferov/patch-1
43105d4 Add new Rust library to the list
aa4d927 Merge pull request #80 from seagreen/implementations
20ef067 Add new haskell implementation.
1274070 Merge pull request #79 from Muscula/json-schema-benchmark
6d8cf45 Merge pull request #78 from JamesNK/patch-1
55c4992 Add json-schema-benchmark to list of users of this test suite
645623d Added Newtonsoft.Json.Schema implementation
a7944d1 Merge pull request #76 from Prestaul/patch-1
5729cdf Added skeemas to list of suite users
4600fe3 Make the implementation list a bit less unwieldy now that it's so long (hooray!)
11d6905 Merge remote-tracking branch 'mafintosh/patch-1' into develop
689b80f Merge pull request #74 from bugventure/develop
c36f888 Add request-validator as a user of the test suite
41876b1 Update README.md
aabcb34 Merge pull request #71 from seagreen/additionalproperties
b3d160b Add tests for additionalProperties by itself.

git-subtree-dir: json
git-subtree-split: 0b657e8b0d21a4099d3ce378ba7208073a9295e6
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.

None yet

2 participants