Skip to content
This repository was archived by the owner on Jun 13, 2025. It is now read-only.

Commit 1649d07

Browse files
committed
add comment
1 parent 8f73894 commit 1649d07

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

graphql_api/helpers/requested_fields.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,15 @@
1111

1212

1313
def selected_fields(info: GraphQLResolveInfo) -> set[str]:
14+
"""
15+
Given a GraphQL "sub-query", this recursively collects all the queried fields.
16+
17+
For example, if the original GraphQL query looks like `owner { repository { name } }`,
18+
this would resolve to `repository` and `repository.name`.
19+
20+
This function works by traversing the parts of the GraphQL Query AST which
21+
are exposed to each "resolver".
22+
"""
1423
names: set[str] = set()
1524
for node in info.field_nodes:
1625
if node.selection_set is None:

0 commit comments

Comments
 (0)