Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion book/src/SUMMARY.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
- [Email](./validations/email.md)
- [Length](./validations/length.md)
- [Regex]()
- [URL]()
- [URL](./validations/url.md)
- [Integrations]()
- [Serde]()
- [Utoipa]()
Expand Down
1 change: 1 addition & 0 deletions book/src/validations/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@

- [Email](./email.md)
- [Length](./length.md)
- [URL](./url.md)
2 changes: 1 addition & 1 deletion book/src/validations/email.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ Validate the string is an RFC-compliant email address.

Validate the value is an RFC-compliant email address.

An `EmailAddress` can be constructed using [`EmailAddress::new_unchecked`](https://docs.rs/email_address/latest/email_address/struct.EmailAddress.html#method.new_unchecked) or with different options passed to [`EmailAddress::parse_with_options`](https://docs.rs/email_address/latest/email_address/struct.EmailAddress.html#method.parse_with_options), so it has to be re-validated.
An `EmailAddress` can be constructed using [`EmailAddress::new_unchecked`](https://docs.rs/email_address/latest/email_address/struct.EmailAddress.html#method.new_unchecked) or with different options passed to [`EmailAddress::parse_with_options`](https://docs.rs/email_address/latest/email_address/struct.EmailAddress.html#method.parse_with_options), so re-validation is required.

## Options

Expand Down
34 changes: 34 additions & 0 deletions book/src/validations/url.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# URL

> [!NOTE]
> Requires the `url` feature.

Validate a string is a specification-compliant URL using the [`url`](https://docs.rs/url/latest/url/) crate.

```rust
# extern crate fortifier;
# use fortifier::Validate;
#
##[derive(Validate)]
struct User {
#[validate(url)]
url: String
}
```

## Types

### String

- [`str`](https://doc.rust-lang.org/std/primitive.str.html)
- [`String`](https://doc.rust-lang.org/std/string/struct.String.html)

Validate the string is a specification-compliant URL.

### URL

- [`Url`](https://docs.rs/url/latest/url/struct.Url.html)

Validate the value is a specification-compliant URL.

A `Url` can only be constructed by parsing it, so no re-validation is performed.
3 changes: 3 additions & 0 deletions packages/fortifier-macros/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ license.workspace = true
repository.workspace = true
version.workspace = true

[package.metadata.docs.rs]
all-features = true

[lib]
proc-macro = true

Expand Down
3 changes: 3 additions & 0 deletions packages/fortifier/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ license.workspace = true
repository.workspace = true
version.workspace = true

[package.metadata.docs.rs]
all-features = true

[features]
default = ["macros"]
all-validations = ["email", "regex", "url"]
Expand Down
Loading