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
Hi! I've tried merging existing schemas which use graphql-custom-datetype as a custom scalar type. The merged schema however is turning the original resolved value at some point to a string - I could not figure out where - resulting in a serialization error on the custom scalar code. These are the steps to reproduce and what I expected to happen - although to be clear I'm not really familiar with custom scalar resolving, so I'm not sure if the resolved value should really be kept all the way until it's serialized or if it's expected to be changed at some point.
Steps to reproduce:
Run one of the following examples:
const{
graphql,
GraphQLObjectType,
GraphQLSchema,}=require('graphql');const{ mergeSchemas }=require('graphql-tools');constCustomGraphQLDateType=require('graphql-custom-datetype');constnow=newDate();constclockSchema=newGraphQLSchema({query: newGraphQLObjectType({name: 'clock',fields: {now: {resolve: ()=>now,type: CustomGraphQLDateType,}},})});graphql(clockSchema,'{ now }').then(result=>{console.assert(result.data.now==now.toISOString(),'clock schema out of sync with the now');}).catch(e=>{console.log(e);});consttheGrandSchema=mergeSchemas({schemas: [clockSchema],});graphql(theGrandSchema,'{ now }').then(result=>{console.log(result);console.assert(result.data.now==now.toISOString(),'the grand schema out of sync with the now');}).catch(e=>{console.log(e);});
Expected behaviour:
Queries on now to return an ISO timestamp - ex.: "2017-10-26T15:35:53.292Z".
Actual behaviour
Queries on now throw a TypeError: Field error: value is not an instance of Date from the custom scalar serialization because it gets a string instead of a Date.
The text was updated successfully, but these errors were encountered:
Hi! I've tried merging existing schemas which use graphql-custom-datetype as a custom scalar type. The merged schema however is turning the original resolved value at some point to a string - I could not figure out where - resulting in a serialization error on the custom scalar code. These are the steps to reproduce and what I expected to happen - although to be clear I'm not really familiar with custom scalar resolving, so I'm not sure if the resolved value should really be kept all the way until it's serialized or if it's expected to be changed at some point.
Steps to reproduce:
Run one of the following examples:
Expected behaviour:
Queries on
now
to return an ISO timestamp - ex.:"2017-10-26T15:35:53.292Z"
.Actual behaviour
Queries on
now
throw aTypeError: Field error: value is not an instance of Date
from the custom scalar serialization because it gets a string instead of aDate
.The text was updated successfully, but these errors were encountered: