Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## [Unreleased]
### Changed
- ci: Run workflows against 5.x.x branches ([#859](https://github.com/jsonrainbow/json-schema/pull/859))
### Fixed
- UriValidator: Allow `file:/` and `file:///` ([#856](https://github.com/jsonrainbow/json-schema/discussions/856))

## [6.6.3] - 2025-12-02
### Changed
Expand Down
2 changes: 1 addition & 1 deletion src/JsonSchema/Tool/Validator/UriValidator.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ public static function isValid(string $uri): bool

// RFC 3986: Non-Hierarchical URIs (mailto, data, urn, news)
$nonHierarchicalPattern = '/^
(mailto|data|urn|news|tel): # Only allow known non-hierarchical schemes
(mailto|data|urn|news|tel|file): # Only allow known non-hierarchical schemes
(.+) # Must contain at least one character after scheme
$/ix';

Expand Down
3 changes: 3 additions & 0 deletions tests/Tool/Validator/UriValidatorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,9 @@ public function validUriDataProvider(): \Generator
yield 'OASIS URN URI' => ['uri' => 'urn:oasis:names:specification:docbook:dtd:xml:4.1.2'];
yield 'Custom URI with underscore' => ['uri' => 'custom://reg_name/path/file.json'];
yield 'Custom URI with tilde' => ['uri' => 'custom://reg~name/path/file.json'];
yield 'File URI with implicit localhost (empty host)' => ['uri' => 'file:///path/to/file.txt'];
yield 'File URI with explicit host' => ['uri' => 'file://some-host/path/to/file.txt'];
yield 'File URI without any host' => ['uri' => 'file:/path/to/file.txt'];
}

public function invalidUriDataProvider(): \Generator
Expand Down