Available on crate feature
validate only.Expand description
Runtime JSON Schema validation for Trust Task payloads.
Available behind the validate Cargo feature. The codegen inlines each
spec’s payload.schema.json as a string constant and emits a
ValidatedPayload impl so callers can validate any inbound value
against the on-the-wire schema, not just the structural shape serde
recovers.
ⓘ
use trust_tasks_rs::{specs::acl::grant::v0_1, validate::ValidatedPayload};
let value: serde_json::Value = serde_json::json!({
"entry": { "subject": "did:web:alice.example", "role": "admin" }
});
v0_1::Payload::validate_value(&value)?;This is belt-and-suspenders: most schema constraints fall out of typify’s
generated struct shapes, but cross-cutting checks (regex pattern,
minItems on optional arrays, conditional schemas) only hold up under a
true schema validator.
Structs§
- Validation
Error - One or more schema-validation problems encountered while checking a value.
Traits§
- Validated
Payload - A payload type whose original JSON Schema is embedded at compile time and available for runtime validation.
Functions§
- against_
schema - Compile
schema_jsonas a JSON Schema and validatevalueagainst it.