Skip to content

Commit

Permalink
docs: update validify examples in README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
gengteng committed Jan 6, 2024
1 parent 27acfec commit 7d2bf69
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -164,9 +164,10 @@ use axum_valid::{Modified, Validated, Validified, ValidifiedByRef};
use serde::Deserialize;
use std::net::SocketAddr;
use tokio::net::TcpListener;
use validify::{Validate, Validify};
use validify::{Payload, Validate, Validify};
#[derive(Debug, Validify, Deserialize)]
// Payload is required.(Added in validify 1.3.0)
#[derive(Debug, Validify, Deserialize, Payload)]
pub struct Pager {
#[validate(range(min = 1.0, max = 50.0))]
pub page_size: usize,
Expand All @@ -179,7 +180,8 @@ pub async fn pager_from_query(Validated(Query(pager)): Validated<Query<Pager>>)
assert!((1..).contains(&pager.page_no));
}
#[derive(Debug, Validify, Deserialize)]
// Payload is required.(Added in validify 1.3.0)
#[derive(Debug, Validify, Deserialize, Payload)]
pub struct Parameters {
#[modify(lowercase)]
#[validate(length(min = 1, max = 50))]
Expand Down

0 comments on commit 7d2bf69

Please sign in to comment.