pub struct ValidateOptions {
pub root_id: String,
pub require_root: bool,
pub allow_dangling_children: bool,
pub check_component_types: bool,
pub check_required_props: bool,
pub check_prop_types: bool,
pub check_envelope: bool,
pub check_bindings: bool,
pub check_binding_syntax: bool,
pub max_depth: usize,
pub max_function_call_depth: usize,
}Expand description
What the validator should demand of a payload.
Fields§
§root_id: StringId the tree root must have. Defaults to ROOT_ID.
require_root: boolWhether a component with the root id must be present.
allow_dangling_children: boolWhether child references may point outside this payload.
check_component_types: boolWhether component types must exist in the catalog.
Turned off automatically when the catalog defines no components at all, since that means the caller has not supplied one.
check_required_props: boolWhether required properties are enforced.
check_prop_types: boolWhether property values must match the JSON type the catalog declares.
Only properties the catalog pins to one type are checked, and a value the
renderer resolves — a {"path": …} binding or a function call — is never
checked, because its type on the wire says nothing about the type it
will have. See PropType.
check_envelope: boolWhether message envelopes must satisfy the v0.9 wire contract.
Applies only to the raw-message entry points
(Validator::validate_json_messages and
Validator::validate_messages); the component entry points are handed
components directly and have no envelope to check.
check_bindings: boolWhether data bindings are resolved against the data model, and whether relative paths are required to sit inside a list template.
check_binding_syntax: boolWhether absolute binding paths must be syntactically valid JSON Pointers.
Separate from ValidateOptions::check_bindings because it needs no
data model and cannot produce a false positive: a malformed escape can
never resolve, whatever the data turns out to be.
max_depth: usizeDeepest nesting accepted, for both the component graph and the raw JSON.
Defaults to MAX_DEPTH. Raising it is safe here — every walk in this
crate is iterative — but a renderer on the other end may not be, and a
tree this deep is a generation failure rather than a design.
max_function_call_depth: usizeDeepest chain of function calls accepted, counting nesting through args.
Defaults to MAX_FUNCTION_CALL_DEPTH.
Implementations§
Source§impl ValidateOptions
impl ValidateOptions
Sourcepub fn full_surface() -> Self
pub fn full_surface() -> Self
The full contract, for a payload that creates a surface.
Sourcepub fn incremental_update() -> Self
pub fn incremental_update() -> Self
The relaxed contract, for a payload that updates an existing surface.
The root and the referenced components may already live on the renderer, so their absence from this payload is not an error.
Sourcepub fn with_root_id(self, root_id: impl Into<String>) -> Self
pub fn with_root_id(self, root_id: impl Into<String>) -> Self
Overrides the root component id.
Sourcepub fn with_max_depth(self, max_depth: usize) -> Self
pub fn with_max_depth(self, max_depth: usize) -> Self
Overrides the maximum nesting depth.
Trait Implementations§
Source§impl Clone for ValidateOptions
impl Clone for ValidateOptions
Source§fn clone(&self) -> ValidateOptions
fn clone(&self) -> ValidateOptions
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for ValidateOptions
impl Debug for ValidateOptions
Source§impl Default for ValidateOptions
impl Default for ValidateOptions
impl Eq for ValidateOptions
Source§impl PartialEq for ValidateOptions
impl PartialEq for ValidateOptions
Source§fn eq(&self, other: &ValidateOptions) -> bool
fn eq(&self, other: &ValidateOptions) -> bool
self and other values to be equal, and is used by ==.impl StructuralPartialEq for ValidateOptions
Auto Trait Implementations§
impl Freeze for ValidateOptions
impl RefUnwindSafe for ValidateOptions
impl Send for ValidateOptions
impl Sync for ValidateOptions
impl Unpin for ValidateOptions
impl UnsafeUnpin for ValidateOptions
impl UnwindSafe for ValidateOptions
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.