-
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
Deprecation of input fields #197
Comments
@leebyron any thoughts on this? |
Yeah I think this is probably an interesting idea, though we haven't put a lot of thought into it yet. I'm less sure about making types themselves deprecated - rather the references to those types should be deprecated. Perhaps that means also being able to mark arguments as deprecated. If input obj fields can be transitioned from required to optional to deprecated, then arguments should be the same. The next steps for an idea like this would be to draft an RFC, probably in the form of a PR against the spec along with a good description of how deprecation best practice should work and any potential caveats. |
I'd be very supportive and a huge fan of this change. 👍 We've already run into a few scenarios in our implementation where this would be valuable and I can foresee it becoming even more important in the future. I'd be happy to collaborate with anyone who wants to begin working on this. |
few places that are useful
|
Short of digging through old PRs, what is the process for proposing an RFC, @leebyron? I'm looking for something akin to Rust's RFC process, but outside of Subscriptions there don't seem to be many guidelines on writing these. |
@gjtorikian: a rough outline of the contribution process can be found here: https://github.com/facebook/graphql/blob/master/CONTRIBUTING.md |
Yeah it was actually news to me that this was not supported. (I would've sworn we've already put Anyone working on a PR for this? |
Is there any update on this? Are there new ways of accomplishing this now? |
@IvanGoncharov how it can be moved? Firstly should be improved spec or changed the code in graphql-js. Or firstly discussed on WG meetengs? |
@nodkz ATM workflow should be following:
For bonus points, you can prepare Just prepare the early draft of spec changes and submit it as a PR. |
@leebyron brilliant! 👍 @IvanGoncharov Sorry I cannot to do it in the near future - my wife kill me 🔪😅 |
Is it possible? |
Yes, Make use of deprecated directive on types and make a custom schema transformer that apply depreciation on schema. |
It is possible to deprecate fields and enum values, but not input values or arguments. I think it should be possible to deprecate optional arguments and input fields.
A natural way of evolving the schema in this case would be to make an input field optional if it is required, deprecate it, then remove it once clients stop explicitly setting the value. We can add support for that into the server to detect when the input field is still used, but we would like deprecation warnings on the client so we can easily remove usage of these deprecated input fields.
One possible workaround is to create a new field with different input, but that is a more disruptive way of evolving the schema.
Note that if __InputValue was just given isDeprecated and deprecationReason fields, then that would mean that an input object type could be deprecated, would that be undesirable? Right now an __Type (object, interface or union) also can't be deprecated, so would we want that to be consistent with an input object type?
Also, should the spec disallow an argument to be deprecated if it is non-null (i.e. required)? Otherwise, that effectively makes the field it is on deprecated.
The text was updated successfully, but these errors were encountered: