jcward / haxe-graphql

Utilities for working with Haxe and GraphQL.
MIT License
23 stars 6 forks source link

Result AST has cyclic structure #16

Closed Randonee closed 6 years ago

Randonee commented 6 years ago
{
  todo(id: "a") {
    text
  }
}

When parsing the above I get a max stack size exceeded error when used with Apollo. Attempting to convert the AST to json will give a cyclic structure error.

 haxe.Json.stringify(new graphql.parser.Parser(graphql));
jcward commented 6 years ago

The official parser has a noLocation:true option -- I had to set this in the web demo, because the location sub-objects contain linked-list tokens that point to each other, which breaks JSON stringifiers:

See if that doesn't help:

 haxe.Json.stringify(new graphql.parser.Parser(graphql, { noLocation:true }));
Randonee commented 6 years ago

Perfect, that did it. thanks