You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
let schema = jsonschema::compile(&json!({"type":"string","format":"ipv4"})).unwrap();println!("{}", schema.is_valid(&json!("0.0.0.0")));
This outputs false, when I would expect true because 0.0.0.0 is a valid dotted-quad representation of an IPv4 address. All other IP addresses starting with 0 (e.g. 0.1.2.3) are similarly rejected.
too loose because it allows leading zeroes in the second/third/fourth octets, e.g. it allows 1.0123.1.1
unnecessary, because Ipv4Addr's FromStr implementation already disallows leading zeros in any octet. Edit: this was only added in rust 1.58 (Reject octal zeros in IPv4 addresses rust-lang/rust#86984), so the explicit check in this crate wasn't unnecessary when it was first implemented!
The text was updated successfully, but these errors were encountered:
Uh oh!
There was an error while loading. Please reload this page.
This outputs
false
, when I would expecttrue
because 0.0.0.0 is a valid dotted-quad representation of an IPv4 address. All other IP addresses starting with 0 (e.g. 0.1.2.3) are similarly rejected.This appears to be due to the fix for json-schema-org/JSON-Schema-Test-Suite#469 (commit 7d32eff), but I think this particular fix is simultaneously:
Ipv4Addr
'sFromStr
implementation already disallows leading zeros in any octet. Edit: this was only added in rust 1.58 (Reject octal zeros in IPv4 addresses rust-lang/rust#86984), so the explicit check in this crate wasn't unnecessary when it was first implemented!The text was updated successfully, but these errors were encountered: