-
Notifications
You must be signed in to change notification settings - Fork 72
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
Make non-json isAuthorized and validate public, rework wasm interfaces #737
Conversation
Result types in TS now look like this:
|
High-level comment: I think
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
While reading through this PR, I noticed a few inconsistencies that I'd like to fix before we make these data structures public. My first pass at the fixes is in #740. Can you wait to merge this PR until that one is reviewed & merged?
But, overall, I think it's fine to expose these types (once they're cleaned up a little). It would also be good to provide public constructors for types whose internal fields are not exposed (e.g., AuthorizationCall
and ValidateCall
). But we should make sure that the public constructors only use public types (e.g., serde_json::Value
rather than JsonValueWithNoDuplicateKeys
).
We spent some time as a group thinking about how we want to improve the JSON FFI. The result of our discussion is in #757. @cdisselkoen has already started working on this in #760 (although there's no specific timeline on the rest of the changes). So: you may want to merge this PR sooner rather than later to avoid even more merge conflicts 🙂 |
Signed-off-by: Nick Szegheo <nicholas.szegheo@gmail.com>
Description of changes
isAuthorized
andvalidate
functions in the frontend public, as well as their related structs:AuthorizationAnswer
,AuthorizationCall
,ValidateCall
,ValidationSettings
,ValidationMode
,ValidateAnswer
,ValidationNote
wasm_is_authorized
andwasm_validate
to use non-json versions ofisAuthorized
andvalidate
, and to return the data inAuthorizationAnswer
andValidateAnswer
directly (instead of in a JSON string) in a wasm-specific result struct.errors: Vec<String>
in their error case. In TS, users can now check for success with duck typing instead of the misleadingsuccess
string.Issue #, if available
N/A
Checklist for requesting a review
The change in this PR is (choose one, and delete the other options):
cedar-policy
(e.g., addition of a new API)I confirm that this PR (choose one, and delete the other options):
I confirm that
cedar-spec
(choose one, and delete the other options):