vld-rocket
Rocket 0.5 guards that validate JSON bodies, query strings, path segments, forms, headers and cookies with vld schemas, plus catchers that answer with JSON errors.
Install
[]
= "0.5"
= "0.5"
= { = "0.5", = ["json"] }
Example
use *;
schema!
Invalid input is answered with 422 and {"error": "Validation failed", "issues": [{"path": ".name", "message": "...", "code": "too_small"}]}; a wrong Content-Type is 415, a body over the limit is 413. Bodies are limited by Rocket's json / form limits; while those are at Rocket's built-in defaults, 2 MiB applies.
Guards: VldJson, VldForm, VldQuery, VldPath, VldHeaders, VldCookie.
Documentation
- Guide: https://s00d.github.io/vld/integrations/web/rocket
- Shared adapter rules: https://s00d.github.io/vld/integrations/web/overview
- API: https://docs.rs/vld-rocket
MSRV: 1.85 (MSRV.md).
License
MIT