graphql-go-tools
graphql-go-tools copied to clipboard
ValueToJSON may emit invalid JSON for block strings
As mentioned in #295, raw string content in the AST is unquoted in block strings, but the ValueToJSON method assumes string content is quoted. This means invalid JSON may be produced when block strings are serialized to JSON.
For example, the following GraphQL block string:
"""Hello
there"""
will be serialized to JSON as:
"Hello
there"
It should instead be:
"hello\nthere"
is this fixed?
No. #295 made it so triple quotes are preserved in GraphQL documents, but triple-quoted strings may not be valid when serialized to JSON.