-
-
Notifications
You must be signed in to change notification settings - Fork 810
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
Make adding directives to existing fields easier when schema stitching #451
Comments
This maybe could be handled now with some custom fieldConfigMerger logic, https://www.graphql-tools.com/docs/stitch-type-merging Needs to be explored.... |
Actually I think easiest thing is to use mergeSchemas which should merge in directives... Note that stitching function is now called stitchSchemas, so mergeSchemas just straight merges without wrapping or proxying |
I think @yaacovCR is right. Feel free to create a new issue if this is still relevant. |
When I use
mergeSchemas
for schema stitching, I often need to add a directive to a field (to specify cacheControl). However, I can't put the same field in two schemas, because it will give me an error if I do so. My workaround was going to be:But in that case, the field no longer 'belongs' to the first schema, so it isn't resolved correctly without delegating it back to the original field, which doesn't work when I use transformSchema to remove it first.
It would be helpful if I could set a directive on the field in my second schema,
@overwrite
or something, that would make this easier for me to do. Because now my only workaround is to create a field with a new name in my second schema, then do the merge, and then remove the original field using transformSchema. I don't know why, but that way my delegate keeps working! And renaming a lot of fields like this isn't really a good solution...The text was updated successfully, but these errors were encountered: