tamasfe/aide

How to define min / max for ints/numbers Query params?

itsbalamurali opened this issue · 2 comments

How to define min / max for ints/numbers Query params?

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?