Skip to content

Commit

Permalink
Responding to comments
Browse files Browse the repository at this point in the history
  • Loading branch information
aaronjeline committed Oct 26, 2023
1 parent 940e823 commit b836970
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 2 deletions.
2 changes: 1 addition & 1 deletion cedar-policy-core/src/entities/json/err.rs
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ pub enum JsonDeserializationError {
got: Box<Either<serde_json::Value, Expr>>,
},
/// A field that needs to be an extension value, was some other JSON value
#[error("{ctx}, expected an extension value, but got `{got}`")]
#[error("{ctx}, expected an extension value, but got `{}`", display_json_value(.got.as_ref()))]
ExpectedExtnValue {
/// Context of this error
ctx: Box<JsonDeserializationErrorContext>,
Expand Down
5 changes: 5 additions & 0 deletions cedar-policy-core/src/entities/json/value.rs
Original file line number Diff line number Diff line change
Expand Up @@ -484,6 +484,9 @@ impl<'e> ValueParser<'e> {
ctx: impl Fn() -> JsonDeserializationErrorContext + Clone,
) -> Result<RestrictedExpr, JsonDeserializationError> {
match extnjson {
ExtnValueJson::ExplicitExprEscape { __expr } => {
Err(JsonDeserializationError::ExprTag(Box::new(ctx())))
}
ExtnValueJson::ExplicitExtnEscape { __extn }
| ExtnValueJson::ImplicitExtnEscape(__extn) => {
// reuse the same logic that parses CedarValueJson
Expand Down Expand Up @@ -617,6 +620,8 @@ pub enum EntityUidJson {
#[derive(Debug, Clone, PartialEq, Eq, Deserialize, Serialize)]
#[serde(untagged)]
pub enum ExtnValueJson {
/// This was removed in 3.0 as is here to give nice error messages
ExplicitExprEscape { __expr: String },
/// Explicit `__extn` escape; see notes on `CedarValueJson::ExtnEscape`
ExplicitExtnEscape {
/// JSON object containing the extension-constructor call
Expand Down
1 change: 0 additions & 1 deletion cedar-policy/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Changed

- Removed `__expr` escape from Cedar JSON formats
<<<<<<< HEAD
- Rename `cedar_policy_core::est::EstToAstError` to `cedar_policy_core::est::FromJsonError`.
- Rename `cedar_policy_core::entities::JsonDeserializationError::ExtensionsError` to `cedar_policy_core::entities::JsonDeserializationError::FailedExtensionsFunctionLookup`.
- Rename variants in `cedar_policy::SchemaError`.
Expand Down

0 comments on commit b836970

Please sign in to comment.