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
Building a schema where a scalar type was imported via SDL and the same scalar was used to create a GraphQL.js Object Type will fail. For example, using the DateTime scalar would fail with the following error:
Schema must contain uniquely named types but contains multiple types named "DateTime".
Doing some debugging, when GraphQL builds the list of types in the collectReferencedTypes function, it is adding both DateTime types into the schema typeSet. This causes the schema building in step 5 (below) to fail.
Seems the schema builder is seeing each DateTime as different types. I examined both DateTime scalar type objects as they passed through the building process and they were pretty much identical except the one imported from the SDL file had the astNode type property with data on where in the SDL file the definition was located, while the DateTime type created programmatically had astNode as undefined. It is not recognizing/reconciling the fact that it is supposed to be the same type.
To Reproduce
Create an SDL file and use a graphql-scalar type (DateTime in this example):
Expected behavior
Schema gets built and scalar types are reconciled even when one was imported via SDL definition and the other was created with GraphQL.js.
Environment:
OS: Windows 10
GraphQL Scalars Version: 1.10.1
NodeJS: 14.17.3
Additional context
Work-around: Defined your SDL in GraphQL.js
The text was updated successfully, but these errors were encountered:
Describe the bug
Building a schema where a scalar type was imported via SDL and the same scalar was used to create a GraphQL.js Object Type will fail. For example, using the
DateTime
scalar would fail with the following error:Doing some debugging, when GraphQL builds the list of types in the
collectReferencedTypes
function, it is adding bothDateTime
types into the schema typeSet. This causes the schema building in step 5 (below) to fail.Seems the schema builder is seeing each
DateTime
as different types. I examined bothDateTime
scalar type objects as they passed through the building process and they were pretty much identical except the one imported from the SDL file had theastNode
type property with data on where in the SDL file the definition was located, while theDateTime
type created programmatically hadastNode
as undefined. It is not recognizing/reconciling the fact that it is supposed to be the same type.To Reproduce
graphql-scalar
type (DateTime in this example):dummyTypeDef
and create GraphQL schema from SDL definitionExpected behavior
Schema gets built and scalar types are reconciled even when one was imported via SDL definition and the other was created with GraphQL.js.
Environment:
Additional context
Work-around: Defined your SDL in GraphQL.js
The text was updated successfully, but these errors were encountered: