Single quotes are not considered valid string values, but should be.
Repro steps
Just try to use single quotes in any input string in a query/mutation/subscription.
Alternative reproduction:
Clone repository;
In tests/FSharp.Data.GraphQL.Tests/ParserTests.fs introduce a unit test named, say, "parser should parse query with single-quoted arguments", perhaps by copying-and-pasting existing test "parser should parse query with quoted arguments" and replacing the quotes in the input with single quotes. Then, run the (new) test.
Expected behavior
Single quotes should be considered a valid character in an input string.
Actual behavior
Parser exception is thrown.
Example:
[xUnit.net 00:00:01.27] FSharp.Data.GraphQL.Tests.ParserTests.parser should parse query with single-quoted arguments [FAIL]
Fehler FSharp.Data.GraphQL.Tests.ParserTests.parser should parse query with single-quoted arguments [77 ms]
Fehlermeldung:
System.FormatException : Error in Ln: 2 Col: 22
search(query: "It's working!") {
^
Expecting: any char not in ‘ "'’, '"' or '\\'
Stapelverfolgung:
at FSharp.Data.GraphQL.Parser.parse(String query) in /Users/valber/dev/forks/FSharp.Data.GraphQL/src/FSharp.Data.GraphQL.Shared/Parser.fs:line 321
at FSharp.Data.GraphQL.Tests.ParserTests.test(Document ast, String query) in /Users/valber/dev/forks/FSharp.Data.GraphQL/tests/FSharp.Data.GraphQL.Tests/ParserTests.fs:line 13
at FSharp.Data.GraphQL.Tests.ParserTests.parser should parse query with single-quoted arguments() in /Users/valber/dev/forks/FSharp.Data.GraphQL/tests/FSharp.Data.GraphQL.Tests/ParserTests.fs:line 316
Known workarounds
I don't know what people are using as a workaround. An ugly workaround would be to encode every input string at the client and decode it at the server (ugh!)
Description
Single quotes are not considered valid string values, but should be.
Repro steps
Just try to use single quotes in any input string in a query/mutation/subscription.
Alternative reproduction:
tests/FSharp.Data.GraphQL.Tests/ParserTests.fs
introduce a unit test named, say, "parser should parse query with single-quoted arguments", perhaps by copying-and-pasting existing test "parser should parse query with quoted arguments" and replacing the quotes in the input with single quotes. Then, run the (new) test.Expected behavior
Single quotes should be considered a valid character in an input string.
Actual behavior
Parser exception is thrown. Example:
Known workarounds
I don't know what people are using as a workaround. An ugly workaround would be to encode every input string at the client and decode it at the server (ugh!)
Related information