-
-
Notifications
You must be signed in to change notification settings - Fork 816
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
delegateToSchema with abstract types does not work as expected #1920
Comments
I upgraded to 6.0.19-alpha-fe84638d.0, but the problem still persists. I think the special here is that the transform has to cast AudioBrodcastService to MangoBroadcastInterface, which are both implemented by MangoBroadcastService. |
I am basically stumped at first blush, as often. If you are able to minimize your reproduction, I can take a look. Right now, it is too extensive for me to quite wrap my head around |
Just looking at this again from a different angle, possibly the HoistField transform might help you to hoist fields from viewer up a level, if that is what you are trying to do. If you could prune the gateway schema and source subschema to the minimum necessary to see the problem, that would help my aging brain! Would love to help! |
And by minimum necessary, I think you need:
You can help a fix move along by providing the above, in order of my personal preference:
Really would love to help! |
I created a simplified example which worked as expected, the problem is my approach to transform the classic schema into modern one: As the individual requests do not get properly translated from the gateway schema to the service schema – would have to wrap most requests with a selectionSet? named viewer – I my first approach I tried to do this by modifying the executor. The HoistField transform has the problem this it only moves a single field and drops all arguments of the hoisted field. In my example I would require a HoistType transform (basically a inverted version of WrapType) which merges all fields from a childType (in my case I cleaned the demo repo: https://github.com/saerdnaer/stitching-demo/tree/b9c3942903da2ec8a4b3838dd233c0e601ac275c/src/schema and tried to show my first problem with HoistField in following test: https://github.com/ardatan/graphql-tools/pull/1963/files |
@yaacovCR delegateToSchema() does not support to extract wrapped fields? E.g. allowing using |
See #2040 in terms of allowing arguments Turns out hoisting fields into a root type is more complicated than hoisting regular fields because you have to create new proxying resolvers. So it turns out that we do not yet support hoisting fields into new root types... That is the next challenge, and then we can expand on this to hoist a type. |
Hoisting fields into root types will now be available on v7, check out #1935 for instructions on how to try the canary release. Last remaining bit of functionality you requested is to be able to hoist multiple fields at once. That will be less of a priority, as you can programmatically just add multiple transforms in the meantime. |
Released in v7 |
How to stitch from an abstract to another abstract type?
In this case from AudioBrodcastService to MangoBroadcastInterface which are both implemented by MangoBroadcastService.
Demo-Repo: https://github.com/saerdnaer/stitching-demo/blob/master/src/schema/index.ts#L199-L216
I am trying to reduce and modernise an existing relay classic endpoint with following schema structure:
which I transform into
and then extend with
When I now try to query all
audioBroadcastServices
I do not get any results, because the transform inside ofdelegateToSchema
(see link in first line this description) remove all attributes as it does not realise that they also exist on MangoBroadcastService:Request from delateToSchema for
audioBroadcastServices{…}
from gateway to source service:Request for
broadcastServices{…}
from gateway to source service:This bug is probably related to #751
The text was updated successfully, but these errors were encountered: