Skip to content
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

serialize from GraphqlScalarType not allow to return null #3870

Closed
xs3213213213 opened this issue Mar 30, 2023 · 1 comment
Closed

serialize from GraphqlScalarType not allow to return null #3870

xs3213213213 opened this issue Mar 30, 2023 · 1 comment

Comments

@xs3213213213
Copy link

xs3213213213 commented Mar 30, 2023

i am using the version 16.6.0
I have implemented: GraphqlScalarType like this:

`

export const IntScalar = new GraphqlScalarType ({
   ...GraphQLInt,
    serialize(value) {
       if(value === 10000) {
          return null;
       }

    return value;
   }

})

`

im getting expected IntScalar.Serialize(10000) to return non-nullable value retrun null

why cant i return null?

@IvanGoncharov
Copy link
Member

@xs3213213213 Because scalars values are different from null.
You can't mix custom scalar values and null, see here:
https://spec.graphql.org/draft/#sel-EANTLEHJIMDJBA58K

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants