strawberry-graphql 0.268.1__py3-none-any.whl → 0.268.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.
@@ -270,10 +270,7 @@ class GraphQLCoreConverter:
270
270
  GlobalID,
271
271
  name=global_id_name,
272
272
  description=GraphQLID.description,
273
- parse_literal=lambda v, vars=None: GlobalID.from_id( # noqa: A006
274
- GraphQLID.parse_literal(v, vars)
275
- ),
276
- parse_value=GlobalID.from_id,
273
+ parse_value=lambda v: v,
277
274
  serialize=str,
278
275
  specified_by_url=("https://relay.dev/graphql/objectidentification.htm"),
279
276
  )
@@ -803,6 +800,13 @@ class GraphQLCoreConverter:
803
800
  return _resolver
804
801
 
805
802
  def from_scalar(self, scalar: type) -> GraphQLScalarType:
803
+ from strawberry.relay.types import GlobalID
804
+
805
+ if not self.config.relay_use_legacy_global_id and scalar is GlobalID:
806
+ from strawberry import ID
807
+
808
+ return self.from_scalar(ID)
809
+
806
810
  scalar_definition: ScalarDefinition
807
811
 
808
812
  if scalar in self.scalar_registry:
@@ -817,21 +821,13 @@ class GraphQLCoreConverter:
817
821
 
818
822
  scalar_name = self.config.name_converter.from_type(scalar_definition)
819
823
 
820
- from strawberry.relay import GlobalID
821
-
822
824
  if scalar_name not in self.type_map:
823
- if scalar is GlobalID and hasattr(GraphQLNamedType, "reserved_types"):
824
- GraphQLNamedType.reserved_types.pop("ID")
825
-
826
825
  implementation = (
827
826
  scalar_definition.implementation
828
827
  if scalar_definition.implementation is not None
829
828
  else _make_scalar_type(scalar_definition)
830
829
  )
831
830
 
832
- if scalar is GlobalID and hasattr(GraphQLNamedType, "reserved_types"):
833
- GraphQLNamedType.reserved_types["ID"] = implementation
834
-
835
831
  self.type_map[scalar_name] = ConcreteType(
836
832
  definition=scalar_definition, implementation=implementation
837
833
  )
@@ -841,17 +837,7 @@ class GraphQLCoreConverter:
841
837
  # TODO: the other definition might not be a scalar, we should
842
838
  # handle this case better, since right now we assume it is a scalar
843
839
 
844
- # special case to allow GlobalID to be used as an ID scalar
845
- # TODO: we need to find a better way to handle this, might be
846
- # worth reworking our scalar implementation.
847
- if (
848
- hasattr(other_definition, "origin")
849
- and hasattr(scalar_definition, "origin")
850
- and other_definition.origin == GlobalID
851
- and scalar_definition.origin == GraphQLID
852
- ):
853
- pass
854
- elif other_definition != scalar_definition:
840
+ if other_definition != scalar_definition:
855
841
  other_definition = cast("ScalarDefinition", other_definition)
856
842
 
857
843
  raise ScalarAlreadyRegisteredError(scalar_definition, other_definition)
@@ -170,6 +170,11 @@ def convert_argument(
170
170
  ]
171
171
 
172
172
  if is_scalar(type_, scalar_registry):
173
+ from strawberry.relay.types import GlobalID
174
+
175
+ if type_ is GlobalID:
176
+ return GlobalID.from_id(value) # type: ignore
177
+
173
178
  return value
174
179
 
175
180
  if isinstance(type_, EnumDefinition):
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: strawberry-graphql
3
- Version: 0.268.1
3
+ Version: 0.268.2
4
4
  Summary: A library for creating GraphQL APIs
5
5
  License: MIT
6
6
  Keywords: graphql,api,rest,starlette,async
@@ -168,7 +168,7 @@ strawberry/schema/config.py,sha256=KeZ1Pc1gvYK0fOx9Aghx7m0Av8sWexycl3HJGFgHPvg,9
168
168
  strawberry/schema/exceptions.py,sha256=rqVNb_oYrKM0dHPgvAemqCG6Um282LPPu4zwQ5cZqs4,584
169
169
  strawberry/schema/name_converter.py,sha256=xFOXEgqldFkxXRkIQvsJN1dPkWbEUaIrTYNOMYSEVwQ,6945
170
170
  strawberry/schema/schema.py,sha256=rDfNclXSRHqn3NNGzPAovZoVeMh0VC5wVCCUprwZJV8,34215
