strawberry-graphql 0.289.3__py3-none-any.whl → 0.289.5__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/fields.py +6 -2
- strawberry/types/union.py +8 -0
- {strawberry_graphql-0.289.3.dist-info → strawberry_graphql-0.289.5.dist-info}/METADATA +1 -1
- {strawberry_graphql-0.289.3.dist-info → strawberry_graphql-0.289.5.dist-info}/RECORD +7 -7
- {strawberry_graphql-0.289.3.dist-info → strawberry_graphql-0.289.5.dist-info}/WHEEL +0 -0
- {strawberry_graphql-0.289.3.dist-info → strawberry_graphql-0.289.5.dist-info}/entry_points.txt +0 -0
- {strawberry_graphql-0.289.3.dist-info → strawberry_graphql-0.289.5.dist-info}/licenses/LICENSE +0 -0
strawberry/relay/fields.py
CHANGED
|
@@ -41,6 +41,7 @@ from strawberry.types.cast import cast as strawberry_cast
|
|
|
41
41
|
from strawberry.types.field import _RESOLVER_TYPE, StrawberryField, field
|
|
42
42
|
from strawberry.types.fields.resolver import StrawberryResolver
|
|
43
43
|
from strawberry.types.lazy_type import LazyType
|
|
44
|
+
from strawberry.types.unset import UNSET
|
|
44
45
|
from strawberry.utils.aio import asyncgen_to_list
|
|
45
46
|
from strawberry.utils.typing import eval_type, is_generic_alias, is_optional, is_union
|
|
46
47
|
|
|
@@ -375,9 +376,12 @@ if TYPE_CHECKING:
|
|
|
375
376
|
node = field
|
|
376
377
|
else:
|
|
377
378
|
|
|
378
|
-
def node(*args: Any, **kwargs: Any) -> StrawberryField:
|
|
379
|
+
def node(*args: Any, default: Any = UNSET, **kwargs: Any) -> StrawberryField:
|
|
379
380
|
kwargs["extensions"] = [*kwargs.get("extensions", []), NodeExtension()]
|
|
380
|
-
|
|
381
|
+
# The default value is a stub for dataclasses so you can instantiate
|
|
382
|
+
# types with relay.node() fields without explicit initialization.
|
|
383
|
+
# The actual value is resolved by the NodeExtension resolver.
|
|
384
|
+
return field(*args, default=default, **kwargs)
|
|
381
385
|
|
|
382
386
|
|
|
383
387
|
# we used to have `Type[Connection[NodeType]]` here, but that when we added
|
strawberry/types/union.py
CHANGED
|
@@ -206,6 +206,14 @@ class StrawberryUnion(StrawberryType):
|
|
|
206
206
|
else:
|
|
207
207
|
return_type = None
|
|
208
208
|
|
|
209
|
+
# If we couldn't resolve from type matching, try using is_type_of
|
|
210
|
+
if return_type is None:
|
|
211
|
+
for inner_type in type_.types:
|
|
212
|
+
if inner_type.is_type_of is not None and inner_type.is_type_of(
|
|
213
|
+
root, info
|
|
214
|
+
):
|
|
215
|
+
return inner_type.name
|
|
216
|
+
|
|
209
217
|
# Make sure the found type is expected by the Union
|
|
210
218
|
if return_type is None or return_type not in type_.types:
|
|
211
219
|
raise UnallowedReturnTypeForUnion(
|
|
@@ -162,7 +162,7 @@ strawberry/quart/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,
|
|
|
162
162
|
strawberry/quart/views.py,sha256=g0rs3UwFmqxt1DDZpAUF8qHIpT_g-AYwO-t8K-V3AE4,6680
|
|
163
163
|
strawberry/relay/__init__.py,sha256=Vi4btvA_g6Cj9Tk_F9GCSegapIf2WqkOWV8y3P0cTCs,553
|
|
164
164
|
strawberry/relay/exceptions.py,sha256=Bk9pPFbb28tDjUiydHa-tFl-e01XukxmJeWoWT9L17M,4017
|
|
165
|
-
strawberry/relay/fields.py,sha256=
|
|
165
|
+
strawberry/relay/fields.py,sha256=qn7dcZfDeZ6EhRn27pOto2bJrlbjTZwl9I_9E6IPIgw,18697
|
|
166
166
|
strawberry/relay/types.py,sha256=-yJ_jpGKPH_CNycWPmXMyn7GjN3MbDcWYvb0dt2VD2Y,30340
|
|
167
167
|
strawberry/relay/utils.py,sha256=ARuQfTNKiIFztaqUYHQs74Wfx-075udJ7NGDeTHUFB8,5541
|
|
168
168
|
strawberry/resolvers.py,sha256=j2sIi-jI2PrnO3if202l8VBuwQQxblPgRupEaDUu-lA,287
|
|
@@ -227,7 +227,7 @@ strawberry/types/object_type.py,sha256=CTBVBM7wD4y76lC_2mTFnpdTqADEA7nFIRrF93Uhv
|
|
|
227
227
|
strawberry/types/private.py,sha256=DhJs50XVGtOXlxWZFkRpMxQ5_6oki0-x_WQsV1bGUxk,518
|
|
228
228
|
strawberry/types/scalar.py,sha256=OgWRFV5x-qTM4-FJC-sAKix-DhMtGRrJTxU7ry4VOlA,8651
|
|
229
229
|
strawberry/types/type_resolver.py,sha256=fH2ZOK4dAGgu8AMPi-JAXe_kEAbvvw2MCYXqbpx-kTc,6529
|
|
230
|
-
strawberry/types/union.py,sha256=
|
|
230
|
+
strawberry/types/union.py,sha256=u3BXW1NNmgnO6VSTpXWqwo_V47_P1p7WA6VRYqj8cSA,10517
|
|
231
231
|
strawberry/types/unset.py,sha256=7DVK-WWxVLo41agvavTvIbphE42BmY8UpGolXfasIvw,1682
|
|
232
232
|
strawberry/utils/__init__.py,sha256=wuuNvKjcMfE0l4lqrlC-cc0_SR4hV19gNBJ3Mcn7l3A,141
|
|
233
233
|
strawberry/utils/aio.py,sha256=Nc-h2siURQKTUER3olm1ltOn2wd7ZehQ1FDICYOeboI,2201
|
|
@@ -240,8 +240,8 @@ strawberry/utils/logging.py,sha256=Dnivjd0ZhK_lAvjvuyCDkEWDhuURBoK9d3Kt_mIqbRg,7
|
|
|
240
240
|
strawberry/utils/operation.py,sha256=Qs3ttbuC415xEVqmJ6YsWQpJNUo8CZJq9AoMB-yV65w,1215
|
|
241
241
|
strawberry/utils/str_converters.py,sha256=-eH1Cl16IO_wrBlsGM-km4IY0IKsjhjnSNGRGOwQjVM,897
|
|
242
242
|
strawberry/utils/typing.py,sha256=eE9NeMfASeXRstbjLnQFfOPymcSX8xwg3FGw_HCp95E,11828
|
|
243
|
-
strawberry_graphql-0.289.
|
|
244
|
-
strawberry_graphql-0.289.
|
|
245
|
-
strawberry_graphql-0.289.
|
|
246
|
-
strawberry_graphql-0.289.
|
|
247
|
-
strawberry_graphql-0.289.
|
|
243
|
+
strawberry_graphql-0.289.5.dist-info/METADATA,sha256=xxAghPw6aK0I3sFAcrz_taj0aGZ4lwFlj-DZaL2cuuA,7394
|
|
244
|
+
strawberry_graphql-0.289.5.dist-info/WHEEL,sha256=3ny-bZhpXrU6vSQ1UPG34FoxZBp3lVcvK0LkgUz6VLk,88
|
|
245
|
+
strawberry_graphql-0.289.5.dist-info/entry_points.txt,sha256=Nk7-aT3_uEwCgyqtHESV9H6Mc31cK-VAvhnQNTzTb4k,49
|
|
246
|
+
strawberry_graphql-0.289.5.dist-info/licenses/LICENSE,sha256=m-XnIVUKqlG_AWnfi9NReh9JfKhYOB-gJfKE45WM1W8,1072
|
|
247
|
+
strawberry_graphql-0.289.5.dist-info/RECORD,,
|
|
File without changes
|
{strawberry_graphql-0.289.3.dist-info → strawberry_graphql-0.289.5.dist-info}/entry_points.txt
RENAMED
|
File without changes
|
{strawberry_graphql-0.289.3.dist-info → strawberry_graphql-0.289.5.dist-info}/licenses/LICENSE
RENAMED
|
File without changes
|