Trait cedar_policy_core::entities::Schema
source · pub trait Schema {
// Required methods
fn attr_type(
&self,
entity_type: &EntityType,
attr: &str
) -> Option<SchemaType>;
fn required_attrs<'s>(
&'s self,
entity_type: &EntityType
) -> Box<dyn Iterator<Item = SmolStr> + 's>;
}
Expand description
Trait for Schema
s that can inform the parsing of Entity JSON data
Required Methods§
sourcefn attr_type(&self, entity_type: &EntityType, attr: &str) -> Option<SchemaType>
fn attr_type(&self, entity_type: &EntityType, attr: &str) -> Option<SchemaType>
Do entities of the given type have the given attribute, and if so, what type?
Returning None
indicates that attribute should not exist.
sourcefn required_attrs<'s>(
&'s self,
entity_type: &EntityType
) -> Box<dyn Iterator<Item = SmolStr> + 's>
fn required_attrs<'s>( &'s self, entity_type: &EntityType ) -> Box<dyn Iterator<Item = SmolStr> + 's>
Get the names of all the required attributes for the given entity type.