-
Notifications
You must be signed in to change notification settings - Fork 125
Automatically add action entities to Entities; validate entities against schema
#360
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
Conversation
|
Pushed some tests and I'm marking this ready for review. |
Co-authored-by: Andrew Wells <130512013+andrewmwells-amazon@users.noreply.github.com>
Co-authored-by: Andrew Wells <130512013+andrewmwells-amazon@users.noreply.github.com>
Co-authored-by: Andrew Wells <130512013+andrewmwells-amazon@users.noreply.github.com>
|
I remembered another reason why it might make sense to do it the way this PR currently has it (optional schema argument for the |
|
Thinking about it some more... adding a schema argument to So I retract my suggestion. I think it's ok to only do validation on constructing an New suggestion: update the comment for the public-facing Re #191: now I'm torn on whether we want a separate |
I don't think this is necessarily the case. Since validation is optional anyway, we can just say we have an internal invariant that if you have an Alternately if we want to be a little more explicit, we could just have a bool on each
Yeah, I think this is the motivating use case for
Yeah, this is certainly easy and good to do, if we stay with the way it currently is in this PR. I'm still not convinced we don't want to add an optional schema argument to
This is another reason why adding the optional schema argument to |
|
I note that in the discussion on RFC 11 we decided not to add an optional schema argument to the existing |
|
To add my 2c: I like the idea of just supporting validation on
On a different topic: While it might be useful to have an |
|
Makes sense to me. I have now removed |
…ainst schema (cedar-policy#360) Co-authored-by: Andrew Wells <130512013+andrewmwells-amazon@users.noreply.github.com> Co-authored-by: Kesha Hietala <khieta@amazon.com>
Description of changes
Entities::from_*()now automatically adds action entities from theschema, if aschemais providedEntities::from_*()now validates entities against theschema, if aschemais providedEntities::add_*()now validates entities against theschema, if aschemais providedEntity::validate()to the public API, which validates a single entity against a schemaEntities::from_entities()andEntities::add_entities()now take an optional schema argumentEntityJsonParser. If folks feel it's important, I can split those into a separate PR to declutter this one slightly. But this one is probably going to be a big PR regardlessIssue #, if available
Fixes #286
Checklist for requesting a review
The change in this PR is (choose one, and delete the other options):
cedar-policy(e.g., changes to the signature of an existing 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):cedar-spec. (Post your PR anyways, and we'll discuss in the comments.)Disclaimer
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.