Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added some useful methods and docs #1186

Merged
merged 2 commits into from
Sep 10, 2024
Merged

Conversation

aaronjeline
Copy link
Contributor

Description of changes

  • Adds Entity::new_without_attrs that can't error
  • Entity is now Hash, which is very useful as we require that entity collections lack duplicates
  • Added documentation to methods on Entities clarifying when errors are returned

Issue #, if available

#1184

Checklist for requesting a review

The change in this PR is (choose one, and delete the other options):

  • A backwards-compatible change requiring a minor version bump to cedar-policy (e.g., addition of a new API).

I confirm that this PR (choose one, and delete the other options):

  • Updates the "Unreleased" section of the CHANGELOG with a description of my change (required for major/minor version bumps).

I confirm that cedar-spec (choose one, and delete the other options):

  • Does not require updates because my change does not impact the Cedar formal model or DRT infrastructure.

Signed-off-by: Aaron Eline <aeline+github@amazon.com>
@aaronjeline aaronjeline linked an issue Sep 9, 2024 that may be closed by this pull request
2 tasks
cedar-policy-core/src/ast/entity.rs Outdated Show resolved Hide resolved
cedar-policy-core/src/ast/entity.rs Outdated Show resolved Hide resolved
cedar-policy-core/src/entities.rs Outdated Show resolved Hide resolved
cedar-policy-core/src/entities.rs Outdated Show resolved Hide resolved
@aaronjeline aaronjeline force-pushed the 1184-some-usability-improvements branch from 47f507f to f759fef Compare September 10, 2024 14:01
@@ -345,6 +356,10 @@ impl Entities {
/// error if attributes have the wrong types (e.g., string instead of
/// integer), or if required attributes are missing or superfluous
/// attributes are provided.
/// # Errors
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We could consider enabling the missing_error_doc lint if we believe this sort of documentation is valuable.

Copy link
Contributor

@cdisselkoen cdisselkoen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good overall, one comment about panic safety

cedar-policy-core/src/ast/entity.rs Outdated Show resolved Hide resolved
cedar-policy-core/src/ast/entity.rs Outdated Show resolved Hide resolved
cedar-policy-core/src/ast/entity.rs Outdated Show resolved Hide resolved
cedar-policy/src/api.rs Outdated Show resolved Hide resolved
cedar-policy/src/api.rs Outdated Show resolved Hide resolved
Co-authored-by: John Kastner <130772734+john-h-kastner-aws@users.noreply.github.com>
Co-authored-by: Craig Disselkoen <cdiss@amazon.com>
Signed-off-by: Aaron Eline <aeline+github@amazon.com>
@aaronjeline aaronjeline force-pushed the 1184-some-usability-improvements branch from e1058bf to f6b153e Compare September 10, 2024 15:07
@aaronjeline aaronjeline merged commit 20e0195 into main Sep 10, 2024
19 checks passed
@aaronjeline aaronjeline deleted the 1184-some-usability-improvements branch September 10, 2024 17:42
aaronjeline added a commit that referenced this pull request Sep 10, 2024
Signed-off-by: Aaron Eline <aeline+github@amazon.com>
Co-authored-by: John Kastner <130772734+john-h-kastner-aws@users.noreply.github.com>
Co-authored-by: Craig Disselkoen <cdiss@amazon.com>
@aaronjeline aaronjeline mentioned this pull request Sep 10, 2024
3 tasks
khieta pushed a commit that referenced this pull request Sep 10, 2024
Signed-off-by: Aaron Eline <aeline+github@amazon.com>
Co-authored-by: John Kastner <130772734+john-h-kastner-aws@users.noreply.github.com>
Co-authored-by: Craig Disselkoen <cdiss@amazon.com>
@khieta khieta mentioned this pull request Sep 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Some usability improvements
3 participants