Skip to content

You validate search params and route data with the validation library your project already uses. Navi integrates four of them through mutually exclusive feature flags.

Feature Crate
validator validator
garde garde
validify validify
valico valico

Enable exactly one in your Cargo.toml:

Cargo.toml
[dependencies]
navi-router = { path = "../navi/navi-router", features = ["garde"] }

All four integrations feed the same trait surface, re-exported from navi_router:

Item Role
ValidateSearch Trait a search type implements to validate itself.
ValidationResult Outcome of a validation pass.
ValidationError A single validation failure.

Implement ValidateSearch for your typed search struct (see Search Params), and the router consults it when matching navigations carry query data.

Run the workspace tests for the feature you enabled:

Terminal
cargo test -p navi-router --features garde

The repository’s example-app ships a validation-test route directory with one page per integration (validator.rs, garde.rs, validify.rs, valico.rs) that you can open side by side.