Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deepen introspection query from 3 levels to 7 #364

Merged
merged 1 commit into from
Apr 25, 2016

Conversation

msolomon
Copy link

Problem

Certain use cases require deeply nested types, perhaps non-null lists inside non-null lists etc..

GraphQL (quite reasonably) doesn't support infinitely recursive queries, which would enable introspecting on arbitrarily nested structures like this. This limits introspection on deeply nested types.

This GraphQL implementation provides an introspection query that supports up to a finite depth, currently 3, e.g. [Int!]!. This is not enough for all use cases: imagine a fully non-null 3D matrix: [[[Int!]!]!]!.

In practice, I encountered this problem almost immediately with a modest type akin to [[Int!]!].

Solution

Deepen the introspection depth for nested types from 3 to 7. This is enough to support the examples above, and is likely to be enough for most reasonable cases, even with fairly heavy use of non-null types.

Tests now explicitly express the desired maximum depth.

Result

It becomes easy to introspect on deeply nested types.

@facebook-github-bot
Copy link

Thank you for your pull request and welcome to our community. We require contributors to sign our Contributor License Agreement, and we don't seem to have you on file. In order for us to review and merge your code, please sign up at https://code.facebook.com/cla - and if you have received this in error or have any questions, please drop us a line at cla@fb.com. Thanks!

@coveralls
Copy link

Coverage Status

Changes Unknown when pulling 7fea276 on msolomon:deepen-introspection into * on graphql:master*.

@leebyron leebyron merged commit 0b72e70 into graphql:master Apr 25, 2016
@leebyron
Copy link
Contributor

Looks good, thanks :)

sogko added a commit to sogko/graphql that referenced this pull request Jun 1, 2016
graphql/graphql-js#364

Commit:
0b72e7038761bec9fb5319cc08ea93ff8b071a9c [0b72e70]
Parents:
cbded82952
Author:
Mike Solomon <mike@mindsnacks.com>
Date:
26 April 2016 at 2:37:25 AM SGT
Committer:
Lee Byron <lee@leebyron.com>
chris-ramon pushed a commit to graphql-go/graphql that referenced this pull request Mar 15, 2017
graphql/graphql-js#364

Commit:
0b72e7038761bec9fb5319cc08ea93ff8b071a9c [0b72e70]
Parents:
cbded82952
Author:
Mike Solomon <mike@mindsnacks.com>
Date:
26 April 2016 at 2:37:25 AM SGT
Committer:
Lee Byron <lee@leebyron.com>
samuel pushed a commit to sprucehealth/graphql that referenced this pull request Mar 28, 2017
graphql/graphql-js#364

Commit:
0b72e7038761bec9fb5319cc08ea93ff8b071a9c [0b72e70]
Parents:
cbded82952
Author:
Mike Solomon <mike@mindsnacks.com>
Date:
26 April 2016 at 2:37:25 AM SGT
Committer:
Lee Byron <lee@leebyron.com>
mattstern31 pushed a commit to mattstern31/graphql-gqllero-repository that referenced this pull request Nov 10, 2022
graphql/graphql-js#364

Commit:
0b72e7038761bec9fb5319cc08ea93ff8b071a9c [0b72e70]
Parents:
cbded82952
Author:
Mike Solomon <mike@mindsnacks.com>
Date:
26 April 2016 at 2:37:25 AM SGT
Committer:
Lee Byron <lee@leebyron.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants