Describe the bug
The parser hangs indefinitely on a schema file.
To Reproduce
Run the following code:
let HotChocolate x =
let parser = HotChocolate.Language.Parser()
let source = HotChocolate.Language.Source(x)
parser.Parse(source)
on the following schema: http://pcarrier.ca/onegraph.graphql
Expected behavior
The program terminates.
Desktop (please complete the following information):
I will have a look. Just as a side-note... this is our legacy parser interface. It is better to use Utf8GraphQLParser.Parse("string" or span)
btw ... thanks for reporting this.
The lexer works correctly but the parser seems to get stuck somewhere.
I have fixed the issue. The block string algorithm got stuck when the block string just consisted of one character and the algorithm tried to remove trailing lines from that.
However there are some escape issues in the schema.
For instance, the following block string:
Search for files with a query containing the "" character (e.g., "\authors")
```
fullText contains '\\authors'
```
\\author is correct but \author will lead to an exception that the string is not correctly escaped.
Also there are strings like \_ which is also not a correct escape char.
http://spec.graphql.org/draft/#BlockStringCharacter
The spec says that a block string is either SourceCharacter OR \""" which means the standard escaping must be honoured.
http://spec.graphql.org/draft/#EscapedCharacter
If you correct these escapings the schema now parses correctly.
As mentioned you should use the newer API:
Utf8GraphQLParser.Parse(sourceText);
sourceText can be a Span<byte> or a string.
We will include the fix into preview.128
@michaelstaib Amazing, thanks for the prompt response and API guidance!
@pcarrier we also have a very active slack channel. if you fancy to join the community here here is the invitation link:
https://join.slack.com/t/hotchocolategraphql/shared_invite/enQtNTA4NjA0ODYwOTQ0LTViMzA2MTM4OWYwYjIxYzViYmM0YmZhYjdiNzBjOTg2ZmU1YmMwNDZiYjUyZWZlMzNiMTk1OWUxNWZhMzQwY2Q