String literal input value is trimming whitespace
If I have an operation with a string literal input value that has leading or trailing whitespace, such as:
query {
test(s: " abcd ")
}
... the string gets trimmed to just "abcd" when the operation is parsed.
If instead I pass as a variable, then the string is not trimmed.
According to the GraphQL Spec:
... White space and other otherwise-ignored characters are significant within a string value. ...
Thus I would expect to never have the string input trimmed of whitespace.
I believe this is happening because lexer.readSingleLineString is designed to seek out whitespace and exclude it from the string. IMHO it should not.
https://github.com/wundergraph/graphql-go-tools/blob/6526186b7e823632f2c4f541497b7dd421a8bade/v2/pkg/lexer/lexer.go#L387-L431
Thanks.
From a first glance it looks like you're right.
@devsergiy please take a look.
Faced the same issue in my project. An interesting observation: if you substitute values not directly, but through query variables, then spaces in strings are not cut off