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

add non_exhaustive to a couple more types #1169

Merged
merged 3 commits into from
Sep 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions cedar-policy-core/src/ast/restricted_expr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -657,9 +657,7 @@ pub mod restricted_expr_errors {

/// Errors possible from `RestrictedExpr::from_str()`
//
// CAUTION: this type is publicly exported in `cedar-policy`.
// Don't make fields `pub`, don't make breaking changes, and use caution when
// adding public methods.
// This is NOT a publicly exported error type.
#[derive(Debug, Clone, PartialEq, Eq, Diagnostic, Error)]
pub enum RestrictedExpressionParseError {
/// Failed to parse the expression
Expand Down
3 changes: 3 additions & 0 deletions cedar-policy-validator/src/cedar_schema/err.rs
Original file line number Diff line number Diff line change
Expand Up @@ -580,7 +580,10 @@ impl Diagnostic for MultipleEAMapDeclarationsError {
}

/// Errors relating to embedded attribute maps (`EAMap`s)
//
// This is NOT a publicly exported error type.
#[derive(Debug, Clone, Diagnostic, Error, PartialEq, Eq)]
#[non_exhaustive]
khieta marked this conversation as resolved.
Show resolved Hide resolved
pub enum EAMapError {
/// An embedded attribute map (RFC 68) was encountered where one is not allowed
#[error(transparent)]
Expand Down
3 changes: 3 additions & 0 deletions cedar-policy-validator/src/cedar_schema/parser.rs
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,10 @@ lazy_static::lazy_static! {
}

/// Parse errors for parsing a schema in the Cedar syntax
//
// This is NOT a publicly exported error type.
#[derive(Debug, Diagnostic, Error)]
#[non_exhaustive]
pub enum CedarSchemaParseErrors {
/// Parse error for the Cedar syntax
#[error(transparent)]
Expand Down
2 changes: 2 additions & 0 deletions cedar-policy-validator/src/coreschema.rs
Original file line number Diff line number Diff line change
Expand Up @@ -257,6 +257,8 @@ impl<'a> ast::RequestSchema for CoreSchema<'a> {
}

/// Error when the request does not conform to the schema.
//
// This is NOT a publicly exported error type.
#[derive(Debug, Diagnostic, Error)]
pub enum RequestValidationError {
/// Request action is not declared in the schema
Expand Down
2 changes: 2 additions & 0 deletions cedar-policy-validator/src/diagnostics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,8 @@ impl ValidationResult {
/// policy. The error contains a enumeration that specifies the kind of problem,
/// and provides details specific to that kind of problem. The error also records
/// where the problem was encountered.
//
// This is NOT a publicly exported error type.
#[derive(Clone, Debug, Diagnostic, Error, Hash, Eq, PartialEq)]
pub enum ValidationError {
/// A policy contains an entity type that is not declared in the schema.
Expand Down
7 changes: 3 additions & 4 deletions cedar-policy/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ Cedar Language Version: 4.0
### Added
- Implemented [RFC 74](https://github.com/cedar-policy/rfcs/pull/74): A new experimental API (`compute_entity_manifest`)
that provides the Entity Manifest: a data
structure that describes what data is required to satisfy a
structure that describes what data is required to satisfy a
Cedar request. To use this API you must enable the `entity-manifest` feature flag.
- Additional functionality to the JSON FFI including parsing utilities (#1079)
and conversion between the Cedar and JSON formats (#1087)
Expand Down Expand Up @@ -53,9 +53,8 @@ Cedar Language Version: 4.0
to parse strings in the JSON schema format.
- `PolicySet::template_annotation` now returns `Option<&str>` as opposed to
`Option<String>` in the previous version (#1131, resolving #1116)
- Marked errors/warnings related to parsing and entity/request validation as
`non_exhaustive`, allowing future variants to be added without a breaking
change. (#1137)
- Marked errors/warnings related to parsing and validation as `non_exhaustive`,
allowing future variants to be added without a breaking change. (#1137, #1169)
- (*) Improved consistency between JSON and Cedar schema formats. Both now
forbid using `Bool`, `Boolean`, `Entity`, `Extension`, `Long`, `Record`, `Set`,
and `String` as common type names. (#1150, resolving #1139)
Expand Down
1 change: 1 addition & 0 deletions cedar-policy/src/api/err.rs
Original file line number Diff line number Diff line change
Expand Up @@ -956,6 +956,7 @@ pub mod context_json_errors {

/// Error type for parsing a `RestrictedExpression`
#[derive(Debug, Diagnostic, Error)]
#[non_exhaustive]
pub enum RestrictedExpressionParseError {
/// Failed to parse the expression
#[error(transparent)]
Expand Down
Loading