Trait cedar_policy_core::entities::Schema

source ·
pub trait Schema {
    type EntityTypeDescription: EntityTypeDescription;

    // Required methods
    fn entity_type(
        &self,
        entity_type: &EntityType,
    ) -> Option<Self::EntityTypeDescription>;
    fn action(&self, action: &EntityUID) -> Option<Arc<Entity>>;
    fn entity_types_with_basename<'a>(
        &'a self,
        basename: &'a Id,
    ) -> Box<dyn Iterator<Item = EntityType> + 'a>;
}
Expand description

Trait for Schemas that can inform the parsing of Entity JSON data

Required Associated Types§

source

type EntityTypeDescription: EntityTypeDescription

Type returned by entity_type(). Must implement the EntityTypeDescription trait

Required Methods§

source

fn entity_type( &self, entity_type: &EntityType, ) -> Option<Self::EntityTypeDescription>

Get an EntityTypeDescription for the given entity type, or None if that entity type is not declared in the schema (in which case entities of that type should not appear in the JSON data).

source

fn action(&self, action: &EntityUID) -> Option<Arc<Entity>>

Get the entity information for the given action, or None if that action is not declared in the schema (in which case this action should not appear in the JSON data).

source

fn entity_types_with_basename<'a>( &'a self, basename: &'a Id, ) -> Box<dyn Iterator<Item = EntityType> + 'a>

Get the names of all entity types declared in the schema that have the given basename (in the sense of Name::basename()).

Implementors§