Skip to content

Commit bd662b5

Browse files
feat: add url validation
1 parent 40a1b1e commit bd662b5

9 files changed

Lines changed: 412 additions & 3 deletions

File tree

Cargo.lock

Lines changed: 279 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

example/src/main.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,16 @@ struct CreateUser {
99

1010
#[validate(length(min = 1, max = 256))]
1111
name: String,
12+
13+
#[validate(url)]
14+
url: String,
1215
}
1316

1417
fn main() -> Result<(), Box<dyn Error>> {
1518
let data = CreateUser {
1619
email: "john@doe.com".to_owned(),
1720
name: "John Doe".to_owned(),
21+
url: "https://john.doe.com".to_owned(),
1822
};
1923

2024
data.validate_sync()?;

0 commit comments

Comments
 (0)