strawberry-graphql 0.288.1__py3-none-any.whl → 0.288.2__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/types/maybe.py +5 -2
- strawberry/types/object_type.py +9 -2
- {strawberry_graphql-0.288.1.dist-info → strawberry_graphql-0.288.2.dist-info}/METADATA +1 -1
- {strawberry_graphql-0.288.1.dist-info → strawberry_graphql-0.288.2.dist-info}/RECORD +7 -7
- {strawberry_graphql-0.288.1.dist-info → strawberry_graphql-0.288.2.dist-info}/WHEEL +0 -0
- {strawberry_graphql-0.288.1.dist-info → strawberry_graphql-0.288.2.dist-info}/entry_points.txt +0 -0
- {strawberry_graphql-0.288.1.dist-info → strawberry_graphql-0.288.2.dist-info}/licenses/LICENSE +0 -0
strawberry/types/maybe.py
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import re
|
|
2
2
|
import typing
|
|
3
|
-
from typing import TYPE_CHECKING, Any, Generic, TypeAlias, TypeVar
|
|
3
|
+
from typing import TYPE_CHECKING, Annotated, Any, Generic, TypeAlias, TypeVar
|
|
4
4
|
|
|
5
5
|
T = TypeVar("T")
|
|
6
6
|
|
|
@@ -47,7 +47,10 @@ def _annotation_is_maybe(annotation: Any) -> bool:
|
|
|
47
47
|
# Checking for the pattern should be good enough for now.
|
|
48
48
|
return _maybe_re.match(annotation) is not None
|
|
49
49
|
|
|
50
|
-
|
|
50
|
+
orig = typing.get_origin(annotation)
|
|
51
|
+
if orig is Annotated:
|
|
52
|
+
return _annotation_is_maybe(typing.get_args(annotation)[0])
|
|
53
|
+
return orig is Maybe
|
|
51
54
|
|
|
52
55
|
|
|
53
56
|
__all__ = [
|
strawberry/types/object_type.py
CHANGED
|
@@ -109,8 +109,15 @@ def _inject_default_for_maybe_annotations(
|
|
|
109
109
|
) -> None:
|
|
110
110
|
"""Inject `= None` for fields with `Maybe` annotations and no default value."""
|
|
111
111
|
for name, annotation in annotations.copy().items():
|
|
112
|
-
if _annotation_is_maybe(annotation)
|
|
113
|
-
|
|
112
|
+
if _annotation_is_maybe(annotation):
|
|
113
|
+
if not hasattr(cls, name):
|
|
114
|
+
setattr(cls, name, None)
|
|
115
|
+
elif (
|
|
116
|
+
isinstance(attr := getattr(cls, name), StrawberryField)
|
|
117
|
+
and attr.default is dataclasses.MISSING
|
|
118
|
+
and attr.default_factory is dataclasses.MISSING
|
|
119
|
+
):
|
|
120
|
+
attr.default = None
|
|
114
121
|
|
|
115
122
|
|
|
116
123
|
def _process_type(
|
|
@@ -218,10 +218,10 @@ strawberry/types/fields/resolver.py,sha256=sWG4nO8XpsvELna0uLU-rwKzUGiMgwHPzg8N7
|
|
|
218
218
|
strawberry/types/graphql.py,sha256=gXKzawwKiow7hvoJhq5ApNJOMUCnKmvTiHaKY5CK1Lw,867
|
|
219
219
|
strawberry/types/info.py,sha256=1MTarr040KSsPPdrVx8sDHtKudEfH0LRgQ4adk_1FKA,4698
|
|
220
220
|
strawberry/types/lazy_type.py,sha256=GYy4PnKtZ48ywW-_A-6Ul8sbHRlB0Tc39ui5DMIja4U,5077
|
|
221
|
-
strawberry/types/maybe.py,sha256=
|
|
221
|
+
strawberry/types/maybe.py,sha256=ZBNHGDMuVcorpErPAMjJku4W3I2ygPf_3ZLw-N2O_UU,1610
|
|
222
222
|
strawberry/types/mutation.py,sha256=vcrKt1VpcS6SLl1WKfcR-NTAqfQ12LpzjwgT5Bx-U3Q,11549
|
|
223
223
|
strawberry/types/nodes.py,sha256=bM88j05rMIQ5OTS4RqKeU3kjo38MM-hA3Hrmh3IreV0,5121
|
|
224
|
-
strawberry/types/object_type.py,sha256=
|
|
224
|
+
strawberry/types/object_type.py,sha256=CTBVBM7wD4y76lC_2mTFnpdTqADEA7nFIRrF93UhvII,15457
|
|
225
225
|
strawberry/types/private.py,sha256=DhJs50XVGtOXlxWZFkRpMxQ5_6oki0-x_WQsV1bGUxk,518
|
|
226
226
|
strawberry/types/scalar.py,sha256=OgWRFV5x-qTM4-FJC-sAKix-DhMtGRrJTxU7ry4VOlA,8651
|
|
227
227
|
strawberry/types/type_resolver.py,sha256=fH2ZOK4dAGgu8AMPi-JAXe_kEAbvvw2MCYXqbpx-kTc,6529
|
|
@@ -238,8 +238,8 @@ strawberry/utils/logging.py,sha256=Dnivjd0ZhK_lAvjvuyCDkEWDhuURBoK9d3Kt_mIqbRg,7
|
|
|
238
238
|
strawberry/utils/operation.py,sha256=Qs3ttbuC415xEVqmJ6YsWQpJNUo8CZJq9AoMB-yV65w,1215
|
|
239
239
|
strawberry/utils/str_converters.py,sha256=-eH1Cl16IO_wrBlsGM-km4IY0IKsjhjnSNGRGOwQjVM,897
|
|
240
240
|
strawberry/utils/typing.py,sha256=eE9NeMfASeXRstbjLnQFfOPymcSX8xwg3FGw_HCp95E,11828
|
|
241
|
-
strawberry_graphql-0.288.
|
|
242
|
-
strawberry_graphql-0.288.
|
|
243
|
-
strawberry_graphql-0.288.
|
|
244
|
-
strawberry_graphql-0.288.
|
|
245
|
-
strawberry_graphql-0.288.
|
|
241
|
+
strawberry_graphql-0.288.2.dist-info/METADATA,sha256=yTioGirWqAPKtjL_NPw6AGSKPTXkUe0dhTUQkNtR-Nk,7647
|
|
242
|
+
strawberry_graphql-0.288.2.dist-info/WHEEL,sha256=zp0Cn7JsFoX2ATtOhtaFYIiE2rmFAD4OcMhtUki8W3U,88
|
|
243
|
+
strawberry_graphql-0.288.2.dist-info/entry_points.txt,sha256=Nk7-aT3_uEwCgyqtHESV9H6Mc31cK-VAvhnQNTzTb4k,49
|
|
244
|
+
strawberry_graphql-0.288.2.dist-info/licenses/LICENSE,sha256=m-XnIVUKqlG_AWnfi9NReh9JfKhYOB-gJfKE45WM1W8,1072
|
|
245
|
+
strawberry_graphql-0.288.2.dist-info/RECORD,,
|
|
File without changes
|
{strawberry_graphql-0.288.1.dist-info → strawberry_graphql-0.288.2.dist-info}/entry_points.txt
RENAMED
|
File without changes
|
{strawberry_graphql-0.288.1.dist-info → strawberry_graphql-0.288.2.dist-info}/licenses/LICENSE
RENAMED
|
File without changes
|