strawberry-graphql 0.227.0.dev1713475585__py3-none-any.whl → 0.227.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.
- strawberry/channels/handlers/base.py +7 -14
- strawberry/codegen/query_codegen.py +2 -4
- strawberry/custom_scalar.py +2 -4
- strawberry/dataloader.py +2 -4
- strawberry/directive.py +1 -2
- strawberry/django/views.py +1 -1
- strawberry/enum.py +2 -4
- strawberry/experimental/pydantic/conversion_types.py +5 -10
- strawberry/experimental/pydantic/error_type.py +1 -1
- strawberry/experimental/pydantic/object_type.py +1 -1
- strawberry/ext/mypy_plugin.py +24 -1
- strawberry/federation/enum.py +2 -4
- strawberry/federation/field.py +3 -6
- strawberry/federation/object_type.py +8 -25
- strawberry/federation/scalar.py +2 -4
- strawberry/federation/schema_directive.py +1 -1
- strawberry/field.py +3 -6
- strawberry/http/async_base_view.py +12 -24
- strawberry/http/base.py +3 -6
- strawberry/http/sync_base_view.py +13 -26
- strawberry/litestar/controller.py +2 -2
- strawberry/object_type.py +32 -23
- strawberry/parent.py +1 -2
- strawberry/printer/printer.py +3 -6
- strawberry/private.py +1 -2
- strawberry/relay/fields.py +2 -4
- strawberry/relay/types.py +12 -24
- strawberry/schema/execute.py +0 -5
- strawberry/schema/schema.py +0 -11
- strawberry/schema/schema_converter.py +1 -35
- strawberry/schema_codegen/__init__.py +96 -87
- strawberry/schema_directive.py +1 -1
- strawberry/starlite/controller.py +2 -2
- strawberry/type.py +4 -12
- strawberry/types/type_resolver.py +9 -2
- strawberry/types/types.py +1 -13
- strawberry/utils/aio.py +1 -1
- strawberry/utils/typing.py +2 -4
- {strawberry_graphql-0.227.0.dev1713475585.dist-info → strawberry_graphql-0.227.1.dist-info}/METADATA +2 -1
- {strawberry_graphql-0.227.0.dev1713475585.dist-info → strawberry_graphql-0.227.1.dist-info}/RECORD +43 -46
- strawberry/schema/validation_rules/__init__.py +0 -0
- strawberry/schema/validation_rules/one_of.py +0 -80
- strawberry/schema_directives.py +0 -9
- {strawberry_graphql-0.227.0.dev1713475585.dist-info → strawberry_graphql-0.227.1.dist-info}/LICENSE +0 -0
- {strawberry_graphql-0.227.0.dev1713475585.dist-info → strawberry_graphql-0.227.1.dist-info}/WHEEL +0 -0
- {strawberry_graphql-0.227.0.dev1713475585.dist-info → strawberry_graphql-0.227.1.dist-info}/entry_points.txt +0 -0
@@ -33,32 +33,25 @@ class ChannelsLayer(Protocol): # pragma: no cover
|
|
33
33
|
|
34
34
|
extensions: List[Literal["groups", "flush"]]
|
35
35
|
|
36
|
-
async def send(self, channel: str, message: dict) -> None:
|
37
|
-
...
|
36
|
+
async def send(self, channel: str, message: dict) -> None: ...
|
38
37
|
|
39
|
-
async def receive(self, channel: str) -> dict:
|
40
|
-
...
|
38
|
+
async def receive(self, channel: str) -> dict: ...
|
41
39
|
|
42
|
-
async def new_channel(self, prefix: str = ...) -> str:
|
43
|
-
...
|
40
|
+
async def new_channel(self, prefix: str = ...) -> str: ...
|
44
41
|
|
45
42
|
# If groups extension is supported
|
46
43
|
|
47
44
|
group_expiry: int
|
48
45
|
|
49
|
-
async def group_add(self, group: str, channel: str) -> None:
|
50
|
-
...
|
46
|
+
async def group_add(self, group: str, channel: str) -> None: ...
|
51
47
|
|
52
|
-
async def group_discard(self, group: str, channel: str) -> None:
|
53
|
-
...
|
48
|
+
async def group_discard(self, group: str, channel: str) -> None: ...
|
54
49
|
|
55
|
-
async def group_send(self, group: str, message: dict) -> None:
|
56
|
-
...
|
50
|
+
async def group_send(self, group: str, message: dict) -> None: ...
|
57
51
|
|
58
52
|
# If flush extension is supported
|
59
53
|
|
60
|
-
async def flush(self) -> None:
|
61
|
-
...
|
54
|
+
async def flush(self) -> None: ...
|
62
55
|
|
63
56
|
|
64
57
|
class ChannelsConsumer(AsyncConsumer):
|
@@ -139,11 +139,9 @@ class QueryCodegenPlugin:
|
|
139
139
|
"""
|
140
140
|
self.query = query
|
141
141
|
|
142
|
-
def on_start(self) -> None:
|
143
|
-
...
|
142
|
+
def on_start(self) -> None: ...
|
144
143
|
|
145
|
-
def on_end(self, result: CodegenResult) -> None:
|
146
|
-
...
|
144
|
+
def on_end(self, result: CodegenResult) -> None: ...
|
147
145
|
|
148
146
|
def generate_code(
|
149
147
|
self, types: List[GraphQLType], operation: GraphQLOperation
|
strawberry/custom_scalar.py
CHANGED
@@ -134,8 +134,7 @@ def scalar(
|
|
134
134
|
parse_value: Optional[Callable] = None,
|
135
135
|
parse_literal: Optional[Callable] = None,
|
136
136
|
directives: Iterable[object] = (),
|
137
|
-
) -> Callable[[_T], _T]:
|
138
|
-
...
|
137
|
+
) -> Callable[[_T], _T]: ...
|
139
138
|
|
140
139
|
|
141
140
|
@overload
|
@@ -149,8 +148,7 @@ def scalar(
|
|
149
148
|
parse_value: Optional[Callable] = None,
|
150
149
|
parse_literal: Optional[Callable] = None,
|
151
150
|
directives: Iterable[object] = (),
|
152
|
-
) -> _T:
|
153
|
-
...
|
151
|
+
) -> _T: ...
|
154
152
|
|
155
153
|
|
156
154
|
# TODO: We are tricking pyright into thinking that we are returning the given type
|
strawberry/dataloader.py
CHANGED
@@ -105,8 +105,7 @@ class DataLoader(Generic[K, T]):
|
|
105
105
|
loop: Optional[AbstractEventLoop] = None,
|
106
106
|
cache_map: Optional[AbstractCache[K, T]] = None,
|
107
107
|
cache_key_fn: Optional[Callable[[K], Hashable]] = None,
|
108
|
-
) -> None:
|
109
|
-
...
|
108
|
+
) -> None: ...
|
110
109
|
|
111
110
|
# fallback if load_fn is untyped and there's no other info for inference
|
112
111
|
@overload
|
@@ -118,8 +117,7 @@ class DataLoader(Generic[K, T]):
|
|
118
117
|
loop: Optional[AbstractEventLoop] = None,
|
119
118
|
cache_map: Optional[AbstractCache[K, T]] = None,
|
120
119
|
cache_key_fn: Optional[Callable[[K], Hashable]] = None,
|
121
|
-
) -> None:
|
122
|
-
...
|
120
|
+
) -> None: ...
|
123
121
|
|
124
122
|
def __init__(
|
125
123
|
self,
|
strawberry/directive.py
CHANGED
strawberry/django/views.py
CHANGED
@@ -54,7 +54,7 @@ class TemporalHttpResponse(JsonResponse):
|
|
54
54
|
if self.status_code is not None:
|
55
55
|
return super().__repr__()
|
56
56
|
|
57
|
-
return "<{cls} status_code={status_code}{content_type}>".format(
|
57
|
+
return "<{cls} status_code={status_code}{content_type}>".format( # noqa: UP032
|
58
58
|
cls=self.__class__.__name__,
|
59
59
|
status_code=self.status_code,
|
60
60
|
content_type=self._content_type_for_repr, # pyright: ignore
|
strawberry/enum.py
CHANGED
@@ -136,8 +136,7 @@ def enum(
|
|
136
136
|
name: Optional[str] = None,
|
137
137
|
description: Optional[str] = None,
|
138
138
|
directives: Iterable[object] = (),
|
139
|
-
) -> EnumType:
|
140
|
-
...
|
139
|
+
) -> EnumType: ...
|
141
140
|
|
142
141
|
|
143
142
|
@overload
|
@@ -147,8 +146,7 @@ def enum(
|
|
147
146
|
name: Optional[str] = None,
|
148
147
|
description: Optional[str] = None,
|
149
148
|
directives: Iterable[object] = (),
|
150
|
-
) -> Callable[[EnumType], EnumType]:
|
151
|
-
...
|
149
|
+
) -> Callable[[EnumType], EnumType]: ...
|
152
150
|
|
153
151
|
|
154
152
|
def enum(
|
@@ -16,22 +16,17 @@ class StrawberryTypeFromPydantic(Protocol[PydanticModel]):
|
|
16
16
|
"""This class does not exist in runtime.
|
17
17
|
It only makes the methods below visible for IDEs"""
|
18
18
|
|
19
|
-
def __init__(self, **kwargs: Any) -> None:
|
20
|
-
...
|
19
|
+
def __init__(self, **kwargs: Any) -> None: ...
|
21
20
|
|
22
21
|
@staticmethod
|
23
22
|
def from_pydantic(
|
24
23
|
instance: PydanticModel, extra: Optional[Dict[str, Any]] = None
|
25
|
-
) -> StrawberryTypeFromPydantic[PydanticModel]:
|
26
|
-
...
|
24
|
+
) -> StrawberryTypeFromPydantic[PydanticModel]: ...
|
27
25
|
|
28
|
-
def to_pydantic(self, **kwargs: Any) -> PydanticModel:
|
29
|
-
...
|
26
|
+
def to_pydantic(self, **kwargs: Any) -> PydanticModel: ...
|
30
27
|
|
31
28
|
@property
|
32
|
-
def __strawberry_definition__(self) -> StrawberryObjectDefinition:
|
33
|
-
...
|
29
|
+
def __strawberry_definition__(self) -> StrawberryObjectDefinition: ...
|
34
30
|
|
35
31
|
@property
|
36
|
-
def _pydantic_type(self) -> Type[PydanticModel]:
|
37
|
-
...
|
32
|
+
def _pydantic_type(self) -> Type[PydanticModel]: ...
|
@@ -114,7 +114,7 @@ def error_type(
|
|
114
114
|
]
|
115
115
|
|
116
116
|
wrapped = _wrap_dataclass(cls)
|
117
|
-
extra_fields = cast(List[dataclasses.Field], _get_fields(wrapped))
|
117
|
+
extra_fields = cast(List[dataclasses.Field], _get_fields(wrapped, {}))
|
118
118
|
private_fields = get_private_fields(wrapped)
|
119
119
|
|
120
120
|
all_model_fields.extend(
|
@@ -177,7 +177,7 @@ def type(
|
|
177
177
|
)
|
178
178
|
|
179
179
|
wrapped = _wrap_dataclass(cls)
|
180
|
-
extra_strawberry_fields = _get_fields(wrapped)
|
180
|
+
extra_strawberry_fields = _get_fields(wrapped, {})
|
181
181
|
extra_fields = cast(List[dataclasses.Field], extra_strawberry_fields)
|
182
182
|
private_fields = get_private_fields(wrapped)
|
183
183
|
|
strawberry/ext/mypy_plugin.py
CHANGED
@@ -11,6 +11,7 @@ from typing import (
|
|
11
11
|
List,
|
12
12
|
Optional,
|
13
13
|
Set,
|
14
|
+
Tuple,
|
14
15
|
Union,
|
15
16
|
cast,
|
16
17
|
)
|
@@ -59,11 +60,16 @@ try:
|
|
59
60
|
except ImportError:
|
60
61
|
TypeVarDef = TypeVarType
|
61
62
|
|
63
|
+
PYDANTIC_VERSION: Optional[Tuple[int, ...]] = None
|
64
|
+
|
62
65
|
# To be compatible with user who don't use pydantic
|
63
66
|
try:
|
67
|
+
import pydantic
|
64
68
|
from pydantic.mypy import METADATA_KEY as PYDANTIC_METADATA_KEY
|
65
69
|
from pydantic.mypy import PydanticModelField
|
66
70
|
|
71
|
+
PYDANTIC_VERSION = tuple(map(int, pydantic.__version__.split(".")))
|
72
|
+
|
67
73
|
from strawberry.experimental.pydantic._compat import IS_PYDANTIC_V1
|
68
74
|
except ImportError:
|
69
75
|
PYDANTIC_METADATA_KEY = ""
|
@@ -464,6 +470,11 @@ def strawberry_pydantic_class_callback(ctx: ClassDefContext) -> None:
|
|
464
470
|
return_type=model_type,
|
465
471
|
)
|
466
472
|
else:
|
473
|
+
extra = {}
|
474
|
+
|
475
|
+
if PYDANTIC_VERSION and PYDANTIC_VERSION >= (2, 7, 0):
|
476
|
+
extra["api"] = ctx.api
|
477
|
+
|
467
478
|
add_method(
|
468
479
|
ctx,
|
469
480
|
"to_pydantic",
|
@@ -474,6 +485,7 @@ def strawberry_pydantic_class_callback(ctx: ClassDefContext) -> None:
|
|
474
485
|
typed=True,
|
475
486
|
force_optional=False,
|
476
487
|
use_alias=True,
|
488
|
+
**extra,
|
477
489
|
)
|
478
490
|
for f in missing_pydantic_fields
|
479
491
|
],
|
@@ -487,12 +499,23 @@ def strawberry_pydantic_class_callback(ctx: ClassDefContext) -> None:
|
|
487
499
|
initializer=None,
|
488
500
|
kind=ARG_OPT,
|
489
501
|
)
|
502
|
+
extra_type = ctx.api.named_type(
|
503
|
+
"builtins.dict",
|
504
|
+
[ctx.api.named_type("builtins.str"), AnyType(TypeOfAny.explicit)],
|
505
|
+
)
|
506
|
+
|
507
|
+
extra_argument = Argument(
|
508
|
+
variable=Var(name="extra", type=UnionType([NoneType(), extra_type])),
|
509
|
+
type_annotation=UnionType([NoneType(), extra_type]),
|
510
|
+
initializer=None,
|
511
|
+
kind=ARG_OPT,
|
512
|
+
)
|
490
513
|
|
491
514
|
add_static_method_to_class(
|
492
515
|
ctx.api,
|
493
516
|
ctx.cls,
|
494
517
|
name="from_pydantic",
|
495
|
-
args=[model_argument],
|
518
|
+
args=[model_argument, extra_argument],
|
496
519
|
return_type=fill_typevars(ctx.cls.info),
|
497
520
|
)
|
498
521
|
|
strawberry/federation/enum.py
CHANGED
@@ -50,8 +50,7 @@ def enum(
|
|
50
50
|
policy: Optional[List[List[str]]] = None,
|
51
51
|
requires_scopes: Optional[List[List[str]]] = None,
|
52
52
|
tags: Optional[Iterable[str]] = (),
|
53
|
-
) -> EnumType:
|
54
|
-
...
|
53
|
+
) -> EnumType: ...
|
55
54
|
|
56
55
|
|
57
56
|
@overload
|
@@ -66,8 +65,7 @@ def enum(
|
|
66
65
|
policy: Optional[List[List[str]]] = None,
|
67
66
|
requires_scopes: Optional[List[List[str]]] = None,
|
68
67
|
tags: Optional[Iterable[str]] = (),
|
69
|
-
) -> Callable[[EnumType], EnumType]:
|
70
|
-
...
|
68
|
+
) -> Callable[[EnumType], EnumType]: ...
|
71
69
|
|
72
70
|
|
73
71
|
def enum(
|
strawberry/federation/field.py
CHANGED
@@ -55,8 +55,7 @@ def field(
|
|
55
55
|
directives: Sequence[object] = (),
|
56
56
|
extensions: Optional[List[FieldExtension]] = None,
|
57
57
|
graphql_type: Optional[Any] = None,
|
58
|
-
) -> T:
|
59
|
-
...
|
58
|
+
) -> T: ...
|
60
59
|
|
61
60
|
|
62
61
|
@overload
|
@@ -83,8 +82,7 @@ def field(
|
|
83
82
|
directives: Sequence[object] = (),
|
84
83
|
extensions: Optional[List[FieldExtension]] = None,
|
85
84
|
graphql_type: Optional[Any] = None,
|
86
|
-
) -> Any:
|
87
|
-
...
|
85
|
+
) -> Any: ...
|
88
86
|
|
89
87
|
|
90
88
|
@overload
|
@@ -111,8 +109,7 @@ def field(
|
|
111
109
|
directives: Sequence[object] = (),
|
112
110
|
extensions: Optional[List[FieldExtension]] = None,
|
113
111
|
graphql_type: Optional[Any] = None,
|
114
|
-
) -> StrawberryField:
|
115
|
-
...
|
112
|
+
) -> StrawberryField: ...
|
116
113
|
|
117
114
|
|
118
115
|
def field(
|
@@ -31,7 +31,6 @@ def _impl_type(
|
|
31
31
|
*,
|
32
32
|
name: Optional[str] = None,
|
33
33
|
description: Optional[str] = None,
|
34
|
-
one_of: Optional[bool] = None,
|
35
34
|
directives: Iterable[object] = (),
|
36
35
|
authenticated: bool = False,
|
37
36
|
keys: Iterable[Union["Key", str]] = (),
|
@@ -55,7 +54,6 @@ def _impl_type(
|
|
55
54
|
Shareable,
|
56
55
|
Tag,
|
57
56
|
)
|
58
|
-
from strawberry.schema_directives import OneOf
|
59
57
|
|
60
58
|
directives = list(directives)
|
61
59
|
|
@@ -85,9 +83,6 @@ def _impl_type(
|
|
85
83
|
if is_interface_object:
|
86
84
|
directives.append(InterfaceObject())
|
87
85
|
|
88
|
-
if one_of:
|
89
|
-
directives.append(OneOf())
|
90
|
-
|
91
86
|
return base_type( # type: ignore
|
92
87
|
cls,
|
93
88
|
name=name,
|
@@ -119,8 +114,7 @@ def type(
|
|
119
114
|
requires_scopes: Optional[List[List[str]]] = None,
|
120
115
|
shareable: bool = False,
|
121
116
|
tags: Iterable[str] = (),
|
122
|
-
) -> T:
|
123
|
-
...
|
117
|
+
) -> T: ...
|
124
118
|
|
125
119
|
|
126
120
|
@overload
|
@@ -142,8 +136,7 @@ def type(
|
|
142
136
|
requires_scopes: Optional[List[List[str]]] = None,
|
143
137
|
shareable: bool = False,
|
144
138
|
tags: Iterable[str] = (),
|
145
|
-
) -> Callable[[T], T]:
|
146
|
-
...
|
139
|
+
) -> Callable[[T], T]: ...
|
147
140
|
|
148
141
|
|
149
142
|
def type(
|
@@ -187,13 +180,11 @@ def input(
|
|
187
180
|
cls: T,
|
188
181
|
*,
|
189
182
|
name: Optional[str] = None,
|
190
|
-
one_of: Optional[bool] = None,
|
191
183
|
description: Optional[str] = None,
|
192
184
|
directives: Sequence[object] = (),
|
193
185
|
inaccessible: bool = UNSET,
|
194
186
|
tags: Iterable[str] = (),
|
195
|
-
) -> T:
|
196
|
-
...
|
187
|
+
) -> T: ...
|
197
188
|
|
198
189
|
|
199
190
|
@overload
|
@@ -206,19 +197,16 @@ def input(
|
|
206
197
|
*,
|
207
198
|
name: Optional[str] = None,
|
208
199
|
description: Optional[str] = None,
|
209
|
-
one_of: Optional[bool] = None,
|
210
200
|
directives: Sequence[object] = (),
|
211
201
|
inaccessible: bool = UNSET,
|
212
202
|
tags: Iterable[str] = (),
|
213
|
-
) -> Callable[[T], T]:
|
214
|
-
...
|
203
|
+
) -> Callable[[T], T]: ...
|
215
204
|
|
216
205
|
|
217
206
|
def input(
|
218
207
|
cls: Optional[T] = None,
|
219
208
|
*,
|
220
209
|
name: Optional[str] = None,
|
221
|
-
one_of: Optional[bool] = None,
|
222
210
|
description: Optional[str] = None,
|
223
211
|
directives: Sequence[object] = (),
|
224
212
|
inaccessible: bool = UNSET,
|
@@ -231,7 +219,6 @@ def input(
|
|
231
219
|
directives=directives,
|
232
220
|
inaccessible=inaccessible,
|
233
221
|
is_input=True,
|
234
|
-
one_of=one_of,
|
235
222
|
tags=tags,
|
236
223
|
)
|
237
224
|
|
@@ -254,8 +241,7 @@ def interface(
|
|
254
241
|
policy: Optional[List[List[str]]] = None,
|
255
242
|
requires_scopes: Optional[List[List[str]]] = None,
|
256
243
|
tags: Iterable[str] = (),
|
257
|
-
) -> T:
|
258
|
-
...
|
244
|
+
) -> T: ...
|
259
245
|
|
260
246
|
|
261
247
|
@overload
|
@@ -275,8 +261,7 @@ def interface(
|
|
275
261
|
policy: Optional[List[List[str]]] = None,
|
276
262
|
requires_scopes: Optional[List[List[str]]] = None,
|
277
263
|
tags: Iterable[str] = (),
|
278
|
-
) -> Callable[[T], T]:
|
279
|
-
...
|
264
|
+
) -> Callable[[T], T]: ...
|
280
265
|
|
281
266
|
|
282
267
|
def interface(
|
@@ -325,8 +310,7 @@ def interface_object(
|
|
325
310
|
policy: Optional[List[List[str]]] = None,
|
326
311
|
requires_scopes: Optional[List[List[str]]] = None,
|
327
312
|
tags: Iterable[str] = (),
|
328
|
-
) -> T:
|
329
|
-
...
|
313
|
+
) -> T: ...
|
330
314
|
|
331
315
|
|
332
316
|
@overload
|
@@ -346,8 +330,7 @@ def interface_object(
|
|
346
330
|
policy: Optional[List[List[str]]] = None,
|
347
331
|
requires_scopes: Optional[List[List[str]]] = None,
|
348
332
|
tags: Iterable[str] = (),
|
349
|
-
) -> Callable[[T], T]:
|
350
|
-
...
|
333
|
+
) -> Callable[[T], T]: ...
|
351
334
|
|
352
335
|
|
353
336
|
def interface_object(
|
strawberry/federation/scalar.py
CHANGED
@@ -40,8 +40,7 @@ def scalar(
|
|
40
40
|
policy: Optional[List[List[str]]] = None,
|
41
41
|
requires_scopes: Optional[List[List[str]]] = None,
|
42
42
|
tags: Optional[Iterable[str]] = (),
|
43
|
-
) -> Callable[[_T], _T]:
|
44
|
-
...
|
43
|
+
) -> Callable[[_T], _T]: ...
|
45
44
|
|
46
45
|
|
47
46
|
@overload
|
@@ -60,8 +59,7 @@ def scalar(
|
|
60
59
|
policy: Optional[List[List[str]]] = None,
|
61
60
|
requires_scopes: Optional[List[List[str]]] = None,
|
62
61
|
tags: Optional[Iterable[str]] = (),
|
63
|
-
) -> _T:
|
64
|
-
...
|
62
|
+
) -> _T: ...
|
65
63
|
|
66
64
|
|
67
65
|
def scalar(
|
@@ -39,7 +39,7 @@ def schema_directive(
|
|
39
39
|
) -> Callable[..., T]:
|
40
40
|
def _wrap(cls: T) -> T:
|
41
41
|
cls = _wrap_dataclass(cls)
|
42
|
-
fields = _get_fields(cls)
|
42
|
+
fields = _get_fields(cls, {})
|
43
43
|
|
44
44
|
cls.__strawberry_directive__ = StrawberryFederationSchemaDirective(
|
45
45
|
python_name=cls.__name__,
|
strawberry/field.py
CHANGED
@@ -432,8 +432,7 @@ def field(
|
|
432
432
|
directives: Optional[Sequence[object]] = (),
|
433
433
|
extensions: Optional[List[FieldExtension]] = None,
|
434
434
|
graphql_type: Optional[Any] = None,
|
435
|
-
) -> T:
|
436
|
-
...
|
435
|
+
) -> T: ...
|
437
436
|
|
438
437
|
|
439
438
|
@overload
|
@@ -451,8 +450,7 @@ def field(
|
|
451
450
|
directives: Optional[Sequence[object]] = (),
|
452
451
|
extensions: Optional[List[FieldExtension]] = None,
|
453
452
|
graphql_type: Optional[Any] = None,
|
454
|
-
) -> Any:
|
455
|
-
...
|
453
|
+
) -> Any: ...
|
456
454
|
|
457
455
|
|
458
456
|
@overload
|
@@ -470,8 +468,7 @@ def field(
|
|
470
468
|
directives: Optional[Sequence[object]] = (),
|
471
469
|
extensions: Optional[List[FieldExtension]] = None,
|
472
470
|
graphql_type: Optional[Any] = None,
|
473
|
-
) -> StrawberryField:
|
474
|
-
...
|
471
|
+
) -> StrawberryField: ...
|
475
472
|
|
476
473
|
|
477
474
|
def field(
|
@@ -31,31 +31,25 @@ from .typevars import Context, Request, Response, RootValue, SubResponse
|
|
31
31
|
class AsyncHTTPRequestAdapter(abc.ABC):
|
32
32
|
@property
|
33
33
|
@abc.abstractmethod
|
34
|
-
def query_params(self) -> QueryParams:
|
35
|
-
...
|
34
|
+
def query_params(self) -> QueryParams: ...
|
36
35
|
|
37
36
|
@property
|
38
37
|
@abc.abstractmethod
|
39
|
-
def method(self) -> HTTPMethod:
|
40
|
-
...
|
38
|
+
def method(self) -> HTTPMethod: ...
|
41
39
|
|
42
40
|
@property
|
43
41
|
@abc.abstractmethod
|
44
|
-
def headers(self) -> Mapping[str, str]:
|
45
|
-
...
|
42
|
+
def headers(self) -> Mapping[str, str]: ...
|
46
43
|
|
47
44
|
@property
|
48
45
|
@abc.abstractmethod
|
49
|
-
def content_type(self) -> Optional[str]:
|
50
|
-
...
|
46
|
+
def content_type(self) -> Optional[str]: ...
|
51
47
|
|
52
48
|
@abc.abstractmethod
|
53
|
-
async def get_body(self) -> Union[str, bytes]:
|
54
|
-
...
|
49
|
+
async def get_body(self) -> Union[str, bytes]: ...
|
55
50
|
|
56
51
|
@abc.abstractmethod
|
57
|
-
async def get_form_data(self) -> FormData:
|
58
|
-
...
|
52
|
+
async def get_form_data(self) -> FormData: ...
|
59
53
|
|
60
54
|
|
61
55
|
class AsyncBaseHTTPView(
|
@@ -69,30 +63,24 @@ class AsyncBaseHTTPView(
|
|
69
63
|
|
70
64
|
@property
|
71
65
|
@abc.abstractmethod
|
72
|
-
def allow_queries_via_get(self) -> bool:
|
73
|
-
...
|
66
|
+
def allow_queries_via_get(self) -> bool: ...
|
74
67
|
|
75
68
|
@abc.abstractmethod
|
76
|
-
async def get_sub_response(self, request: Request) -> SubResponse:
|
77
|
-
...
|
69
|
+
async def get_sub_response(self, request: Request) -> SubResponse: ...
|
78
70
|
|
79
71
|
@abc.abstractmethod
|
80
|
-
async def get_context(self, request: Request, response: SubResponse) -> Context:
|
81
|
-
...
|
72
|
+
async def get_context(self, request: Request, response: SubResponse) -> Context: ...
|
82
73
|
|
83
74
|
@abc.abstractmethod
|
84
|
-
async def get_root_value(self, request: Request) -> Optional[RootValue]:
|
85
|
-
...
|
75
|
+
async def get_root_value(self, request: Request) -> Optional[RootValue]: ...
|
86
76
|
|
87
77
|
@abc.abstractmethod
|
88
78
|
def create_response(
|
89
79
|
self, response_data: GraphQLHTTPResponse, sub_response: SubResponse
|
90
|
-
) -> Response:
|
91
|
-
...
|
80
|
+
) -> Response: ...
|
92
81
|
|
93
82
|
@abc.abstractmethod
|
94
|
-
async def render_graphql_ide(self, request: Request) -> Response:
|
95
|
-
...
|
83
|
+
async def render_graphql_ide(self, request: Request) -> Response: ...
|
96
84
|
|
97
85
|
async def execute_operation(
|
98
86
|
self, request: Request, context: Context, root_value: Optional[RootValue]
|
strawberry/http/base.py
CHANGED
@@ -12,16 +12,13 @@ from .typevars import Request
|
|
12
12
|
|
13
13
|
class BaseRequestProtocol(Protocol):
|
14
14
|
@property
|
15
|
-
def query_params(self) -> Mapping[str, Optional[Union[str, List[str]]]]:
|
16
|
-
...
|
15
|
+
def query_params(self) -> Mapping[str, Optional[Union[str, List[str]]]]: ...
|
17
16
|
|
18
17
|
@property
|
19
|
-
def method(self) -> HTTPMethod:
|
20
|
-
...
|
18
|
+
def method(self) -> HTTPMethod: ...
|
21
19
|
|
22
20
|
@property
|
23
|
-
def headers(self) -> Mapping[str, str]:
|
24
|
-
...
|
21
|
+
def headers(self) -> Mapping[str, str]: ...
|
25
22
|
|
26
23
|
|
27
24
|
class BaseView(Generic[Request]):
|
@@ -32,38 +32,31 @@ from .typevars import Context, Request, Response, RootValue, SubResponse
|
|
32
32
|
class SyncHTTPRequestAdapter(abc.ABC):
|
33
33
|
@property
|
34
34
|
@abc.abstractmethod
|
35
|
-
def query_params(self) -> QueryParams:
|
36
|
-
...
|
35
|
+
def query_params(self) -> QueryParams: ...
|
37
36
|
|
38
37
|
@property
|
39
38
|
@abc.abstractmethod
|
40
|
-
def body(self) -> Union[str, bytes]:
|
41
|
-
...
|
39
|
+
def body(self) -> Union[str, bytes]: ...
|
42
40
|
|
43
41
|
@property
|
44
42
|
@abc.abstractmethod
|
45
|
-
def method(self) -> HTTPMethod:
|
46
|
-
...
|
43
|
+
def method(self) -> HTTPMethod: ...
|
47
44
|
|
48
45
|
@property
|
49
46
|
@abc.abstractmethod
|
50
|
-
def headers(self) -> Mapping[str, str]:
|
51
|
-
...
|
47
|
+
def headers(self) -> Mapping[str, str]: ...
|
52
48
|
|
53
49
|
@property
|
54
50
|
@abc.abstractmethod
|
55
|
-
def content_type(self) -> Optional[str]:
|
56
|
-
...
|
51
|
+
def content_type(self) -> Optional[str]: ...
|
57
52
|
|
58
53
|
@property
|
59
54
|
@abc.abstractmethod
|
60
|
-
def post_data(self) -> Mapping[str, Union[str, bytes]]:
|
61
|
-
...
|
55
|
+
def post_data(self) -> Mapping[str, Union[str, bytes]]: ...
|
62
56
|
|
63
57
|
@property
|
64
58
|
@abc.abstractmethod
|
65
|
-
def files(self) -> Mapping[str, Any]:
|
66
|
-
...
|
59
|
+
def files(self) -> Mapping[str, Any]: ...
|
67
60
|
|
68
61
|
|
69
62
|
class SyncBaseHTTPView(
|
@@ -80,30 +73,24 @@ class SyncBaseHTTPView(
|
|
80
73
|
|
81
74
|
@property
|
82
75
|
@abc.abstractmethod
|
83
|
-
def allow_queries_via_get(self) -> bool:
|
84
|
-
...
|
76
|
+
def allow_queries_via_get(self) -> bool: ...
|
85
77
|
|
86
78
|
@abc.abstractmethod
|
87
|
-
def get_sub_response(self, request: Request) -> SubResponse:
|
88
|
-
...
|
79
|
+
def get_sub_response(self, request: Request) -> SubResponse: ...
|
89
80
|
|
90
81
|
@abc.abstractmethod
|
91
|
-
def get_context(self, request: Request, response: SubResponse) -> Context:
|
92
|
-
...
|
82
|
+
def get_context(self, request: Request, response: SubResponse) -> Context: ...
|
93
83
|
|
94
84
|
@abc.abstractmethod
|
95
|
-
def get_root_value(self, request: Request) -> Optional[RootValue]:
|
96
|
-
...
|
85
|
+
def get_root_value(self, request: Request) -> Optional[RootValue]: ...
|
97
86
|
|
98
87
|
@abc.abstractmethod
|
99
88
|
def create_response(
|
100
89
|
self, response_data: GraphQLHTTPResponse, sub_response: SubResponse
|
101
|
-
) -> Response:
|
102
|
-
...
|
90
|
+
) -> Response: ...
|
103
91
|
|
104
92
|
@abc.abstractmethod
|
105
|
-
def render_graphql_ide(self, request: Request) -> Response:
|
106
|
-
...
|
93
|
+
def render_graphql_ide(self, request: Request) -> Response: ...
|
107
94
|
|
108
95
|
def execute_operation(
|
109
96
|
self, request: Request, context: Context, root_value: Optional[RootValue]
|
@@ -211,9 +211,9 @@ class GraphQLController(
|
|
211
211
|
|
212
212
|
request_adapter_class = LitestarRequestAdapter
|
213
213
|
graphql_ws_handler_class: Type[GraphQLWSHandler] = GraphQLWSHandler
|
214
|
-
graphql_transport_ws_handler_class: Type[
|
214
|
+
graphql_transport_ws_handler_class: Type[GraphQLTransportWSHandler] = (
|
215
215
|
GraphQLTransportWSHandler
|
216
|
-
|
216
|
+
)
|
217
217
|
|
218
218
|
allow_queries_via_get: bool = True
|
219
219
|
graphiql_allowed_accept: FrozenSet[str] = frozenset({"text/html", "*/*"})
|