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

feat: Add JSON Pointer preprocessor for Policy Expression language #315

Merged
merged 1 commit into from
Sep 5, 2024

Conversation

cstepanian
Copy link
Contributor

@cstepanian cstepanian commented Aug 29, 2024

Resolves #261

This PR adds a JSON Pointer preprocessor step before parsing and evaluation of Policy Expressions.
It adds a context parameter to the execution of Policy Expressions, which is used to lookup values referred to by the JSON Pointers.

It allows a limited subset of the full JSON Pointer syntax: only alphanumeric, '/' (slash), '~' (tilde), and '_' (underscore) characters are allowed.

This PR also adds a MultipleErrors variant of policy_exprs::error::Error. It is probably not the best long term design to solve the problem of tracking a list of errors found during parsing, checking, and execution of a language.

This commit augments the Policy Expression language
by allowing use of values from a JSON `context` variable
in Policy expressions.

It adds a preprocessing step before parsing and evaluation
of expressions where JSON pointers are parsed and looked up.
@cstepanian cstepanian force-pushed the cstepanian/json_pointer branch from ecfec22 to 6c1825c Compare September 5, 2024 20:31
@cstepanian cstepanian marked this pull request as ready for review September 5, 2024 20:38
@cstepanian cstepanian requested review from alilleybrinker, a team and j-lanson September 5, 2024 20:38
@alilleybrinker alilleybrinker merged commit 0d75a70 into main Sep 5, 2024
10 checks passed
@alilleybrinker
Copy link
Collaborator

Thanks @cstepanian!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
No open projects
Status: Done
Development

Successfully merging this pull request may close these issues.

Implement JSON-pointer like injection syntax for policy expressions
2 participants