Closed mgagliardo91 closed 10 months ago
This seems to be an omission in makeExtendSchemaPlugin
; the types should be added here:
Here's where an object definition is registered into newTypes
, for later construction:
(Similar for other type definitions)
Hopefully grabbing the build.getTypeByName(newObjectTypeDefinition.name)
and adding it to the types
array should solve the issue.
Interested in taking this on?
@benjie should be fixed in https://github.com/graphile/graphile-engine/pull/830
Summary
I am trying to add pure-GraphQL types using the
makeExtendSchema
plugin that includes an interface type and a few types that implement it. I can correctly specify these types and the__resolveType
handler; however, if I only link the interface into the Graph (i.e. as a return result from a query), the child types are filtered from the final schema.Steps to reproduce
Using the schema below:
By providing the typedefs above using the
makeExtendSchema
plugin,MyInterface
will be included in the resulting schema, butMyType
will not.If I instead explicitly tie
MyType
into the graph:then
MyType
is correctly added the the final schema.Expected results
All interface types and their implementing types are added to the final schema, regardless of if they are explicitly tied to the graph.
Actual results
Only explicit implementing types are added to the graph.
Additional context
Possible Solution
I currently have a hack in place that adds an explicity query type
___hack: MyType
and then I remove this during thefinalize
hook.While trying to diagnose, I do find that
MyType
is available during theGraphQLObject
hook, so I know that themakeExtendSchema
is correctly providing them back, but some other hook is filtering it out by the timeGraphQLObject:Interfaces
is hit.