Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/main/java/graphql/language/AstPrinter.java
Original file line number Diff line number Diff line change
Expand Up @@ -482,7 +482,7 @@ private String value(Value value) {
} else if (value instanceof FloatValue) {
return valueOf(((FloatValue) value).getValue());
} else if (value instanceof StringValue) {
return wrap("\"", escapeJsonString(((StringValue) value).getValue()), "\"");
return "\"" + escapeJsonString(((StringValue) value).getValue()) + "\"";
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Decided to just switch to plain old concat instead of using the wrap method.

} else if (value instanceof EnumValue) {
return valueOf(((EnumValue) value).getName());
} else if (value instanceof BooleanValue) {
Expand Down
20 changes: 20 additions & 0 deletions src/test/groovy/graphql/language/AstPrinterTest.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -402,6 +402,26 @@ query NullEpisodeQuery {
'''
}

def "ast printing of blank string"() {
def query = '''
query NullEpisodeQuery {
human(id: " ") {
name
}
}
'''
def document = parse(query)
String output = printAst(document)

expect:
output == '''query NullEpisodeQuery {
human(id: " ") {
name
}
}
'''
}

//-------------------------------------------------
def "ast printing of default variables with null"() {
def query = '''
Expand Down