Trait stac_validate::ValidateCore
source · pub trait ValidateCore: Serialize {
// Required method
fn validate_core_json(value: &Value, validator: &Validator) -> Result<()>;
// Provided method
fn validate_core(&self) -> Result<()> { ... }
}
Expand description
Trait for validating STAC objects against their core schema only.
If your STAC object is the same version as stac::STAC_VERSION, this will be a quick, cheap operation, since the schemas are stored in the library.
Required Methods§
sourcefn validate_core_json(value: &Value, validator: &Validator) -> Result<()>
fn validate_core_json(value: &Value, validator: &Validator) -> Result<()>
Validate a serde_json::Value against a specific STAC jsonschema.
§Examples
stac::Item implements ValidateCore:
use stac_validate::ValidateCore;
use stac::Item;
let item = Item::new("an-id");
let value = serde_json::to_value(item).unwrap();
Item::validate_core_json(&value, &stac_validate::Validator::new()).unwrap();
Provided Methods§
sourcefn validate_core(&self) -> Result<()>
fn validate_core(&self) -> Result<()>
Validate a serde_json::Value against a specific STAC jsonschema.
§Examples
stac::Item implements ValidateCore:
use stac_validate::ValidateCore;
let item = stac::Item::new("an-id");
item.validate_core().unwrap();
Object Safety§
This trait is not object safe.