-
-
Notifications
You must be signed in to change notification settings - Fork 366
UriValidator file: tests/fix(es) #858
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
base: main
Are you sure you want to change the base?
Conversation
1cc4b6e to
07afbe1
Compare
- expand uri validator tests - treat file as non-hierarchical
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.
Pull request overview
This pull request attempts to add support for file: URI protocol validation by updating both the test suite and the UriValidator implementation. However, the implementation has a critical architectural flaw: it treats file: URIs as non-hierarchical when they are actually hierarchical URIs according to RFC 8089 and RFC 3986.
Key changes:
- Added three test cases for different file: URI formats (implicit localhost, explicit host, and without host)
- Modified the non-hierarchical URI regex pattern to include
file:scheme - Added a comment acknowledging limitations with regex-only validation
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
| tests/Tool/Validator/UriValidatorTest.php | Adds three valid file: URI test cases and a commented-out invalid case with a note about regex validation limitations |
| src/JsonSchema/Tool/Validator/UriValidator.php | Adds file: to the non-hierarchical URI pattern, incorrectly classifying it as non-hierarchical |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
DannyvdSluijs
left a comment
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.
Thanks for persisting and make a very dense fix for the issues.
I have left one remark to remove the comment case in the invalid data provider.
Finally could you add an entry to the changelog as well that would complete the PR and I can merge and release quickly after.
| // Cannot be validated properly with regex only | ||
| // yield 'Invalid file uri (missing host)' => ['uri' => 'file://path/to/file.txt']; |
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.
Can you remove these lines as I would rather keep commented code out of the repo to keep it clean. Since there is no invalid file uri we can just skip this.
Description
Update tests (and code to follow) for UriValidator
file:protocol.Related Issue
#856
Type of Change
Checklist
Additional Notes