-
-
Notifications
You must be signed in to change notification settings - Fork 209
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
test a malformed pattern #386
Draft
karenetheridge
wants to merge
1
commit into
main
Choose a base branch
from
ether/malformed-pattern
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For drafts pre-2019-09 this is (potentially) incorrect I think -- it depends whether the metaschema it's run under is validating formats or treating them as annotations or whatever. So for those this'd need to go in optional. For 2019-09 I don't remember what changed -- do you enable format via a vocabulary and then it has to be respected, or what?
(Also this is invalid JSON but probably you'll notice that part)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not assuming/expecting the metaschema to use a format validation. Even if no validation is done on the schema at all, it should still return a non-valid result at runtime.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
invalid json fixed -- and the test suite is now happy, so it looks like the json was just parsing badly before.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That may not be the case. An implementation is free to blow up entirely in this case if you give it an invalid schema and it isn't validating it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(i.e. it's valid for the result here to be "my validator blows up" rather than returning invalid)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As well, assuming that “valid=false” for failed schemas changes the meaning of “valid” for the tests in that suite. It’s also bad practice to have meanings of fields change depending on other variables.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perhaps there should be another flag to indicate invalid schemas (apart from
valid: false
on tests), perhaps in a separate directory/subdir, where the impl is free to blow up on schema compilation (like it should imo)?That would be different from
valid: false
, as the impl can either follow this and return false, because none strings match invalid pattern, or it can as well reject the schema alltogehter which should also be a valid behavior. Per schema,pattern
should be aregex
, and this is not a regex.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, we've been discussing this across a few different PRs and in slack. There hasn't been any consensus yet as to how to declare this in tests (with an extra flag? a new directory under optional/? both of these?) or how to document how implementations should deal with it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I want to merge the outstanding PRs on tests in the "normal" category before addressing this. I.e. #354 and the PRs being split off of it. Let's get those merged, then we can hit cases that may require a structural change. Could definitely use more eyes reviewing those PRs so we can get them off the queue.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
FWIW, my implementation gives an (arguably incorrect) error, but doesn't blow up:
(Interestingly, .Net doesn't think this is an invalid pattern.)
I think this is one of the things I had to account for in some other regex test where .Net didn't support something. I switch from deserializing the regex directly to just deserializing a string and lazily parsing the regex.