Skip to content

Commit

Permalink
Update EntityUID constructor for cedar-policy/cedar#802 (#300)
Browse files Browse the repository at this point in the history
Signed-off-by: John Kastner <jkastner@amazon.com>
  • Loading branch information
john-h-kastner-aws authored May 1, 2024
1 parent 0367cd8 commit 4078f71
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
9 changes: 7 additions & 2 deletions cedar-policy-generators/src/hierarchy.rs
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,11 @@ impl Hierarchy {
)?;
Ok(uid.clone())
} else {
Ok(EntityUID::from_components(typename.clone(), u.arbitrary()?))
Ok(EntityUID::from_components(
typename.clone(),
u.arbitrary()?,
None,
))
}
}
/// size hint for arbitrary_uid_with_type()
Expand Down Expand Up @@ -418,6 +422,7 @@ pub(crate) fn arbitrary_specified_uid(u: &mut Unstructured<'_>) -> Result<ast::E
Ok(ast::EntityUID::from_components(
u.arbitrary::<ast::Name>()?,
u.arbitrary::<ast::Eid>()?,
None,
))
}

Expand All @@ -437,7 +442,7 @@ pub(crate) fn generate_uid_with_type(
Eid::new(nanoid!(n))
}
};
Ok(ast::EntityUID::from_components(ty, eid))
Ok(ast::EntityUID::from_components(ty, eid, None))
}

impl<'a, 'u> HierarchyGenerator<'a, 'u> {
Expand Down
2 changes: 1 addition & 1 deletion cedar-policy-generators/src/schema.rs
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,7 @@ fn arbitrary_schematype_size_hint(depth: usize) -> (usize, Option<usize>) {
pub fn uid_for_action_name(namespace: Option<ast::Name>, action_name: ast::Eid) -> ast::EntityUID {
let entity_type =
build_qualified_entity_type_name(namespace, "Action".parse().expect("valid id"));
ast::EntityUID::from_components(entity_type, action_name)
ast::EntityUID::from_components(entity_type, action_name, None)
}

/// internal helper function, convert a SchemaType to a Type (loses some
Expand Down

0 comments on commit 4078f71

Please sign in to comment.