-
Notifications
You must be signed in to change notification settings - Fork 2k
Allow configuration of the ofType
introspection depth
#4317
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
base: 16.x.x
Are you sure you want to change the base?
Conversation
…ery depth This allows for a better configuration in case the server restricts the maximum query depth.
@@ -52,6 +61,7 @@ export function getIntrospectionQuery(options?: IntrospectionOptions): string { | |||
schemaDescription: false, | |||
inputValueDeprecation: false, | |||
oneOf: false, | |||
typeDepth: 9, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
so this default is a breaking change. If we want this to land in v16 then we should do Infinity
and in v17
we can restrict the limits.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is that a breaking change? The behaviour is exactly the same as before. Infinity would lead to an infinite recursive loop.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@saihaj I think you may have misunderstood which depth this relates to - it's the ofType { ofType { ofType { ... } } }
depth of the generated query. We couldn't set that to infinity.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's keep this nicely formatted :)
ofType
introspection depth
Co-authored-by: Benjie <benjie@jemjie.com>
@benjie Thanks for the suggestions. I've commited them my branch. I think for the scope of this PR that is the right move. I'd also like to take this as an opportunity to discuss formatting the introspection query. I think it would be simpler to just keep the query in one line, without indentions. This could clean up the code and save a few byte over the wire. It would of course reduce the readability. Maybe we can document the query better, so that would become less of an issue. |
You can always minify it by parsing it and using a GraphQL minifier. I don't think our source code should concern itself with that too much - we should make it easy to read and edit. What sort of comments do you have in mind? |
@Nols1000 can you run please |
@Nols1000 also please cover this line with a test case: You can see it here https://app.codecov.io/gh/graphql/graphql-js/pull/4317 Thanks! I decided not to submit identical MR, so now also interested in introducing this change |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks like a good feature to have, great work, left some comments but pending those changes this should be good to go
Co-authored-by: Jovi De Croock <decroockjovi@gmail.com>
@benjie At least for me it's not 100% clear how the query works. I would have expected more documentation e.g. here https://graphql.org/learn/introspection/. For me a breakdown of this introspection query would have been a great learning resource. |
This allows for a better configuration in case the server restricts the maximum query depth.
Added by @benjie: