-
-
Notifications
You must be signed in to change notification settings - Fork 796
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
delegate: handeObject() can not handle renamed abstract types #2017
Comments
How is your transform structured? It would need both interface Transform {
transformSchema(originalSchema: GraphQLSchema): GraphQLSchema;
transformRequest(originalRequest: Request): Request;
transformResult(result: ExecutionResult): ExecutionResult;
} |
@gmac I used the default https://github.com/ardatan/graphql-tools/blob/master/packages/wrap/src/transforms/RenameTypes.ts which includes a proper |
That's annoying! Can you post a GitHub course code sandbox reproduction? |
Dictation error, that should be fine. |
Took a quick look at #2019, does the failure of type renaming ever occur without using TransformQuery? I think the bug is because simply using TransformQuery on delegation is not the best way to transform a query, it should usually be done as part of changing the schema, hence the WrapFields and HoistField, TransformObjectFields transforms that I have created. Of course, see #1920, another issue I believe you raised, where the work in hoisting is not yet done. I have been working at this time on #1958 and #1989, and then hope to return to improving HoistFields If there is a separate problem of renaming abstract fields with RenameTypes without TransformQuery, please let me know, and narrow #2019 accordingly. Otherwise, I think basically you are describing a bug with TransformQuery, and I would suggest in response that eventually TransformQuery should be deprecated... Welcome also to your response/input from others, but that's just my first quick take... |
Yes, simply renaming types yields PR #2019 now contains the simplified version of the previous tests demonstrating this:
|
Discussion in #2019 resolved the issue: I did pass delegateToSchema the wrong subschema configuration object (which did not contain the TypeRename transform, yet). |
When I try to query an abstract type
Foo
, which I renamed toChirp_Foo
I get following errorfrom
graphql-tools/packages/delegate/src/results/handleObject.ts
Line 34 in 640de85
because
object.__typename
contains the unprocessed type nameFoo
from the subschema service response, where it should containChirp_Foo
. AsFoo
is not in the typeMap it yields undefined which leads to the above error.The text was updated successfully, but these errors were encountered: