Skip to main content

DataContractJsonConversionMethodsV0

Trait DataContractJsonConversionMethodsV0 

Source
pub trait DataContractJsonConversionMethodsV0 {
    // Required method
    fn from_json(
        json_value: JsonValue,
        full_validation: bool,
        platform_version: &PlatformVersion,
    ) -> Result<Self, ProtocolError>
       where Self: Sized;
}
Expand description

JSON deserialization for DataContract with an explicit validation flag.

from_json(value, full_validation, pv) is the single entry point: pass true on trust boundaries (SDK ingest, gRPC handlers, fixture loaders) to run full schema validation, and false to reconstruct already-trusted data (e.g. storage reads) without re-validating it.

For serialization, use canonical JsonConvertible::to_json / serde_json::to_value(&data_contract) directly — there is no validation dimension to writing.

Required Methods§

Source

fn from_json( json_value: JsonValue, full_validation: bool, platform_version: &PlatformVersion, ) -> Result<Self, ProtocolError>
where Self: Sized,

Deserialize from JSON, running full schema validation when full_validation is true.

Implementors§