-
Notifications
You must be signed in to change notification settings - Fork 222
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
Throw a warning when we are using a deprecated field #374
Comments
Also, it's probably more related to GraphQL spec or to https://github.com/webonyx/graphql-php ... 😞 |
Hi @Kocal, It seems that GraphQL specs doesn't say nothing about this on query runtime. The only way to know if a field is deprecated is to use introspection query. Adding a custom |
Do you know where I can start? |
This information should be present in the FieldDefinition. So using Schema extension with context and errorFormatter this could be done. |
I'm probably missing something, but how can I have access to the parsed incoming GraphQL query in my schema extension? In fact, I'm not sure I should use a schema extension, maybe an event would be more appropriate, no?... 🤔 |
In your schema extension you should wrap all objects graphql resolver and use ResolveInfo to get the field query and if query fields are deprecated add them in a variable (an array on Dreprecated Schema Extension itself or using context?). I'm not sure if this is the best way but this can be done like that. A combination of different Events can maybe do the same thing in a cleaner way. |
#378 Should make this easier to implement |
Mmmh maybe, I will take a look because I'm stuck at the moment 🤣 |
Hey,
I'm currently writing some docs on field deprecation (because I always forgot how to do it 🤣 ) and I just encountered a weird behavior.
When we mark a field a field as deprecated and we still use it in queries, it would be nice to see a warning, no?
running query
{ humans { faith } }
should returns something like that:What do you think?
The text was updated successfully, but these errors were encountered: