strawberry-graphql 0.227.3__py3-none-any.whl → 0.227.4__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
strawberry/relay/utils.py CHANGED
@@ -3,7 +3,7 @@ from typing import Any, Tuple, Union
3
3
  from typing_extensions import assert_never
4
4
 
5
5
  from strawberry.types.info import Info
6
- from strawberry.types.nodes import InlineFragment
6
+ from strawberry.types.nodes import InlineFragment, Selection
7
7
  from strawberry.types.types import StrawberryObjectDefinition
8
8
 
9
9
 
@@ -77,11 +77,28 @@ def should_resolve_list_connection_edges(info: Info) -> bool:
77
77
 
78
78
  """
79
79
  resolve_for_field_names = {"edges", "pageInfo"}
80
+
81
+ def _check_selection(selection: Selection) -> bool:
82
+ """Recursively inspect the selection to check if the user requested to resolve the `edges` field.
83
+ Args:
84
+ selection (Selection): The selection to check.
85
+
86
+ Returns:
87
+ bool: True if the user requested to resolve the `edges` field of a connection, False otherwise.
88
+ """
89
+ if (
90
+ not isinstance(selection, InlineFragment)
91
+ and selection.name in resolve_for_field_names
92
+ ):
93
+ return True
94
+ if selection.selections:
95
+ return any(
96
+ _check_selection(selection) for selection in selection.selections
97
+ )
98
+ return False
99
+
80
100
  for selection_field in info.selected_fields:
81
101
  for selection in selection_field.selections:
82
- if (
83
- not isinstance(selection, InlineFragment)
84
- and selection.name in resolve_for_field_names
85
- ):
102
+ if _check_selection(selection):
86
103
  return True
87
104
  return False
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: strawberry-graphql
3
- Version: 0.227.3
3
+ Version: 0.227.4
4
4
  Summary: A library for creating GraphQL APIs
5
5
  Home-page: https://strawberry.rocks/
6
6
  License: MIT
@@ -174,7 +174,7 @@ strawberry/relay/__init__.py,sha256=Vi4btvA_g6Cj9Tk_F9GCSegapIf2WqkOWV8y3P0cTCs,
174
174
  strawberry/relay/exceptions.py,sha256=b7sU2MhHVWJOfq27lvqdFcqBZ5P_JWk41JWRjtP-AOI,3916
175
175
  strawberry/relay/fields.py,sha256=0A96V4mQzFJwP9g68tM3zKmbPxnfU2Ix6kbMI-x11LQ,15550
176
176
  strawberry/relay/types.py,sha256=pCFD0UXXofmdTS2wBURjg8KwIfdioMt2j4qNYfk6GqQ,30710
177
- strawberry/relay/utils.py,sha256=CaNgiNXD8bRA5oSgIFgBGb9OeEtKvrJS1eCLzNQKAgg,2548
177
+ strawberry/relay/utils.py,sha256=STuJ2j-sTPa70O9juJX21nbhK6yhnHdwiAOWBYKOVdo,3160
178
178
  strawberry/resolvers.py,sha256=g7_g3jmXszziGydY1UG6IItf9s6B1lGLUCnwW1kb8U0,224
179
179
  strawberry/sanic/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
180
180
  strawberry/sanic/context.py,sha256=qfoj8QMaAiWbCQFAdm2KPPJGNc7ilXeKAl5z0XJ2nzo,805
@@ -241,8 +241,8 @@ strawberry/utils/logging.py,sha256=flS7hV0JiIOEdXcrIjda4WyIWix86cpHHFNJL8gl1y4,7
241
241
  strawberry/utils/operation.py,sha256=Um-tBCPl3_bVFN2Ph7o1mnrxfxBes4HFCj6T0x4kZxE,1135
242
242
  strawberry/utils/str_converters.py,sha256=avIgPVLg98vZH9mA2lhzVdyyjqzLsK2NdBw9mJQ02Xk,813
243
243
  strawberry/utils/typing.py,sha256=SQVOw1nuFZk2Pe3iz0o8ebzpoyvBVoGSQZVZj6-8k7I,13483
244
- strawberry_graphql-0.227.3.dist-info/LICENSE,sha256=m-XnIVUKqlG_AWnfi9NReh9JfKhYOB-gJfKE45WM1W8,1072
245
- strawberry_graphql-0.227.3.dist-info/METADATA,sha256=tJc-Ps5pIPYsvALYUXKSIVQuZxXjolNhNPnExDSqSoU,7821
246
- strawberry_graphql-0.227.3.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
247
- strawberry_graphql-0.227.3.dist-info/entry_points.txt,sha256=Nk7-aT3_uEwCgyqtHESV9H6Mc31cK-VAvhnQNTzTb4k,49
248
- strawberry_graphql-0.227.3.dist-info/RECORD,,
244
+ strawberry_graphql-0.227.4.dist-info/LICENSE,sha256=m-XnIVUKqlG_AWnfi9NReh9JfKhYOB-gJfKE45WM1W8,1072
245
+ strawberry_graphql-0.227.4.dist-info/METADATA,sha256=uYT_-NobMzrHaDqu5o_I48JxqU6MsMDUitjLvwyv1p8,7821
246
+ strawberry_graphql-0.227.4.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
247
+ strawberry_graphql-0.227.4.dist-info/entry_points.txt,sha256=Nk7-aT3_uEwCgyqtHESV9H6Mc31cK-VAvhnQNTzTb4k,49
248
+ strawberry_graphql-0.227.4.dist-info/RECORD,,