-
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
Implementations may not deprecate a field that the interface hasn't deprecated #1053
base: main
Are you sure you want to change the base?
Implementations may not deprecate a field that the interface hasn't deprecated #1053
Conversation
✅ Deploy Preview for graphql-spec-draft ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
Should the graphql-js impl be part of a major release? |
One potential wrinkle to this: we don't really have deprecated interface implementations. Like, maybe I'm deprecating a field because I will not be implementing an interface in the future. What I'm really trying to say is:
I guess the answer here is that deprecating implements is bad and you should migrate to a new type in that case. |
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.
suggest rewriting to:
- avoid directly referencing directives, but just the deprecated status directly.
- if / then to avoid the negative
Co-authored-by: Lee Byron <[email protected]>
I think @mjmahone has a valid point. Perhaps we don't want clients to do this anymore: ... on Foo {
id
} but this is still ok ... on Node {
id
} Marking |
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.
On further reflection, I'm thinking that this validation isn't needed. It doesn't bring enough benefit to warrant removing some deprecation capabilities.
@fotoetienne I think the general intent of deprecation (and specifically the If and when we support deprecation on interface implementation as Matt suggest, this rule can be changed such that either the interface field is deprecated or the implementation of this interface is deprecated. |
Discussed at tonights WG; we boiled it down to this: If you remove everything deprecated from a GraphQL schema, should the resulting schema be valid? Consensus was yes, @michaelstaib expressed it as something along the lines of: if you're building a new client to a GraphQL schema, you don't want to use any of the deprecated fields so you should be able to just use a schema with everything deprecated removed. Do you agree with this guiding principle to deprecation, @fotoetienne? If so, but you feel this is removing the deprecation capability of deprecating a field where you plan to remove the type from an interface, then perhaps we need to pair this with a spec change that enables deprecation on object type interface implementation? |
This PR addresses a spec validation omission; if an interface field is not deprecated then any implementation of that interface field should also not be deprecated. I.e. the following schema should be invalid, but before this PR it is valid:
To solve this, either the deprecation should be removed, or the
id
field onNode
should also be deprecated:Relevant action item: graphql/graphql-wg#1331
GraphQL.js Implementation: graphql/graphql-js#3986