| 1 | use schemars::JsonSchema; |
| 2 | |
| 3 | #[derive(JsonSchema)] |
| 4 | #[validate(email)] |
| 5 | pub struct Struct1(#[validate(regex, foo, length(min = 1, equal = 2, bar))] String); |
| 6 | |
| 7 | #[derive(JsonSchema)] |
| 8 | #[schemars(email)] |
| 9 | pub struct Struct2(#[schemars(regex, foo, length(min = 1, equal = 2, bar))] String); |
| 10 | |
| 11 | #[derive(JsonSchema)] |
| 12 | pub struct Struct3( |
| 13 | #[validate( |
| 14 | regex = "foo", |
| 15 | contains = "bar", |
| 16 | regex(pattern = "baz"), |
| 17 | regex(path = "baz"), |
| 18 | phone, |
| 19 | email, |
| 20 | url |
| 21 | )] |
| 22 | String, |
| 23 | ); |
| 24 | |
| 25 | #[derive(JsonSchema)] |
| 26 | pub struct Struct4( |
| 27 | #[schemars( |
| 28 | regex = "foo", |
| 29 | contains = "bar", |
| 30 | regex(path = "baz"), |
| 31 | regex(pattern = "baz"), |
| 32 | phone, |
| 33 | email(code = "code_str", message = "message"), |
| 34 | email = "foo", |
| 35 | email, |
| 36 | email, |
| 37 | url |
| 38 | )] |
| 39 | String, |
| 40 | ); |
| 41 | |
| 42 | fn main() {} |