Conversation
khieta
left a comment
There was a problem hiding this comment.
Overall changes look good to me, but I'd like to relitigate the decision to add a new Request::new_with_validation API vs. adding an optional schema argument to Request::new. I feel that the latter is more consistent with our choice for the Entities constructors (#360), although I do concede that it is a more invasive change for users.
|
Another comment I forgot to add: might be useful to add test cases for the new |
|
Added a bunch of tests (and did some reorg while I was at it). In the process I fixed a (bug?) in entity validation that exists on the 2.4.x release branch.
This PR follows #191, which resulted from discussion in RFC 11. I'm happy to relitigate this, but we should make sure to include the points discussed on 191 and on RFC 11, and to make sure everyone relevant is included in the discussion. |
|
Recapping the RFC 11 discussion as I see it, along with the above point: Let's call the solution described in #191, with a separate
|
|
I could be persuaded that one constructor is Ok, on the basis that old code will not typecheck, and the fix to get it typecheck (include I wonder: Is it easy/possible to build tools that might carry out such a change automatically? We have other APIs we might like to change in ways that are not back-compatible, but are easy to migrate. |
|
Another point is that, as you can see in the current version of this PR, the two-constructor solution really becomes a four-constructor solution when you consider partial evaluation: we have |
|
I would vote for the one-constructor solution.
In Jetbrains products you can do "Change Method Signature" (tested with RustRover). It looks like RustAnalyzer has an issue for this (rust-lang/rust-analyzer#6499) but it isn't done yet. |
| )) | ||
| }) | ||
| pub fn context_type(&self, action: &EntityUID) -> Option<Type> { | ||
| // INVARIANT: `ValidatorActionId::context_type` always returns a closed |
There was a problem hiding this comment.
nit: I don't think we need to repeat this since it's in the docstring above.
There was a problem hiding this comment.
The docstring above is to document ValidatorSchema::context_type's return invariant. The comment here is explaining how we meet that invariant, namely by discharging it to ValidatorActionId::context_type, which maintains the same invariant on its return value.
Co-authored-by: Andrew Wells <130512013+andrewmwells-amazon@users.noreply.github.com>
john-h-kastner-aws
left a comment
There was a problem hiding this comment.
Still in favor of the one-constructor option.
|
Seems like the majority are in favor of the one-constructor option, and no one strongly opposed. I updated this PR to take the one-constructor approach. |
Co-authored-by: Andrew Wells <130512013+andrewmwells-amazon@users.noreply.github.com>
Description of changes
Adds
Request::new_with_validation()to the public API.Issue #, if available
Fixes #191
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):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.