-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
add __directive meta field parallel to __type #1114
base: main
Are you sure you want to change the base?
Conversation
✅ Deploy Preview for graphql-spec-draft ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
Thanks @benjie Co-authored-by: Benjie <[email protected]>
as we haven't yet introduced the schema so nullable types might be confusing
Implemented by graphql/graphql-js#4203 |
I've not reviewed if these spec changes are sufficient, but I'm supportive of the aim 👍 |
This was discussed at the November 2024 WG => this small change prompted an interesting discussion about "The Future of Introspection." To my understanding, @leebyron 's feedback: Perhaps This general change might unlock general __schema(includeDeprecated: true) { ... } that would apply to all nested fields. As this change is not a "must-have" it will probably be paused to make sure it fits into whatever introspection future is planned. We do not have to actually implement that entire new future to move forward with this small feature change, but we have to make sure that this smaller change aligns with the plan. |
I'm generally in favour of Lee's proposal; but I do have one concern that I wanted to think about: unless we're careful the way in which we execute this may set a bad precedent of passing down implicit values. I've written about the problem of referencing ancestors before, but essentially if you can think of anything under {
a: __schema(includeDeprecated: true) {
type(name: "MyType") { name fields { name } }
}
b: __schema(includeDeprecated: false) {
type(name: "MyType") { name fields { name } }
}
} here the objects flowchart TD
Query --> a["__schema(includeDeprecated: true)"]
Query --> b["__schema(includeDeprecated: false)"]
a --> MyType
b --> MyType
So when we access flowchart TD
Query --> a["__schema(includeDeprecated: true)"]
Query --> b["__schema(includeDeprecated: false)"]
a --> MyType
b --> MyType
MyType --> fields
classDef hide fill:#fff,stroke:#aaa,color:#aaa;
class Query,a,b,MyType hide;
Contradiction: but Despite raising this, I'd argue that this is in fact not an issue for the proposed changes, since none of the entries below flowchart TD
Query --> a["__Schema"]
Query --> b["__Schema*"]
a --> MyTypeA["MyType"]
b --> MyTypeB["MyType*"]
MyTypeA --> fieldsA["fields"]
MyTypeB --> fieldsB["fields*"]
Importantly The caveat here is that we must be willing to commit to this always being true before we adopt this change. |
Rereading the wg notes:
Trying to list the cases where this may happen, the only place I found is if an input value has a default value that is a deprecated enum value that was not fetched. Are there others? This has the potential to become much more of an issue with deprecated object types but as it is now it's okay-ish? All in all, I agree with @benjie's point that this is setting a precedent about accessing ancestors that might not be worth the tradeoff. Personnal anecdote: I have been tempted to do something similar to #144 in the Confetti API. The idea was to have a top-level Another question (that deviates quite a bunch from the original issue): do we really need |
Use case: inquiring about specific directives such as
@defer
and@stream