-
-
Notifications
You must be signed in to change notification settings - Fork 38
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
Updated AuthorizationValidationRule to skip authorization checks when… #30
base: master
Are you sure you want to change the base?
Conversation
If there's a more elegant way to get the argument values from the validation context, let me know. |
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.
Mind adding some tests for each directive? Probably one each of where it should exclude the field that has a policy and it passes. And another where it should include the field and it hits the validation?
|
||
var operation = !string.IsNullOrWhiteSpace(context.OperationName) | ||
? context.Document.Operations.WithName(context.OperationName) | ||
: context.Document.Operations.FirstOrDefault(); |
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.
The Operation
and Variables
will be the same for both calls, so could pull that up so it isn't calculated twice.
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.
Extracted the operations to a variable. I wasn't sure what you meant by the Variables
here.
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.
ExecutionHelper.GetVariableValues
is called in the GetDirectiveValue
method. That only needs to be calculated once.
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.
OK, I've made that change.
I'm not sure if this is enough for tests; I tried doing them so that the directive conditions came from inputs set up on the test config, but when the rule was pulling the argument values they weren't there, so I'm not sure if there's something more I'd need to do in the tests... |
I wonder if I should also be accounting for these directives in the ObjectField handler? |
@joemcbride, sorry, I don't know, should I be notifying you I made changes, somehow? I understand you might just not have had time to get back to this. |
Yes should probably be handling this on the |
As for the |
… the field is not included or skipped due to directives.
… the field is not included or skipped due to directives.