Skip to content

Commit

Permalink
Support URI format (dottxt-ai#129)
Browse files Browse the repository at this point in the history
Adds URI parsing code and tests

Refer dottxt-ai#127
  • Loading branch information
sky-2002 authored and torymur committed Dec 20, 2024
1 parent 50a84a0 commit 792ddb1
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions src/json_schema/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -918,6 +918,25 @@ mod tests {
"[email protected]", // double dot in domain name
"[email protected]", // multiple errors in domain
"[email protected]", // 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
],
),
] {
Expand Down

0 comments on commit 792ddb1

Please sign in to comment.