How to define min / max for ints/numbers Query params?
itsbalamurali opened this issue · 2 comments
itsbalamurali commented
How to define min / max for ints/numbers Query params?
y-haidar commented
As far as I have tested/read, schemars::JsonSchema
have a #[validate(...)]
attribute that matches validator::Validate
, from the validator crate.
#[derive(JsonSchema)]
struct Example {
#[validate(length(min = 5))]
field: String,
#[validate(range(min = 18, max = 20))]
number: u32,
}
Was this what you needed?
itsbalamurali commented
Thanks @y-haidar !