Closed xiongtx closed 3 years ago
I'm wondering if figuring out infinite loops should be a concern of Lacinia's. It seems so to me, given that it's a kind of query error.
Here's an example using the GitHub API:
{ repository(name: "eros", owner: "xiongtx") { ...RepoFields } } fragment RepoFields on Repository { assignableUsers(first: 5) { edges { node { ...UserFields } } } } fragment UserFields on User { repositories(first: 5) { edges { node { ...RepoFields } } } }
GitHub responds w/:
{ "errors": [ { "path": [ "fragment RepoFields" ], "extensions": { "code": "infiniteLoop", "fragmentName": "RepoFields" }, "locations": [ { "line": 7, "column": 1 } ], "message": "Fragment RepoFields contains an infinite loop" }, { "path": [ "fragment UserFields" ], "extensions": { "code": "infiniteLoop", "fragmentName": "UserFields" }, "locations": [ { "line": 17, "column": 1 } ], "message": "Fragment UserFields contains an infinite loop" } ] }
This is mentioned in the spec: http://spec.graphql.org/June2018/#sec-Fragment-spreads-must-not-form-cycles
I'm wondering if figuring out infinite loops should be a concern of Lacinia's. It seems so to me, given that it's a kind of query error.
Here's an example using the GitHub API:
GitHub responds w/: