graphql
graphql copied to clipboard
parser can't handle utf-8 characters
hi all,
I am trying to parse a graphql schema string but get an error:
# Some german Letters: ÄÖÜ
enum UserType {
USER
ADMIN
}
"Syntax Error schema (2:6) Expected {, found Name \"UserType\"\n\n1: # Some german Letters: ÄÖÜ\n2: enum UserType {\n ^\n3: USER\n"
it looks like the parser can not handle UTF-8 characters. I wonder why ?
you can test it yourself with the following test:
func TestParsesUTF8(t *testing.T) {
doc := `
# Some german Letters: ÄÖÜ
enum UserType {
USER
ADMIN
}
`
astDoc, err := Parse(ParseParams{
Source: doc,
Options: ParseOptions{
NoLocation: false,
NoSource: true,
},
})
if err != nil {
t.Fatalf("Parse failed: %v", err)
}
if astDoc == nil {
t.Fatalf("unexpected nil document")
}
}