strawberry-graphql 0.290.0__py3-none-any.whl → 0.291.1__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.
@@ -1,4 +1,5 @@
1
1
  from collections.abc import Iterable
2
+ from typing import Any
2
3
 
3
4
  from strawberry.types.arguments import StrawberryArgumentAnnotation
4
5
 
@@ -10,6 +11,7 @@ def argument(
10
11
  directives: Iterable[object] = (),
11
12
  inaccessible: bool = False,
12
13
  tags: Iterable[str] | None = (),
14
+ graphql_type: Any | None = None,
13
15
  ) -> StrawberryArgumentAnnotation:
14
16
  from strawberry.federation.schema_directives import Inaccessible, Tag
15
17
 
@@ -26,6 +28,7 @@ def argument(
26
28
  name=name,
27
29
  deprecation_reason=deprecation_reason,
28
30
  directives=directives,
31
+ graphql_type=graphql_type,
29
32
  )
30
33
 
31
34
 
strawberry/test/client.py CHANGED
@@ -4,7 +4,7 @@ import json
4
4
  import warnings
5
5
  from abc import ABC, abstractmethod
6
6
  from dataclasses import dataclass
7
- from typing import TYPE_CHECKING, Any, Literal
7
+ from typing import TYPE_CHECKING, Any, Literal, TypeAlias
8
8
  from typing_extensions import TypedDict
9
9
 
10
10
  if TYPE_CHECKING:
@@ -13,11 +13,16 @@ if TYPE_CHECKING:
13
13
  from graphql import GraphQLFormattedError
14
14
 
15
15
 
16
+ JsonValue: TypeAlias = (
17
+ str | int | float | bool | list["JsonValue"] | dict[str, "JsonValue"]
18
+ )
19
+
20
+
16
21
  @dataclass
17
22
  class Response:
18
23
  errors: list[GraphQLFormattedError] | None
19
- data: dict[str, object] | None
20
- extensions: dict[str, object] | None
24
+ data: dict[str, JsonValue] | None
25
+ extensions: dict[str, JsonValue] | None
21
26
 
22
27
 
23
28
  class Body(TypedDict, total=False):
@@ -51,6 +51,7 @@ class StrawberryArgumentAnnotation:
51
51
  deprecation_reason: str | None
52
52
  directives: Iterable[object]
53
53
  metadata: Mapping[Any, Any]
54
+ graphql_type: Any | None
54
55
 
55
56
  def __init__(
56
57
  self,
@@ -59,12 +60,14 @@ class StrawberryArgumentAnnotation:
59
60
  deprecation_reason: str | None = None,
60
61
  directives: Iterable[object] = (),
61
62
  metadata: Mapping[Any, Any] | None = None,
63
+ graphql_type: Any | None = None,
62
64
  ) -> None:
63
65
  self.description = description
64
66
  self.name = name
65
67
  self.deprecation_reason = deprecation_reason
66
68
  self.directives = directives
67
69
  self.metadata = metadata or {}
70
+ self.graphql_type = graphql_type
68
71
 
69
72
 
70
73
  class StrawberryArgument:
@@ -122,6 +125,10 @@ class StrawberryArgument:
122
125
  self.deprecation_reason = arg.deprecation_reason
123
126
  self.directives = arg.directives
124
127
  self.metadata = arg.metadata
128
+ if arg.graphql_type is not None:
129
+ self.type_annotation = StrawberryAnnotation(
130
+ arg.graphql_type
131
+ )
125
132
 
126
133
  if isinstance(arg, StrawberryLazyReference):
