Skip to content

Commit

Permalink
Revert "update parsing for uri"
Browse files Browse the repository at this point in the history
This reverts commit dc14a22.
  • Loading branch information
sky-2002 committed Dec 19, 2024
1 parent 9926d02 commit 113d06e
Showing 1 changed file with 5 additions and 10 deletions.
15 changes: 5 additions & 10 deletions src/json_schema/parsing.rs
Original file line number Diff line number Diff line change
Expand Up @@ -377,16 +377,11 @@ impl<'a> Parser<'a> {
Ok(format!(r#"("{}")"#, pattern))
}
} else if let Some(format) = obj.get("format").and_then(Value::as_str) {
if format == "uri" {
let uri_regex = r"^(https?|ftp):\/\/([^\s:@]+(:[^\s:@]*)?@)?([a-zA-Z\d.-]+\.[a-zA-Z]{2,}|localhost)(:\d+)?(\/[^\s?#]*)?(\?[^\s#]*)?(#[^\s]*)?$|^urn:[a-zA-Z\d][a-zA-Z\d\-]{0,31}:[^\s]+$";
Ok(uri_regex.to_string())
} else {
match types::FormatType::from_str(format) {
Some(format_type) => Ok(format_type.to_regex().to_string()),
None => Err(JsonSchemaParserError::StringTypeUnsupportedFormat(
Box::from(format),
)),
}
match types::FormatType::from_str(format) {
Some(format_type) => Ok(format_type.to_regex().to_string()),
None => Err(JsonSchemaParserError::StringTypeUnsupportedFormat(
Box::from(format),
)),
}
} else {
Ok(types::JsonType::String.to_regex().to_string())
Expand Down

0 comments on commit 113d06e

Please sign in to comment.