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
Directive precedence should be explicit, not implicit #65
Comments
Thanks for the recommendation. The goal is to be as simple as possible, so I appreciate the argument. Simplicity also led to the current behavior, though primarily simplicity of implementation. Adding the additional step of order-dependence makes this more complicated. There is also a desire for the directives to be un-ordered so they can be safely represented as a Set rather than a List internally, this can be a simplifying force for implementations and removes a potential area for mistakes by accidental re-ordering. I have another suggestion that I'm interested in getting your feedback on, hopefully it solves your concerns: As currently specced:
We get this truth table if both skip and include are present:
Based on this, I think we can reframe the relationship as written in the spec to be a formal AND. That would have an identical truth table, but would not contain any implicitly ordered relationship between the two nor would it rely on any explicit ordering (due to the commutative property). Another nice outcome of this is that the spec could potentially be written to allow multiple |
Closing since this note has been added to the spec about there being no precedence in this case: http://facebook.github.io/graphql/#sec--include |
The draft states that if both the @Skip and @include directives are present, the @Skip directive should take precede. This strikes me as confusing as it opens the door to others creating directives with implicit precedence.
Wouldn't it be simpler and less confusing to say precedence is left to write in the order it was written?
If fragments are involved, then we could linearize the dependencies by saying depth first. Then there are no ambiguities.
The text was updated successfully, but these errors were encountered: