Skip to content

Commit 3b17f71

Browse files
Minor docs fixes (#1571)
Signed-off-by: John Kastner <[email protected]>
1 parent 1911bf5 commit 3b17f71

File tree

3 files changed

+20
-15
lines changed

3 files changed

+20
-15
lines changed

cedar-policy-validator/src/entity_manifest.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,8 @@ use crate::{
4242
};
4343
use crate::{ValidationResult, Validator};
4444

45-
/// Data structure storing what data is needed
46-
/// based on the the [`RequestType`].
45+
/// Data structure storing what data is needed based on the the [`RequestType`].
46+
///
4747
/// For each request type, the [`EntityManifest`] stores
4848
/// a [`RootAccessTrie`] of data to retrieve.
4949
///
@@ -94,9 +94,9 @@ impl Display for EntityRoot {
9494
}
9595
}
9696

97-
/// A [`RootAccessTrie`] is a trie describing a set of
98-
/// data paths to retrieve. Each edge in the trie
99-
/// is either a record or entity dereference.
97+
/// A trie describing a set of data paths to retrieve.
98+
///
99+
/// Each edge in the trie is either a record or entity dereference.
100100
///
101101
/// If an entity or record field does not exist in the backing store,
102102
/// it is safe to stop loading data at that point.

cedar-policy/src/api.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -697,7 +697,7 @@ impl Entities {
697697
/// "parents": [{"type":"Group","id":"admin"}]
698698
/// },
699699
/// {
700-
/// "uid": {"type":"Groupd","id":"admin"},
700+
/// "uid": {"type":"Group","id":"admin"},
701701
/// "attrs": {},
702702
/// "parents": []
703703
/// }
@@ -2916,15 +2916,15 @@ impl Template {
29162916

29172917
/// Get an annotation value of this `Template`.
29182918
/// If the annotation is present without an explicit value (e.g., `@annotation`),
2919-
/// then this function returns `Some("")`. It returns `None` only when the
2920-
/// annotation is not present.
2919+
/// then this function returns `Some("")`. Returns `None` when the
2920+
/// annotation is not present or when `key` is not a valid annotation identifier.
29212921
pub fn annotation(&self, key: impl AsRef<str>) -> Option<&str> {
29222922
self.ast
29232923
.annotation(&key.as_ref().parse().ok()?)
29242924
.map(AsRef::as_ref)
29252925
}
29262926

2927-
/// Iterate through annotation data of this `Template` as key-value pairs
2927+
/// Iterate through annotation data of this `Template` as key-value pairs.
29282928
/// Annotations which do not have an explicit value (e.g., `@annotation`),
29292929
/// are included in the iterator with the value `""`.
29302930
pub fn annotations(&self) -> impl Iterator<Item = (&str, &str)> {
@@ -3255,17 +3255,17 @@ impl Policy {
32553255
self.ast.effect()
32563256
}
32573257

3258-
/// Get an annotation value of this template-linked or static policy
3258+
/// Get an annotation value of this template-linked or static policy.
32593259
/// If the annotation is present without an explicit value (e.g., `@annotation`),
3260-
/// then this function returns `Some("")`. It returns `None` only when the
3261-
/// annotation is not present.
3260+
/// then this function returns `Some("")`. Returns `None` when the
3261+
/// annotation is not present or when `key` is not a valid annotations identifier.
32623262
pub fn annotation(&self, key: impl AsRef<str>) -> Option<&str> {
32633263
self.ast
32643264
.annotation(&key.as_ref().parse().ok()?)
32653265
.map(AsRef::as_ref)
32663266
}
32673267

3268-
/// Iterate through annotation data of this template-linked or static policy
3268+
/// Iterate through annotation data of this template-linked or static policy.
32693269
/// Annotations which do not have an explicit value (e.g., `@annotation`),
32703270
/// are included in the iterator with the value `""`.
32713271
pub fn annotations(&self) -> impl Iterator<Item = (&str, &str)> {

cedar-policy/src/api/err.rs

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -352,6 +352,7 @@ mod context_creation_errors {
352352
}
353353

354354
/// Error subtypes for [`ValidationError`].
355+
///
355356
/// Errors are primarily documented on their variants in [`ValidationError`].
356357
pub mod validation_errors;
357358

@@ -528,12 +529,15 @@ impl From<cedar_policy_validator::ValidationError> for ValidationError {
528529
}
529530

530531
/// Error subtypes for [`ValidationWarning`].
532+
///
531533
/// Validation warnings are primarily documented on their variants in [`ValidationWarning`].
532534
pub mod validation_warnings;
533535

534536
/// Represents the different kinds of validation warnings and information
535-
/// specific to that warning. Marked as `non_exhaustive` to allow adding
536-
/// additional warnings in the future as a non-breaking change.
537+
/// specific to that warning.
538+
///
539+
/// Marked as `non_exhaustive` to allow adding additional warnings in the future
540+
/// as a non-breaking change.
537541
#[derive(Debug, Clone, Error, Diagnostic)]
538542
#[non_exhaustive]
539543
pub enum ValidationWarning {
@@ -884,6 +888,7 @@ impl ParseErrors {
884888
}
885889

886890
/// Errors that can occur when parsing policies or expressions.
891+
///
887892
/// Marked as `non_exhaustive` to support adding additional error information
888893
/// in the future without a major version bump.
889894
#[derive(Debug, Diagnostic, Error, RefCast)]

0 commit comments

Comments
 (0)