githubv4 icon indicating copy to clipboard operation
githubv4 copied to clipboard

Recursive types

Open nyarly opened this issue 5 years ago • 1 comments

I don't think there's a way to represent this in GraphQL, but I experimented with:

type treeObject struct {
	Tree struct {
		Entries []struct {
			Path   string
			Object treeObject
		}
	} `graphql:"... on Tree"`
	Blob struct {
		byteSize int
	} `graphql:"... on Blob"`
}

which resulted in a stack overflow panic.

The appropriate type is going to be irritating to write, but an error rather than a panic would be nice here.

nyarly avatar Oct 30 '20 23:10 nyarly

Also see past discussion in shurcooL/graphql#9.

dmitshur avatar Oct 31 '20 05:10 dmitshur