graphql-js icon indicating copy to clipboard operation
graphql-js copied to clipboard

Allow configuration of the `ofType` introspection depth

Open Nols1000 opened this issue 11 months ago • 6 comments

This allows for a better configuration in case the server restricts the maximum query depth.


Added by @benjie:

  • Fixes #4321

Nols1000 avatar Dec 31 '24 14:12 Nols1000

CLA Signed

The committers listed above are authorized under a signed CLA.

  • :white_check_mark: login: Nols1000 / name: Nils-Börge Margotti (388d4056874fdfe2d82bfb24a6af634d5da1f5f7, a6cb5cdb9e1e5c95e46daeb9fc6344688b60391e, 366de1f623227a01554cab926c2aa5963ba4811b, 1881e0f154f819cfb90b2bad7daf9193aa4f2664)

@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.

Nols1000 avatar Jan 03 '25 12:01 Nols1000

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?

benjie avatar Jan 05 '25 13:01 benjie

@Nols1000 can you run please npm run lint -- --fix in your branch to get rid of a lint error?

ThePlenkov avatar Jan 10 '25 14:01 ThePlenkov

@Nols1000 also please cover this line with a test case: image

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

ThePlenkov avatar Jan 10 '25 14:01 ThePlenkov

@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.

Nols1000 avatar Jan 12 '25 20:01 Nols1000