From 792ddb17205662d600b06f44518b7e7236423012 Mon Sep 17 00:00:00 2001 From: Aakash Thatte <84656834+sky-2002@users.noreply.github.com> Date: Thu, 19 Dec 2024 22:34:49 +0530 Subject: [PATCH] Support URI format (#129) Adds URI parsing code and tests Refer #127 --- src/json_schema/mod.rs | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/src/json_schema/mod.rs b/src/json_schema/mod.rs index e4d6f3b..1b586b6 100644 --- a/src/json_schema/mod.rs +++ b/src/json_schema/mod.rs @@ -918,6 +918,25 @@ mod tests { "username@example..com", // double dot in domain name "username@.example..com", // multiple errors in domain "username@123.123.123.12345", // invalid IP format + ] + ), + // ========================================================== + // URI Format + // ========================================================== + ( + r#"{"title": "Foo", "type": "string", "format": "uri"}"#, + URI, + vec![ + "http://example.com", + "https://example.com/path?query=param#fragment", + "ftp://ftp.example.com/resource", + "urn:isbn:0451450523", + ], + vec![ + "http:/example.com", // missing slash + "htp://example.com", // invalid scheme + "http://", // missing host + "example.com", // missing scheme ], ), ] {