strawberry-graphql 0.270.5__py3-none-any.whl → 0.271.0__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.
@@ -17,6 +17,7 @@ class StrawberryConfig:
17
17
  relay_use_legacy_global_id: bool = False
18
18
  disable_field_suggestions: bool = False
19
19
  info_class: type[Info] = Info
20
+ _unsafe_disable_same_type_validation: bool = False
20
21
 
21
22
  def __post_init__(
22
23
  self,
@@ -968,8 +968,11 @@ class GraphQLCoreConverter:
968
968
  def validate_same_type_definition(
969
969
  self, name: str, type_definition: StrawberryType, cached_type: ConcreteType
970
970
  ) -> None:
971
- # if the type definitions are the same we can return
972
- if cached_type.definition == type_definition:
971
+ # Skip validation if _unsafe_disable_same_type_validation is True
972
+ if (
973
+ self.config._unsafe_disable_same_type_validation
974
+ or cached_type.definition == type_definition
975
+ ):
973
976
  return
974
977
 
975
978
  # otherwise we need to check if we are dealing with different instances
@@ -50,15 +50,20 @@ def create_type(
50
50
  if not isinstance(field, StrawberryField):
51
51
  raise TypeError("Field is not an instance of StrawberryField")
52
52
 
53
- if field.python_name is None:
53
+ # Fields created using `strawberry.field` without a resolver don't have a
54
+ # `python_name`. In that case, we fall back to the field's `graphql_name`
55
+ # set via the `name` argument passed to `strawberry.field`.
56
+ field_name = field.python_name or field.graphql_name
57
+
58
+ if field_name is None:
54
59
  raise ValueError(
55
60
  "Field doesn't have a name. Fields passed to "
56
61
  "`create_type` must define a name by passing the "
57
62
  "`name` argument to `strawberry.field`."
58
63
  )
59
64
 
60
- namespace[field.python_name] = field
61
- annotations[field.python_name] = field.type
65
+ namespace[field_name] = field
66
+ annotations[field_name] = field.type
62
67
 
63
68
  namespace["__annotations__"] = annotations # type: ignore
64
69
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: strawberry-graphql
3
- Version: 0.270.5
3
+ Version: 0.271.0
4
4
  Summary: A library for creating GraphQL APIs
5
5
  License: MIT
6
6
  Keywords: graphql,api,rest,starlette,async
@@ -165,11 +165,11 @@ strawberry/scalars.py,sha256=CGkG8CIfurXiYhidmW3qwy6M5BF_Mhih3wAEcWx_iBU,2278
165
165
  strawberry/schema/__init__.py,sha256=u1QCyDVQExUVDA20kyosKPz3TS5HMCN2NrXclhiFAL4,92
166
166
  strawberry/schema/base.py,sha256=wqvEOQ_aVkfebk9SlG9zg1YXl3MlwxGZhxFRoIkAxu0,4053
167
167
  strawberry/schema/compat.py,sha256=xNpOEDfi-MODpplMGaKuKeQIVcr-tcAaKaU3TlBc1Zs,1873
168
- strawberry/schema/config.py,sha256=KeZ1Pc1gvYK0fOx9Aghx7m0Av8sWexycl3HJGFgHPvg,969
168
+ strawberry/schema/config.py,sha256=6d2MPrAgq97-7aze555dRcB3yw-aeUexYMP3KVN22c0,1024
169
169
  strawberry/schema/exceptions.py,sha256=xXq-2wXfeGualEJObXja6yVIKzFTh_iDXCIWttpIOSE,769
170
170
  strawberry/schema/name_converter.py,sha256=xFOXEgqldFkxXRkIQvsJN1dPkWbEUaIrTYNOMYSEVwQ,6945
171
171
  strawberry/schema/schema.py,sha256=pTs_dfhqsftecPblY_jCPU7my8RKB1QnleicCJL35WE,37287
172
- strawberry/schema/schema_converter.py,sha256=_lKctaIfNcncVCan8AElYngGxMS8vf4Wy27tXfkr0Mk,39011
172
+ strawberry/schema/schema_converter.py,sha256=vxFghA8c4vPLx0XM07gjIbWqMWUnaognzmsuCWTSkTk,39112
173
173
  strawberry/schema/types/__init__.py,sha256=oHO3COWhL3L1KLYCJNY1XFf5xt2GGtHiMC-UaYbFfnA,68
174
174
  strawberry/schema/types/base_scalars.py,sha256=JRUq0WjEkR9dFewstZnqnZKp0uOEipo4UXNF5dzRf4M,1971
175
175
  strawberry/schema/types/concrete_type.py,sha256=axIyFZgdwNv-XYkiqX67464wuFX6Vp0jYATwnBZSUvM,750
@@ -193,7 +193,7 @@ strawberry/subscriptions/protocols/graphql_ws/types.py,sha256=Uumiz-1O5qQnx-ERBa
193
193
  strawberry/test/__init__.py,sha256=lKVbKJDBnrYSPYHIKrg54UpaZcSoL93Z01zOpA1IzZM,115
194
194
  strawberry/test/client.py,sha256=ILAttb6A3jplH5wJNMeyyT1u_Q8KnollfpYLP_BVZR4,6438
195
195
  strawberry/tools/__init__.py,sha256=pdGpZx8wpq03VfUZJyF9JtYxZhGqzzxCiipsalWxJX4,127
196
- strawberry/tools/create_type.py,sha256=--DgfZOmXJBKGcVxehNISyvpw1HzwFvRtUUPc0634MA,2056
196
+ strawberry/tools/create_type.py,sha256=y10LgJnWDFtZB-xHLqpVg5ySqvz5KSFC6PNflogie1Q,2329
197
197
  strawberry/tools/merge_types.py,sha256=hUMRRNM28FyPp70jRA3d4svv9WoEBjaNpihBt3DaY0I,1023
198
198
  strawberry/types/__init__.py,sha256=baWEdDkkmCcITOhkg2hNUOenrNV1OYdxGE5qgvIRwwU,351
199
199
  strawberry/types/arguments.py,sha256=DVouyH70uvTcFP3PmRzo8QdMThoqXdigJbWE9Lgn5pU,9849
@@ -230,8 +230,8 @@ strawberry/utils/logging.py,sha256=U1cseHGquN09YFhFmRkiphfASKCyK0HUZREImPgVb0c,7
230
230
  strawberry/utils/operation.py,sha256=s7ajvLg_q6v2mg47kEMQPjO_J-XluMKTCwo4d47mGvE,1195
231
231
  strawberry/utils/str_converters.py,sha256=-eH1Cl16IO_wrBlsGM-km4IY0IKsjhjnSNGRGOwQjVM,897
232
232
  strawberry/utils/typing.py,sha256=SDvX-Du-9HAV3-XXjqi7Q5f5qPDDFd_gASIITiwBQT4,14073
233
- strawberry_graphql-0.270.5.dist-info/LICENSE,sha256=m-XnIVUKqlG_AWnfi9NReh9JfKhYOB-gJfKE45WM1W8,1072
234
- strawberry_graphql-0.270.5.dist-info/METADATA,sha256=HjkrVU8BGAhcdblmyYS4Gt5lP6Y-ezKEL7ElpOUtQa8,7757
235
- strawberry_graphql-0.270.5.dist-info/WHEEL,sha256=b4K_helf-jlQoXBBETfwnf4B04YC67LOev0jo4fX5m8,88
236
- strawberry_graphql-0.270.5.dist-info/entry_points.txt,sha256=Nk7-aT3_uEwCgyqtHESV9H6Mc31cK-VAvhnQNTzTb4k,49
237
- strawberry_graphql-0.270.5.dist-info/RECORD,,
233
+ strawberry_graphql-0.271.0.dist-info/LICENSE,sha256=m-XnIVUKqlG_AWnfi9NReh9JfKhYOB-gJfKE45WM1W8,1072
234
+ strawberry_graphql-0.271.0.dist-info/METADATA,sha256=IMDTxh0PwC-tCi621n_zT2Y7m5-hkdc4qN6Xp3opVa4,7757
235
+ strawberry_graphql-0.271.0.dist-info/WHEEL,sha256=b4K_helf-jlQoXBBETfwnf4B04YC67LOev0jo4fX5m8,88
236
+ strawberry_graphql-0.271.0.dist-info/entry_points.txt,sha256=Nk7-aT3_uEwCgyqtHESV9H6Mc31cK-VAvhnQNTzTb4k,49
237
+ strawberry_graphql-0.271.0.dist-info/RECORD,,