You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
When attempting to merge interfaces, mergeType blindly calls mergeNamedTypeArray, which does not check if its first argument is, in fact, an array. The interfaces field is optional in ObjectTypeDefinitionNode. When no interfaces are present, the effect is that the node.interfaces value passed as the first argument to mergeNamedTypeArray is undefined. When, having failed to check the argument, mergeNamedTypeArray calls first.filter(), bad things happen. :-)
For now, a workaround is to define interfaces with an empty list in the AST works around the problem, but I'm not clear if various SDL->AST translators routinely do this (have not tested).
Suggested fix: Add default [] parameter values for the first and second parameters to mergeNamedTypeArray, similar to what is done for parameters at mergeDirectives.
To Reproduce
Pass a DocumentNode in the typeDefs parameter to mergeSchemas that contains an ObjectTypeDefinitionNode whose interfaces field is undefined.
Expected behavior
Should not throw on well-formed input...
Environment:
graphql-tools/merge 6.2.9, but bug is also present in current github.
Additional context
The text was updated successfully, but these errors were encountered:
Describe the bug
When attempting to merge interfaces,
mergeType
blindly callsmergeNamedTypeArray
, which does not check if its first argument is, in fact, an array. The interfaces field is optional inObjectTypeDefinitionNode
. When no interfaces are present, the effect is that thenode.interfaces
value passed as the first argument tomergeNamedTypeArray
is undefined. When, having failed to check the argument,mergeNamedTypeArray
callsfirst.filter()
, bad things happen. :-)For now, a workaround is to define interfaces with an empty list in the AST works around the problem, but I'm not clear if various SDL->AST translators routinely do this (have not tested).
Suggested fix: Add default [] parameter values for the
first
andsecond
parameters tomergeNamedTypeArray
, similar to what is done for parameters atmergeDirectives
.To Reproduce
Pass a DocumentNode in the typeDefs parameter to mergeSchemas that contains an ObjectTypeDefinitionNode whose interfaces field is undefined.
Expected behavior
Should not throw on well-formed input...
Environment:
graphql-tools/merge 6.2.9, but bug is also present in current github.
Additional context
The text was updated successfully, but these errors were encountered: