From 542dc57ac7c956ae73636e807e51164e6c9bbbf3 Mon Sep 17 00:00:00 2001 From: Dave Long Date: Fri, 28 Nov 2025 11:10:26 +0000 Subject: [PATCH 1/4] Allow more characters in URIs. --- src/JsonSchema/Tool/Validator/UriValidator.php | 2 +- tests/Tool/Validator/UriValidatorTest.php | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/src/JsonSchema/Tool/Validator/UriValidator.php b/src/JsonSchema/Tool/Validator/UriValidator.php index b761f91f..c5e2cf6e 100644 --- a/src/JsonSchema/Tool/Validator/UriValidator.php +++ b/src/JsonSchema/Tool/Validator/UriValidator.php @@ -12,7 +12,7 @@ public static function isValid(string $uri): bool $hierarchicalPattern = '/^ ([a-z][a-z0-9+\-.]*):\/\/ # Scheme (http, https, ftp, etc.) (?:([^:@\/?#]+)(?::([^@\/?#]*))?@)? # Optional userinfo (user:pass@) - ([a-z0-9.-]+|\[[a-f0-9:.]+\]) # Hostname or IPv6 in brackets + ([a-z0-9._~-]+|\[[a-f0-9:.]+\]) # Hostname or IPv6 in brackets (?::(\d{1,5}))? # Optional port (\/[a-zA-Z0-9._~!$&\'()*+,;=:@\/%-]*)* # Path (valid characters only) (\?([^#]*))? # Optional query diff --git a/tests/Tool/Validator/UriValidatorTest.php b/tests/Tool/Validator/UriValidatorTest.php index 13e99b85..41507c84 100644 --- a/tests/Tool/Validator/UriValidatorTest.php +++ b/tests/Tool/Validator/UriValidatorTest.php @@ -32,6 +32,7 @@ public function validUriDataProvider(): \Generator yield 'Data URI' => ['uri' => 'data:text/plain;charset=utf-8,Hello%20World!']; yield 'ISBN URN URI' => ['uri' => 'urn:isbn:0451450523']; yield 'OASIS URN URI' => ['uri' => 'urn:oasis:names:specification:docbook:dtd:xml:4.1.2']; + yield 'Custom URI' => ['uri' => 'custom://reg_name/path/file.json']; } public function invalidUriDataProvider(): \Generator From 7024d29d2b55603c0a2dcdaaa062d7f48b971741 Mon Sep 17 00:00:00 2001 From: Dave Long Date: Fri, 28 Nov 2025 14:57:33 +0000 Subject: [PATCH 2/4] Update tests/Tool/Validator/UriValidatorTest.php Co-authored-by: Danny van der Sluijs --- tests/Tool/Validator/UriValidatorTest.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/Tool/Validator/UriValidatorTest.php b/tests/Tool/Validator/UriValidatorTest.php index 41507c84..7eedaca8 100644 --- a/tests/Tool/Validator/UriValidatorTest.php +++ b/tests/Tool/Validator/UriValidatorTest.php @@ -32,7 +32,8 @@ public function validUriDataProvider(): \Generator yield 'Data URI' => ['uri' => 'data:text/plain;charset=utf-8,Hello%20World!']; yield 'ISBN URN URI' => ['uri' => 'urn:isbn:0451450523']; yield 'OASIS URN URI' => ['uri' => 'urn:oasis:names:specification:docbook:dtd:xml:4.1.2']; - yield 'Custom URI' => ['uri' => 'custom://reg_name/path/file.json']; + yield 'Custom URI with underscore' => ['uri' => 'custom://reg_name/path/file.json']; + yield 'Custom URI with tilde' => ['uri' => 'custom://reg~name/path/file.json']; } public function invalidUriDataProvider(): \Generator From 8ae911199d697107e44439b4001fe0f378ca63ab Mon Sep 17 00:00:00 2001 From: Dave Long Date: Fri, 28 Nov 2025 14:59:26 +0000 Subject: [PATCH 3/4] Update changelog. --- CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 67fffbc7..0f4e8c30 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). ## [Unreleased] +### Fixed +- Allow more characters in URI hostnames as per RFC 3986 ([#853](https://github.com/jsonrainbow/json-schema/pull/853)) ## [6.6.1] - 2025-11-07 ### Changed From e9f35f076f788a72a451ff2c909952d56043f28e Mon Sep 17 00:00:00 2001 From: Dave Long Date: Fri, 28 Nov 2025 15:00:46 +0000 Subject: [PATCH 4/4] Be more specific. --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0f4e8c30..824690ff 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,7 +7,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] ### Fixed -- Allow more characters in URI hostnames as per RFC 3986 ([#853](https://github.com/jsonrainbow/json-schema/pull/853)) +- Allow underscore and tilde in URI hostnames as per RFC 3986 ([#853](https://github.com/jsonrainbow/json-schema/pull/853)) ## [6.6.1] - 2025-11-07 ### Changed