strawberry-graphql 0.289.1__py3-none-any.whl → 0.289.3__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/schema/schema_converter.py +7 -7
- strawberry/types/lazy_type.py +10 -1
- {strawberry_graphql-0.289.1.dist-info → strawberry_graphql-0.289.3.dist-info}/METADATA +1 -2
- {strawberry_graphql-0.289.1.dist-info → strawberry_graphql-0.289.3.dist-info}/RECORD +7 -7
- {strawberry_graphql-0.289.1.dist-info → strawberry_graphql-0.289.3.dist-info}/WHEEL +0 -0
- {strawberry_graphql-0.289.1.dist-info → strawberry_graphql-0.289.3.dist-info}/entry_points.txt +0 -0
- {strawberry_graphql-0.289.1.dist-info → strawberry_graphql-0.289.3.dist-info}/licenses/LICENSE +0 -0
|
@@ -870,12 +870,6 @@ class GraphQLCoreConverter:
|
|
|
870
870
|
if compat.is_graphql_generic(type_):
|
|
871
871
|
raise MissingTypesForGenericError(type_)
|
|
872
872
|
|
|
873
|
-
# to handle lazy unions
|
|
874
|
-
if typing.get_origin(type_) is Annotated:
|
|
875
|
-
args = typing.get_args(type_)
|
|
876
|
-
if len(args) >= 2 and isinstance(args[1], StrawberryUnion):
|
|
877
|
-
type_ = args[1]
|
|
878
|
-
|
|
879
873
|
if isinstance(type_, StrawberryEnumDefinition):
|
|
880
874
|
return self.from_enum(type_)
|
|
881
875
|
if compat.is_input_type(type_): # TODO: Replace with StrawberryInputObject
|
|
@@ -897,7 +891,13 @@ class GraphQLCoreConverter:
|
|
|
897
891
|
if isinstance(type_, StrawberryUnion):
|
|
898
892
|
return self.from_union(type_)
|
|
899
893
|
if isinstance(type_, LazyType):
|
|
900
|
-
|
|
894
|
+
resolved = type_.resolve_type()
|
|
895
|
+
# If the resolved type is an Annotated type (e.g., a union defined with
|
|
896
|
+
# the new syntax), run it through StrawberryAnnotation to properly
|
|
897
|
+
# resolve it. This ensures unions get their type_annotations populated.
|
|
898
|
+
if typing.get_origin(resolved) is Annotated:
|
|
899
|
+
return self.from_type(StrawberryAnnotation(resolved).resolve())
|
|
900
|
+
return self.from_type(resolved)
|
|
901
901
|
if compat.is_scalar(
|
|
902
902
|
type_, self.scalar_registry
|
|
903
903
|
): # TODO: Replace with StrawberryScalar
|
strawberry/types/lazy_type.py
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import importlib
|
|
2
|
+
import importlib.util
|
|
2
3
|
import inspect
|
|
3
4
|
import sys
|
|
4
5
|
import warnings
|
|
@@ -60,12 +61,19 @@ class LazyType(Generic[TypeName, Module]):
|
|
|
60
61
|
|
|
61
62
|
def resolve_type(self) -> type[Any]:
|
|
62
63
|
module = importlib.import_module(self.module, self.package)
|
|
64
|
+
|
|
65
|
+
# Resolve full module name for __main__ comparison
|
|
66
|
+
if self.package:
|
|
67
|
+
full_module_name = importlib.util.resolve_name(self.module, self.package)
|
|
68
|
+
else:
|
|
69
|
+
full_module_name = self.module
|
|
70
|
+
|
|
63
71
|
main_module = sys.modules.get("__main__", None)
|
|
64
72
|
if main_module:
|
|
65
73
|
# If lazy type points to the main module, use it instead of the imported
|
|
66
74
|
# module. Otherwise duplication checks during schema-conversion might fail.
|
|
67
75
|
# Refer to: https://github.com/strawberry-graphql/strawberry/issues/2397
|
|
68
|
-
if main_module.__spec__ and main_module.__spec__.name ==
|
|
76
|
+
if main_module.__spec__ and main_module.__spec__.name == full_module_name:
|
|
69
77
|
module = main_module
|
|
70
78
|
elif hasattr(main_module, "__file__") and hasattr(module, "__file__"):
|
|
71
79
|
main_file = main_module.__file__
|
|
@@ -78,6 +86,7 @@ class LazyType(Generic[TypeName, Module]):
|
|
|
78
86
|
# path contains `strawberry.exe`
|
|
79
87
|
is_samefile = False
|
|
80
88
|
module = main_module if is_samefile else module
|
|
89
|
+
|
|
81
90
|
return module.__dict__[self.type_name]
|
|
82
91
|
|
|
83
92
|
# this empty call method allows LazyTypes to be used in generic types
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: strawberry-graphql
|
|
3
|
-
Version: 0.289.
|
|
3
|
+
Version: 0.289.3
|
|
4
4
|
Summary: A library for creating GraphQL APIs
|
|
5
5
|
License: MIT
|
|
6
6
|
License-File: LICENSE
|
|
@@ -87,7 +87,6 @@ Description-Content-Type: text/markdown
|
|
|
87
87
|
|
|
88
88
|
> Python GraphQL library based on dataclasses
|
|
89
89
|
|
|
90
|
-
[](https://circleci.com/gh/strawberry-graphql/strawberry/tree/main)
|
|
91
90
|
[](https://discord.gg/ZkRTEJQ)
|
|
92
91
|
[](https://pypi.org/project/strawberry-graphql/)
|
|
93
92
|
|
|
@@ -179,7 +179,7 @@ strawberry/schema/config.py,sha256=1i80WOoml_9qzOV-kfcx-LYMXYwWYl0uisdcZX1vMEg,2
|
|
|
179
179
|
strawberry/schema/exceptions.py,sha256=SaEWtahVAg_f43coyg2h7H2UMZP10CZ_GJg72khBIAs,1105
|
|
180
180
|
strawberry/schema/name_converter.py,sha256=G3yOj-BmZ6E0bcvvSbb2cWu8ngsXi8M6W0c6rKROMjc,6933
|
|
181
181
|
strawberry/schema/schema.py,sha256=FKtqHGrOCnYMWhMwy1qWU_VXtw2IxyjpZZScL4PmVlg,39606
|
|
182
|
-
strawberry/schema/schema_converter.py,sha256=
|
|
182
|
+
strawberry/schema/schema_converter.py,sha256=RwSQaP8BeQVG9EXFrjawcemweaobrGrU6L7ScMT5xBM,40978
|
|
183
183
|
strawberry/schema/types/__init__.py,sha256=oHO3COWhL3L1KLYCJNY1XFf5xt2GGtHiMC-UaYbFfnA,68
|
|
184
184
|
strawberry/schema/types/base_scalars.py,sha256=ajMeN4W45AALhCnJO8MIisRb9slDZRyIl1S61LvHfSQ,2678
|
|
185
185
|
strawberry/schema/types/concrete_type.py,sha256=Z0oPu52dlAMcGYw4_ZCv3OSyoSLw2DxyoegK-GH8s0U,801
|
|
@@ -219,7 +219,7 @@ strawberry/types/fields/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG
|
|
|
219
219
|
strawberry/types/fields/resolver.py,sha256=sWG4nO8XpsvELna0uLU-rwKzUGiMgwHPzg8N7xRXqe4,16239
|
|
220
220
|
strawberry/types/graphql.py,sha256=gXKzawwKiow7hvoJhq5ApNJOMUCnKmvTiHaKY5CK1Lw,867
|
|
221
221
|
strawberry/types/info.py,sha256=1MTarr040KSsPPdrVx8sDHtKudEfH0LRgQ4adk_1FKA,4698
|
|
222
|
-
strawberry/types/lazy_type.py,sha256=
|
|
222
|
+
strawberry/types/lazy_type.py,sha256=Zwt_etpUp1bBfDNgWk3aamK6UUlnQGYmR8VDNYM-PoQ,5334
|
|
223
223
|
strawberry/types/maybe.py,sha256=ZBNHGDMuVcorpErPAMjJku4W3I2ygPf_3ZLw-N2O_UU,1610
|
|
224
224
|
strawberry/types/mutation.py,sha256=vcrKt1VpcS6SLl1WKfcR-NTAqfQ12LpzjwgT5Bx-U3Q,11549
|
|
225
225
|
strawberry/types/nodes.py,sha256=bM88j05rMIQ5OTS4RqKeU3kjo38MM-hA3Hrmh3IreV0,5121
|
|
@@ -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.3.dist-info/METADATA,sha256=vMusEjG-2fSGhOb2veBJSmUGo_hfZ1zSBwDzIQbboHU,7394
|
|
244
|
+
strawberry_graphql-0.289.3.dist-info/WHEEL,sha256=3ny-bZhpXrU6vSQ1UPG34FoxZBp3lVcvK0LkgUz6VLk,88
|
|
245
|
+
strawberry_graphql-0.289.3.dist-info/entry_points.txt,sha256=Nk7-aT3_uEwCgyqtHESV9H6Mc31cK-VAvhnQNTzTb4k,49
|
|
246
|
+
strawberry_graphql-0.289.3.dist-info/licenses/LICENSE,sha256=m-XnIVUKqlG_AWnfi9NReh9JfKhYOB-gJfKE45WM1W8,1072
|
|
247
|
+
strawberry_graphql-0.289.3.dist-info/RECORD,,
|
|
File without changes
|
{strawberry_graphql-0.289.1.dist-info → strawberry_graphql-0.289.3.dist-info}/entry_points.txt
RENAMED
|
File without changes
|
{strawberry_graphql-0.289.1.dist-info → strawberry_graphql-0.289.3.dist-info}/licenses/LICENSE
RENAMED
|
File without changes
|