127
134
  self.type_annotation = StrawberryAnnotation(
@@ -313,6 +320,7 @@ def argument(
313
320
  deprecation_reason: str | None = None,
314
321
  directives: Iterable[object] = (),
315
322
  metadata: Mapping[Any, Any] | None = None,
323
+ graphql_type: Any | None = None,
316
324
  ) -> StrawberryArgumentAnnotation:
317
325
  """Function to add metadata to an argument, like a description or deprecation reason.
318
326
 
@@ -324,6 +332,8 @@ def argument(
324
332
  directives: The directives to attach to the argument
325
333
  metadata: Metadata to attach to the argument, this can be used
326
334
  to store custom data that can be used by custom logic or plugins
335
+ graphql_type: The GraphQL type for the argument, useful when you want to use a
336
+ different type than the one in the schema.
327
337
 
328
338
  Returns:
329
339
  A StrawberryArgumentAnnotation object that can be used to customise an argument
@@ -348,6 +358,7 @@ def argument(
348
358
  deprecation_reason=deprecation_reason,
349
359
  directives=directives,
350
360
  metadata=metadata,
361
+ graphql_type=graphql_type,
351
362
  )
352
363
 
353
364
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: strawberry-graphql
3
- Version: 0.290.0
3
+ Version: 0.291.1
4
4
  Summary: A library for creating GraphQL APIs
5
5
  License: MIT
6
6
  License-File: LICENSE
@@ -121,7 +121,7 @@ strawberry/fastapi/__init__.py,sha256=p5qg9AlkYjNOWKcT4uRiebIpR6pIb1HqDMiDfF5O3t
121
121
  strawberry/fastapi/context.py,sha256=HXOpOwOpPMYbNgf7sQYvfNrqL7SQMNvtVvd6fiC2jKM,653
122
122
  strawberry/fastapi/router.py,sha256=sXovpiJUQapHdzBnQ71I4hqRGixSs7mYeLunkJYTeoU,11866
123
123
  strawberry/federation/__init__.py,sha256=Pw01N0rG9o0NaUxXLMNGeW5oLENeWVx_d8Kuef1ES4s,549
124
- strawberry/federation/argument.py,sha256=fFIoUZwEA8f4edmhzzIF_ytckiSrVkORU9vsQSMCSSo,820
124
+ strawberry/federation/argument.py,sha256=nvhaZCHlpZrKa7vtWMOc1zJybJxxqRK-a3k6CIJRnhE,915
125
125
  strawberry/federation/enum.py,sha256=RTGlUtwrDw0Iu_5yq3y_EmGlY6IqHRhepy9OPSHRbD4,3068
126
126
  strawberry/federation/field.py,sha256=xLnbTUoI1-a361Jte_mjp6LD_uD_sJWvZl3l6FBWNWo,8597
127
127
  strawberry/federation/mutation.py,sha256=5t2E419m4K2W6LoWEOzWgMdL2J0PwHnsffYkpChqqDQ,67
@@ -203,12 +203,12 @@ strawberry/subscriptions/protocols/graphql_ws/__init__.py,sha256=47DEQpj8HBSa-_T
203
203
  strawberry/subscriptions/protocols/graphql_ws/handlers.py,sha256=qMC5myBk5Ea1GHSyzBFGlED5yTb3t3B6RWG-fHwHtyI,8424
204
204
  strawberry/subscriptions/protocols/graphql_ws/types.py,sha256=rZwtRXmAPhZqxUwmycbGjgavYmC0fuvIs4jFfpekfc4,2021
205
205
  strawberry/test/__init__.py,sha256=lKVbKJDBnrYSPYHIKrg54UpaZcSoL93Z01zOpA1IzZM,115
206
- strawberry/test/client.py,sha256=qrw5WX_FNT7EX53kGdYxM6ToE33nM3_He-SuADeMU9Q,6355
206
+ strawberry/test/client.py,sha256=p85RJi1XFMdxYetOelDnJGnuMvHj8ha98GnAcQhgn5I,6475
207
207
  strawberry/tools/__init__.py,sha256=pdGpZx8wpq03VfUZJyF9JtYxZhGqzzxCiipsalWxJX4,127
208
208
  strawberry/tools/create_type.py,sha256=lYnqXMaecEWc0CtC2lGhX2mE--6S22q_V8GiIkHlGqw,2295
209
209
  strawberry/tools/merge_types.py,sha256=hUMRRNM28FyPp70jRA3d4svv9WoEBjaNpihBt3DaY0I,1023
210
210
  strawberry/types/__init__.py,sha256=baWEdDkkmCcITOhkg2hNUOenrNV1OYdxGE5qgvIRwwU,351
211
- strawberry/types/arguments.py,sha256=3Rt1WlVDMc0KKYmJOnMUckeTB0egJv96Uw7RMopM4DM,11996
211
+ strawberry/types/arguments.py,sha256=K3Pk1YO7LNJV7E8waVB_BSG-ACDsfTed_Txku1hyccQ,12530
212
212
  strawberry/types/auto.py,sha256=4sDflIg-Kz-QpK7Qo7bCSFblw7VE-0752rgayukFznU,2954
213
213
  strawberry/types/base.py,sha256=Hubo7u6OsU1v1v-w-vBCwlNVTqHaNn4zPOJuX93WR5U,15699
214
214
  strawberry/types/cast.py,sha256=fx86MkLW77GIximBAwUk5vZxSGwDqUA6XicXvz8EXwQ,916
@@ -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.290.0.dist-info/METADATA,sha256=Skq4-tPx5fwJcL5nfa7L_Ng2UofU90rIx0rHqlz9hpo,7394
244
- strawberry_graphql-0.290.0.dist-info/WHEEL,sha256=3ny-bZhpXrU6vSQ1UPG34FoxZBp3lVcvK0LkgUz6VLk,88
245
- strawberry_graphql-0.290.0.dist-info/entry_points.txt,sha256=Nk7-aT3_uEwCgyqtHESV9H6Mc31cK-VAvhnQNTzTb4k,49
246
- strawberry_graphql-0.290.0.dist-info/licenses/LICENSE,sha256=m-XnIVUKqlG_AWnfi9NReh9JfKhYOB-gJfKE45WM1W8,1072
247
- strawberry_graphql-0.290.0.dist-info/RECORD,,
243
+ strawberry_graphql-0.291.1.dist-info/METADATA,sha256=3Nn3R4BiOjoWFYuqp4dskN_Q2NvAdghKG9vXI3FBQY4,7394
244
+ strawberry_graphql-0.291.1.dist-info/WHEEL,sha256=kJCRJT_g0adfAJzTx2GUMmS80rTJIVHRCfG0DQgLq3o,88
245
+ strawberry_graphql-0.291.1.dist-info/entry_points.txt,sha256=Nk7-aT3_uEwCgyqtHESV9H6Mc31cK-VAvhnQNTzTb4k,49
246
+ strawberry_graphql-0.291.1.dist-info/licenses/LICENSE,sha256=m-XnIVUKqlG_AWnfi9NReh9JfKhYOB-gJfKE45WM1W8,1072
247
+ strawberry_graphql-0.291.1.dist-info/RECORD,,
@@ -1,4 +1,4 @@
1
1
  Wheel-Version: 1.0
2
- Generator: poetry-core 2.3.0
2
+ Generator: poetry-core 2.3.1
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any