graphql-go / graphql-go/graphql

printed sdl cannot be parsed when quotation in description

Open
#641 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Go
Stars
10.1k
Forks
845
PR merge metrics
No merged PRs in 30d

Description

### Steps to reproduce

```
func TestPrint(t *testing.T) {
doc := &ast.Document{
Kind: kinds.Document,
Loc: nil,
Definitions: []ast.Node{
&ast.ObjectDefinition{
Kind: kinds.ObjectDefinition,
Name: &ast.Name{
Kind: kinds.Name,
Value: "myObject",
},
Description: &ast.StringValue{
Kind: kinds.StringValue,
Value: "test \"quoted\"",
},
},
},
}
sdl := printer.Print(doc)

ast, err := parser.Parse(parser.ParseParams{
Source: sdl,
})
assert.Nil(t, err)
assert.NotNil(t, ast)
}
```

### Expected result
printed string can be successfully parsed

### Actual result
meet error:
Syntax Error GraphQL (1:20) Unterminated string.

1: """test "quoted""""
^
2: type myObject {}

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.