graphql-tools icon indicating copy to clipboard operation
graphql-tools copied to clipboard

Default value for custom scalar type

Open denneulin opened this issue 10 years ago • 7 comments

As asked by @helfer on graphql-js issue 461, I have written a quick reproduction.

To reproduce, you can give a look on this commit.

denneulin avatar Sep 13 '16 09:09 denneulin

hi @denneulin , thanks for reporting! can you please open a PR for a failing test?

DxCx avatar Sep 14 '16 11:09 DxCx

nvm, i was able to reproduce using your repo and it turns out to be graphql parser bug..

DxCx avatar Sep 14 '16 18:09 DxCx

Actually, this may be something we have to work around in graphql-tools, because there's no way to specify parseLiteral functions in schema language, which is what you'd have to do in order to properly parse the default value.

helfer avatar Sep 14 '16 19:09 helfer

But then how it suppose to work? Parse gets text..

DxCx avatar Sep 14 '16 20:09 DxCx

i think i've found the place the magic happens. https://github.com/graphql/graphql-js/blob/7e8e57b9d13d82a54ecc72cb176baad0452cd564/src/utilities/valueFromAST.js#L113

anyway. i don't see an easy way to workaround this..

DxCx avatar Sep 14 '16 23:09 DxCx

and this is the place the defaultValue: false is coming from...

DxCx avatar Sep 14 '16 23:09 DxCx

Hey - this hasn't had any discussion in a while, and it's not clear if it's still an issue. Please let me know if it is, but I'm going to close for now.

stubailo avatar Jul 13 '18 18:07 stubailo