what's the difference between parseValue and parseLiteral in GraphQLScalarType?

Answer • 1 Asked • Jun 24 2019
Looking through the GraphQL documentation for custom scalar types (I'm trying to create my own date type) I'm not sure what the difference between parseValue and parseLiteral are.


The documentation doesn't seem to include any descriptions of what the functions are supposed to do.

Can someone let me know what the requirements are? I'm assuming that serialize must serialize the scalar to a string. Is that correct? I'm assuming that parseLiteral is a deserialization of that string to the type? In my case a Date type. However, in the examples - serialize and parseValue are the same function - which suggests it's not a simple deserialization method.

Write your answer...

On a mission to build Next-Gen Community Platform for Developers