171
- strawberry/schema/schema_converter.py,sha256=u12Og8eUX8SNMtJB6LYkj9zEpoQs-rDOXpN7tU8JG7k,39785
171
+ strawberry/schema/schema_converter.py,sha256=_lKctaIfNcncVCan8AElYngGxMS8vf4Wy27tXfkr0Mk,39011
172
172
  strawberry/schema/types/__init__.py,sha256=oHO3COWhL3L1KLYCJNY1XFf5xt2GGtHiMC-UaYbFfnA,68
173
173
  strawberry/schema/types/base_scalars.py,sha256=JRUq0WjEkR9dFewstZnqnZKp0uOEipo4UXNF5dzRf4M,1971
174
174
  strawberry/schema/types/concrete_type.py,sha256=axIyFZgdwNv-XYkiqX67464wuFX6Vp0jYATwnBZSUvM,750
@@ -195,7 +195,7 @@ strawberry/tools/__init__.py,sha256=pdGpZx8wpq03VfUZJyF9JtYxZhGqzzxCiipsalWxJX4,
195
195
  strawberry/tools/create_type.py,sha256=--DgfZOmXJBKGcVxehNISyvpw1HzwFvRtUUPc0634MA,2056
196
196
  strawberry/tools/merge_types.py,sha256=hUMRRNM28FyPp70jRA3d4svv9WoEBjaNpihBt3DaY0I,1023
197
197
  strawberry/types/__init__.py,sha256=baWEdDkkmCcITOhkg2hNUOenrNV1OYdxGE5qgvIRwwU,351
198
- strawberry/types/arguments.py,sha256=Ut4H60a7SRuPtCUAa6gS6gJigaNqhCSesCPoeb0xDYE,9706
198
+ strawberry/types/arguments.py,sha256=DVouyH70uvTcFP3PmRzo8QdMThoqXdigJbWE9Lgn5pU,9849
199
199
  strawberry/types/auto.py,sha256=WZ2cQAI8nREUigBzpzFqIKGjJ_C2VqpAPNe8vPjTciM,3007
200
200
  strawberry/types/base.py,sha256=tZSqxtrxXa1Y964HS2uakCbCgLyGO9A4WpODiegWzF8,15122
201
201
  strawberry/types/cast.py,sha256=fx86MkLW77GIximBAwUk5vZxSGwDqUA6XicXvz8EXwQ,916
@@ -229,8 +229,8 @@ strawberry/utils/logging.py,sha256=U1cseHGquN09YFhFmRkiphfASKCyK0HUZREImPgVb0c,7
229
229
  strawberry/utils/operation.py,sha256=s7ajvLg_q6v2mg47kEMQPjO_J-XluMKTCwo4d47mGvE,1195
230
230
  strawberry/utils/str_converters.py,sha256=-eH1Cl16IO_wrBlsGM-km4IY0IKsjhjnSNGRGOwQjVM,897
231
231
  strawberry/utils/typing.py,sha256=SDvX-Du-9HAV3-XXjqi7Q5f5qPDDFd_gASIITiwBQT4,14073
232
- strawberry_graphql-0.268.1.dist-info/LICENSE,sha256=m-XnIVUKqlG_AWnfi9NReh9JfKhYOB-gJfKE45WM1W8,1072
233
- strawberry_graphql-0.268.1.dist-info/METADATA,sha256=0KP8VbWiBIyL4DP__ItZildr2PoqR_WjXmRoTc_9PDE,7679
234
- strawberry_graphql-0.268.1.dist-info/WHEEL,sha256=b4K_helf-jlQoXBBETfwnf4B04YC67LOev0jo4fX5m8,88
235
- strawberry_graphql-0.268.1.dist-info/entry_points.txt,sha256=Nk7-aT3_uEwCgyqtHESV9H6Mc31cK-VAvhnQNTzTb4k,49
236
- strawberry_graphql-0.268.1.dist-info/RECORD,,
232
+ strawberry_graphql-0.268.2.dist-info/LICENSE,sha256=m-XnIVUKqlG_AWnfi9NReh9JfKhYOB-gJfKE45WM1W8,1072
233
+ strawberry_graphql-0.268.2.dist-info/METADATA,sha256=45ElBfI-81g2FDxOJvFsTe603lAjC06OFzlKGxBXfFg,7679
234
+ strawberry_graphql-0.268.2.dist-info/WHEEL,sha256=b4K_helf-jlQoXBBETfwnf4B04YC67LOev0jo4fX5m8,88
235
+ strawberry_graphql-0.268.2.dist-info/entry_points.txt,sha256=Nk7-aT3_uEwCgyqtHESV9H6Mc31cK-VAvhnQNTzTb4k,49
236
+ strawberry_graphql-0.268.2.dist-info/RECORD,,