Skip to content

AstPrinter produces invalid GraphQL #3229

@pcarrier

Description

@pcarrier

Describe the bug
When a non-BlockString string contains escaped characters like newlines or quotes, AstPrinter does not escape them and the resulting document is not valid GraphQL.

To Reproduce
https://github.com/pcarrier/graphed/blob/main/src/jvmTest/kotlin/com/pcarrier/graphed/graphql/Repro1.kt

=== Original ===
"\"" scalar A
=== Parsed and printed ===
"""
scalar A

Exception in thread "main" graphql.parser.InvalidSyntaxException: Invalid syntax with ANTLR error 'token recognition error at: '"""\nscalar A\n'' at line 1 column 1
	at graphql.parser.Parser$1.syntaxError(Parser.java:368)
…

Metadata

Metadata

Assignees

No one assigned

    Labels

    keep-openTells Stale Bot to keep PRs and issues open

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions