Expand description
Constraint validation, kept deliberately separate from serde.
OCPP’s JSON schemas carry constraints that Rust’s type system cannot express
(maxLength, minItems, numeric ranges, closed enumerations). Running them inside
Deserialize would make every failure a serde error with no structure, and would tax
the hot path. Instead, deserialization is pure shape-checking and validation is a second,
explicit pass whose output is a list of Violations carrying a JSON pointer and a
category — which is exactly what the OCPP error codes are keyed on
(see crate::rpc::ErrorCode).
Structs§
- Validation
Path - A cursor into the payload being validated.
- Violation
- A single constraint failure.
- Violations
- The complete result of validating one payload.
Enums§
- Path
Segment - One step of a JSON pointer into a payload.
- Violation
Kind - Why a payload is invalid. Maps 1:1 onto the OCPP error codes.
Traits§
- Validate
- Checks the constraints the JSON schema places on a value.
Functions§
- int_
range minimum/maximumfor integers.- list_
len minItems/maxItems.- range
minimum/maximumfor numbers.- string
minLength/maxLength, counted in characters as the schemas intend.- unknown_
enum_ value - Records a value that was accepted into an enumeration’s open
UnknownValuevariant.