strawberry-graphql 0.275.7__py3-none-any.whl → 0.284.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.
Potentially problematic release.
This version of strawberry-graphql might be problematic. Click here for more details.
- strawberry/__init__.py +2 -0
- strawberry/aiohttp/test/client.py +8 -15
- strawberry/aiohttp/views.py +15 -64
- strawberry/annotation.py +70 -25
- strawberry/asgi/__init__.py +22 -56
- strawberry/asgi/test/client.py +6 -6
- strawberry/chalice/views.py +13 -79
- strawberry/channels/handlers/base.py +7 -8
- strawberry/channels/handlers/http_handler.py +50 -32
- strawberry/channels/handlers/ws_handler.py +12 -14
- strawberry/channels/router.py +3 -4
- strawberry/channels/testing.py +7 -9
- strawberry/cli/__init__.py +7 -6
- strawberry/cli/commands/codegen.py +7 -7
- strawberry/cli/commands/dev.py +72 -0
- strawberry/cli/commands/schema_codegen.py +1 -2
- strawberry/cli/commands/server.py +3 -44
- strawberry/cli/commands/upgrade/__init__.py +3 -3
- strawberry/cli/commands/upgrade/_run_codemod.py +2 -2
- strawberry/cli/constants.py +1 -2
- strawberry/cli/{debug_server.py → dev_server.py} +3 -7
- strawberry/codegen/plugins/print_operation.py +2 -2
- strawberry/codegen/plugins/python.py +2 -2
- strawberry/codegen/query_codegen.py +20 -30
- strawberry/codegen/types.py +32 -32
- strawberry/codemods/__init__.py +9 -0
- strawberry/codemods/annotated_unions.py +2 -2
- strawberry/codemods/maybe_optional.py +118 -0
- strawberry/dataloader.py +28 -24
- strawberry/directive.py +6 -7
- strawberry/django/test/client.py +3 -3
- strawberry/django/views.py +21 -91
- strawberry/exceptions/__init__.py +4 -4
- strawberry/exceptions/conflicting_arguments.py +2 -2
- strawberry/exceptions/duplicated_type_name.py +4 -4
- strawberry/exceptions/exception.py +3 -3
- strawberry/exceptions/handler.py +8 -7
- strawberry/exceptions/invalid_argument_type.py +2 -2
- strawberry/exceptions/invalid_superclass_interface.py +2 -2
- strawberry/exceptions/invalid_union_type.py +4 -4
- strawberry/exceptions/missing_arguments_annotations.py +2 -2
- strawberry/exceptions/missing_dependencies.py +2 -4
- strawberry/exceptions/missing_field_annotation.py +2 -2
- strawberry/exceptions/missing_return_annotation.py +2 -2
- strawberry/exceptions/object_is_not_a_class.py +2 -2
- strawberry/exceptions/object_is_not_an_enum.py +2 -2
- strawberry/exceptions/permission_fail_silently_requires_optional.py +2 -2
- strawberry/exceptions/private_strawberry_field.py +2 -2
- strawberry/exceptions/scalar_already_registered.py +2 -2
- strawberry/exceptions/syntax.py +3 -3
- strawberry/exceptions/unresolved_field_type.py +2 -2
- strawberry/exceptions/utils/source_finder.py +25 -25
- strawberry/experimental/pydantic/_compat.py +8 -7
- strawberry/experimental/pydantic/conversion.py +2 -2
- strawberry/experimental/pydantic/conversion_types.py +2 -2
- strawberry/experimental/pydantic/error_type.py +10 -12
- strawberry/experimental/pydantic/fields.py +9 -15
- strawberry/experimental/pydantic/object_type.py +17 -25
- strawberry/experimental/pydantic/utils.py +1 -2
- strawberry/ext/mypy_plugin.py +12 -14
- strawberry/extensions/base_extension.py +2 -1
- strawberry/extensions/context.py +13 -18
- strawberry/extensions/directives.py +9 -3
- strawberry/extensions/field_extension.py +4 -4
- strawberry/extensions/mask_errors.py +24 -13
- strawberry/extensions/max_aliases.py +1 -3
- strawberry/extensions/parser_cache.py +1 -2
- strawberry/extensions/query_depth_limiter.py +18 -14
- strawberry/extensions/runner.py +2 -2
- strawberry/extensions/tracing/apollo.py +3 -3
- strawberry/extensions/tracing/datadog.py +3 -3
- strawberry/extensions/tracing/opentelemetry.py +6 -8
- strawberry/extensions/tracing/utils.py +3 -1
- strawberry/extensions/utils.py +2 -2
- strawberry/extensions/validation_cache.py +2 -3
- strawberry/fastapi/context.py +6 -6
- strawberry/fastapi/router.py +43 -42
- strawberry/federation/argument.py +4 -5
- strawberry/federation/enum.py +18 -21
- strawberry/federation/field.py +94 -97
- strawberry/federation/object_type.py +56 -58
- strawberry/federation/scalar.py +27 -35
- strawberry/federation/schema.py +15 -16
- strawberry/federation/schema_directive.py +7 -6
- strawberry/federation/schema_directives.py +11 -11
- strawberry/federation/union.py +4 -4
- strawberry/flask/views.py +16 -85
- strawberry/http/__init__.py +30 -20
- strawberry/http/async_base_view.py +208 -89
- strawberry/http/base.py +28 -11
- strawberry/http/exceptions.py +5 -7
- strawberry/http/ides.py +2 -3
- strawberry/http/sync_base_view.py +115 -69
- strawberry/http/types.py +3 -3
- strawberry/litestar/controller.py +43 -77
- strawberry/permission.py +4 -6
- strawberry/printer/ast_from_value.py +3 -5
- strawberry/printer/printer.py +18 -15
- strawberry/quart/views.py +16 -48
- strawberry/relay/exceptions.py +4 -4
- strawberry/relay/fields.py +33 -32
- strawberry/relay/types.py +32 -35
- strawberry/relay/utils.py +11 -23
- strawberry/resolvers.py +2 -1
- strawberry/sanic/context.py +1 -0
- strawberry/sanic/utils.py +3 -3
- strawberry/sanic/views.py +15 -54
- strawberry/scalars.py +2 -2
- strawberry/schema/_graphql_core.py +55 -0
- strawberry/schema/base.py +32 -33
- strawberry/schema/compat.py +9 -9
- strawberry/schema/config.py +10 -1
- strawberry/schema/exceptions.py +1 -3
- strawberry/schema/name_converter.py +9 -8
- strawberry/schema/schema.py +133 -100
- strawberry/schema/schema_converter.py +96 -58
- strawberry/schema/types/base_scalars.py +1 -1
- strawberry/schema/types/concrete_type.py +5 -5
- strawberry/schema/validation_rules/maybe_null.py +136 -0
- strawberry/schema_codegen/__init__.py +3 -3
- strawberry/schema_directive.py +7 -6
- strawberry/static/graphiql.html +5 -5
- strawberry/streamable.py +35 -0
- strawberry/subscriptions/protocols/graphql_transport_ws/handlers.py +5 -16
- strawberry/subscriptions/protocols/graphql_transport_ws/types.py +20 -20
- strawberry/subscriptions/protocols/graphql_ws/handlers.py +5 -12
- strawberry/subscriptions/protocols/graphql_ws/types.py +14 -14
- strawberry/test/client.py +18 -18
- strawberry/tools/create_type.py +2 -3
- strawberry/types/arguments.py +41 -28
- strawberry/types/auto.py +3 -4
- strawberry/types/base.py +25 -27
- strawberry/types/enum.py +22 -25
- strawberry/types/execution.py +21 -16
- strawberry/types/field.py +109 -130
- strawberry/types/fields/resolver.py +19 -21
- strawberry/types/info.py +5 -11
- strawberry/types/lazy_type.py +2 -3
- strawberry/types/maybe.py +12 -3
- strawberry/types/mutation.py +115 -118
- strawberry/types/nodes.py +2 -2
- strawberry/types/object_type.py +43 -63
- strawberry/types/scalar.py +37 -43
- strawberry/types/union.py +12 -14
- strawberry/utils/aio.py +12 -9
- strawberry/utils/await_maybe.py +3 -3
- strawberry/utils/deprecations.py +2 -2
- strawberry/utils/importer.py +1 -2
- strawberry/utils/inspect.py +4 -6
- strawberry/utils/logging.py +2 -2
- strawberry/utils/operation.py +4 -4
- strawberry/utils/typing.py +18 -83
- {strawberry_graphql-0.275.7.dist-info → strawberry_graphql-0.284.3.dist-info}/METADATA +14 -8
- strawberry_graphql-0.284.3.dist-info/RECORD +243 -0
- {strawberry_graphql-0.275.7.dist-info → strawberry_graphql-0.284.3.dist-info}/WHEEL +1 -1
- strawberry/utils/dataclasses.py +0 -37
- strawberry/utils/debug.py +0 -46
- strawberry/utils/graphql_lexer.py +0 -35
- strawberry_graphql-0.275.7.dist-info/RECORD +0 -241
- {strawberry_graphql-0.275.7.dist-info → strawberry_graphql-0.284.3.dist-info}/entry_points.txt +0 -0
- {strawberry_graphql-0.275.7.dist-info → strawberry_graphql-0.284.3.dist-info/licenses}/LICENSE +0 -0
strawberry/federation/field.py
CHANGED
|
@@ -4,10 +4,7 @@ import dataclasses
|
|
|
4
4
|
from typing import (
|
|
5
5
|
TYPE_CHECKING,
|
|
6
6
|
Any,
|
|
7
|
-
Callable,
|
|
8
|
-
Optional,
|
|
9
7
|
TypeVar,
|
|
10
|
-
Union,
|
|
11
8
|
overload,
|
|
12
9
|
)
|
|
13
10
|
|
|
@@ -15,8 +12,8 @@ from strawberry.types.field import field as base_field
|
|
|
15
12
|
from strawberry.types.unset import UNSET
|
|
16
13
|
|
|
17
14
|
if TYPE_CHECKING:
|
|
18
|
-
from collections.abc import Iterable, Mapping, Sequence
|
|
19
|
-
from
|
|
15
|
+
from collections.abc import Callable, Iterable, Mapping, Sequence
|
|
16
|
+
from typing import Literal
|
|
20
17
|
|
|
21
18
|
from strawberry.extensions.field_extension import FieldExtension
|
|
22
19
|
from strawberry.permission import BasePermission
|
|
@@ -39,28 +36,28 @@ T = TypeVar("T")
|
|
|
39
36
|
def field(
|
|
40
37
|
*,
|
|
41
38
|
resolver: _RESOLVER_TYPE_ASYNC[T],
|
|
42
|
-
name:
|
|
39
|
+
name: str | None = None,
|
|
43
40
|
is_subscription: bool = False,
|
|
44
|
-
description:
|
|
41
|
+
description: str | None = None,
|
|
45
42
|
authenticated: bool = False,
|
|
46
43
|
external: bool = False,
|
|
47
44
|
inaccessible: bool = False,
|
|
48
|
-
policy:
|
|
49
|
-
provides:
|
|
50
|
-
override:
|
|
51
|
-
requires:
|
|
52
|
-
requires_scopes:
|
|
53
|
-
tags:
|
|
45
|
+
policy: list[list[str]] | None = None,
|
|
46
|
+
provides: list[str] | None = None,
|
|
47
|
+
override: Override | str | None = None,
|
|
48
|
+
requires: list[str] | None = None,
|
|
49
|
+
requires_scopes: list[list[str]] | None = None,
|
|
50
|
+
tags: Iterable[str] | None = (),
|
|
54
51
|
shareable: bool = False,
|
|
55
52
|
init: Literal[False] = False,
|
|
56
|
-
permission_classes:
|
|
57
|
-
deprecation_reason:
|
|
53
|
+
permission_classes: list[type[BasePermission]] | None = None,
|
|
54
|
+
deprecation_reason: str | None = None,
|
|
58
55
|
default: Any = dataclasses.MISSING,
|
|
59
|
-
default_factory:
|
|
60
|
-
metadata:
|
|
61
|
-
directives:
|
|
62
|
-
extensions:
|
|
63
|
-
graphql_type:
|
|
56
|
+
default_factory: Callable[..., object] | object = dataclasses.MISSING,
|
|
57
|
+
metadata: Mapping[Any, Any] | None = None,
|
|
58
|
+
directives: Sequence[object] | None = (),
|
|
59
|
+
extensions: list[FieldExtension] | None = None,
|
|
60
|
+
graphql_type: Any | None = None,
|
|
64
61
|
) -> T: ...
|
|
65
62
|
|
|
66
63
|
|
|
@@ -68,56 +65,56 @@ def field(
|
|
|
68
65
|
def field(
|
|
69
66
|
*,
|
|
70
67
|
resolver: _RESOLVER_TYPE_SYNC[T],
|
|
71
|
-
name:
|
|
68
|
+
name: str | None = None,
|
|
72
69
|
is_subscription: bool = False,
|
|
73
|
-
description:
|
|
70
|
+
description: str | None = None,
|
|
74
71
|
authenticated: bool = False,
|
|
75
72
|
external: bool = False,
|
|
76
73
|
inaccessible: bool = False,
|
|
77
|
-
policy:
|
|
78
|
-
provides:
|
|
79
|
-
override:
|
|
80
|
-
requires:
|
|
81
|
-
requires_scopes:
|
|
82
|
-
tags:
|
|
74
|
+
policy: list[list[str]] | None = None,
|
|
75
|
+
provides: list[str] | None = None,
|
|
76
|
+
override: Override | str | None = None,
|
|
77
|
+
requires: list[str] | None = None,
|
|
78
|
+
requires_scopes: list[list[str]] | None = None,
|
|
79
|
+
tags: Iterable[str] | None = (),
|
|
83
80
|
shareable: bool = False,
|
|
84
81
|
init: Literal[False] = False,
|
|
85
|
-
permission_classes:
|
|
86
|
-
deprecation_reason:
|
|
82
|
+
permission_classes: list[type[BasePermission]] | None = None,
|
|
83
|
+
deprecation_reason: str | None = None,
|
|
87
84
|
default: Any = dataclasses.MISSING,
|
|
88
|
-
default_factory:
|
|
89
|
-
metadata:
|
|
90
|
-
directives:
|
|
91
|
-
extensions:
|
|
92
|
-
graphql_type:
|
|
85
|
+
default_factory: Callable[..., object] | object = dataclasses.MISSING,
|
|
86
|
+
metadata: Mapping[Any, Any] | None = None,
|
|
87
|
+
directives: Sequence[object] | None = (),
|
|
88
|
+
extensions: list[FieldExtension] | None = None,
|
|
89
|
+
graphql_type: Any | None = None,
|
|
93
90
|
) -> T: ...
|
|
94
91
|
|
|
95
92
|
|
|
96
93
|
@overload
|
|
97
94
|
def field(
|
|
98
95
|
*,
|
|
99
|
-
name:
|
|
96
|
+
name: str | None = None,
|
|
100
97
|
is_subscription: bool = False,
|
|
101
|
-
description:
|
|
98
|
+
description: str | None = None,
|
|
102
99
|
authenticated: bool = False,
|
|
103
100
|
external: bool = False,
|
|
104
101
|
inaccessible: bool = False,
|
|
105
|
-
policy:
|
|
106
|
-
provides:
|
|
107
|
-
override:
|
|
108
|
-
requires:
|
|
109
|
-
requires_scopes:
|
|
110
|
-
tags:
|
|
102
|
+
policy: list[list[str]] | None = None,
|
|
103
|
+
provides: list[str] | None = None,
|
|
104
|
+
override: Override | str | None = None,
|
|
105
|
+
requires: list[str] | None = None,
|
|
106
|
+
requires_scopes: list[list[str]] | None = None,
|
|
107
|
+
tags: Iterable[str] | None = (),
|
|
111
108
|
shareable: bool = False,
|
|
112
109
|
init: Literal[True] = True,
|
|
113
|
-
permission_classes:
|
|
114
|
-
deprecation_reason:
|
|
110
|
+
permission_classes: list[type[BasePermission]] | None = None,
|
|
111
|
+
deprecation_reason: str | None = None,
|
|
115
112
|
default: Any = dataclasses.MISSING,
|
|
116
|
-
default_factory:
|
|
117
|
-
metadata:
|
|
118
|
-
directives:
|
|
119
|
-
extensions:
|
|
120
|
-
graphql_type:
|
|
113
|
+
default_factory: Callable[..., object] | object = dataclasses.MISSING,
|
|
114
|
+
metadata: Mapping[Any, Any] | None = None,
|
|
115
|
+
directives: Sequence[object] | None = (),
|
|
116
|
+
extensions: list[FieldExtension] | None = None,
|
|
117
|
+
graphql_type: Any | None = None,
|
|
121
118
|
) -> Any: ...
|
|
122
119
|
|
|
123
120
|
|
|
@@ -125,27 +122,27 @@ def field(
|
|
|
125
122
|
def field(
|
|
126
123
|
resolver: _RESOLVER_TYPE_ASYNC[T],
|
|
127
124
|
*,
|
|
128
|
-
name:
|
|
125
|
+
name: str | None = None,
|
|
129
126
|
is_subscription: bool = False,
|
|
130
|
-
description:
|
|
127
|
+
description: str | None = None,
|
|
131
128
|
authenticated: bool = False,
|
|
132
129
|
external: bool = False,
|
|
133
130
|
inaccessible: bool = False,
|
|
134
|
-
policy:
|
|
135
|
-
provides:
|
|
136
|
-
override:
|
|
137
|
-
requires:
|
|
138
|
-
requires_scopes:
|
|
139
|
-
tags:
|
|
131
|
+
policy: list[list[str]] | None = None,
|
|
132
|
+
provides: list[str] | None = None,
|
|
133
|
+
override: Override | str | None = None,
|
|
134
|
+
requires: list[str] | None = None,
|
|
135
|
+
requires_scopes: list[list[str]] | None = None,
|
|
136
|
+
tags: Iterable[str] | None = (),
|
|
140
137
|
shareable: bool = False,
|
|
141
|
-
permission_classes:
|
|
142
|
-
deprecation_reason:
|
|
138
|
+
permission_classes: list[type[BasePermission]] | None = None,
|
|
139
|
+
deprecation_reason: str | None = None,
|
|
143
140
|
default: Any = dataclasses.MISSING,
|
|
144
|
-
default_factory:
|
|
145
|
-
metadata:
|
|
146
|
-
directives:
|
|
147
|
-
extensions:
|
|
148
|
-
graphql_type:
|
|
141
|
+
default_factory: Callable[..., object] | object = dataclasses.MISSING,
|
|
142
|
+
metadata: Mapping[Any, Any] | None = None,
|
|
143
|
+
directives: Sequence[object] | None = (),
|
|
144
|
+
extensions: list[FieldExtension] | None = None,
|
|
145
|
+
graphql_type: Any | None = None,
|
|
149
146
|
) -> StrawberryField: ...
|
|
150
147
|
|
|
151
148
|
|
|
@@ -153,58 +150,58 @@ def field(
|
|
|
153
150
|
def field(
|
|
154
151
|
resolver: _RESOLVER_TYPE_SYNC[T],
|
|
155
152
|
*,
|
|
156
|
-
name:
|
|
153
|
+
name: str | None = None,
|
|
157
154
|
is_subscription: bool = False,
|
|
158
|
-
description:
|
|
155
|
+
description: str | None = None,
|
|
159
156
|
authenticated: bool = False,
|
|
160
157
|
external: bool = False,
|
|
161
158
|
inaccessible: bool = False,
|
|
162
|
-
policy:
|
|
163
|
-
provides:
|
|
164
|
-
override:
|
|
165
|
-
requires:
|
|
166
|
-
requires_scopes:
|
|
167
|
-
tags:
|
|
159
|
+
policy: list[list[str]] | None = None,
|
|
160
|
+
provides: list[str] | None = None,
|
|
161
|
+
override: Override | str | None = None,
|
|
162
|
+
requires: list[str] | None = None,
|
|
163
|
+
requires_scopes: list[list[str]] | None = None,
|
|
164
|
+
tags: Iterable[str] | None = (),
|
|
168
165
|
shareable: bool = False,
|
|
169
|
-
permission_classes:
|
|
170
|
-
deprecation_reason:
|
|
166
|
+
permission_classes: list[type[BasePermission]] | None = None,
|
|
167
|
+
deprecation_reason: str | None = None,
|
|
171
168
|
default: Any = dataclasses.MISSING,
|
|
172
|
-
default_factory:
|
|
173
|
-
metadata:
|
|
174
|
-
directives:
|
|
175
|
-
extensions:
|
|
176
|
-
graphql_type:
|
|
169
|
+
default_factory: Callable[..., object] | object = dataclasses.MISSING,
|
|
170
|
+
metadata: Mapping[Any, Any] | None = None,
|
|
171
|
+
directives: Sequence[object] | None = (),
|
|
172
|
+
extensions: list[FieldExtension] | None = None,
|
|
173
|
+
graphql_type: Any | None = None,
|
|
177
174
|
) -> StrawberryField: ...
|
|
178
175
|
|
|
179
176
|
|
|
180
177
|
def field(
|
|
181
|
-
resolver:
|
|
178
|
+
resolver: _RESOLVER_TYPE[Any] | None = None,
|
|
182
179
|
*,
|
|
183
|
-
name:
|
|
180
|
+
name: str | None = None,
|
|
184
181
|
is_subscription: bool = False,
|
|
185
|
-
description:
|
|
182
|
+
description: str | None = None,
|
|
186
183
|
authenticated: bool = False,
|
|
187
184
|
external: bool = False,
|
|
188
185
|
inaccessible: bool = False,
|
|
189
|
-
policy:
|
|
190
|
-
provides:
|
|
191
|
-
override:
|
|
192
|
-
requires:
|
|
193
|
-
requires_scopes:
|
|
194
|
-
tags:
|
|
186
|
+
policy: list[list[str]] | None = None,
|
|
187
|
+
provides: list[str] | None = None,
|
|
188
|
+
override: Override | str | None = None,
|
|
189
|
+
requires: list[str] | None = None,
|
|
190
|
+
requires_scopes: list[list[str]] | None = None,
|
|
191
|
+
tags: Iterable[str] | None = (),
|
|
195
192
|
shareable: bool = False,
|
|
196
|
-
permission_classes:
|
|
197
|
-
deprecation_reason:
|
|
193
|
+
permission_classes: list[type[BasePermission]] | None = None,
|
|
194
|
+
deprecation_reason: str | None = None,
|
|
198
195
|
default: Any = dataclasses.MISSING,
|
|
199
|
-
default_factory:
|
|
200
|
-
metadata:
|
|
201
|
-
directives:
|
|
202
|
-
extensions:
|
|
203
|
-
graphql_type:
|
|
196
|
+
default_factory: Callable[..., object] | object = dataclasses.MISSING,
|
|
197
|
+
metadata: Mapping[Any, Any] | None = None,
|
|
198
|
+
directives: Sequence[object] | None = (),
|
|
199
|
+
extensions: list[FieldExtension] | None = None,
|
|
200
|
+
graphql_type: Any | None = None,
|
|
204
201
|
# This init parameter is used by PyRight to determine whether this field
|
|
205
202
|
# is added in the constructor or not. It is not used to change
|
|
206
203
|
# any behavior at the moment.
|
|
207
|
-
init: Literal[True, False
|
|
204
|
+
init: Literal[True, False] | None = None,
|
|
208
205
|
) -> Any:
|
|
209
206
|
from .schema_directives import (
|
|
210
207
|
Authenticated,
|
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
import builtins
|
|
2
|
-
from collections.abc import Iterable, Sequence
|
|
2
|
+
from collections.abc import Callable, Iterable, Sequence
|
|
3
3
|
from typing import (
|
|
4
4
|
TYPE_CHECKING,
|
|
5
|
-
Callable,
|
|
6
|
-
Optional,
|
|
7
5
|
TypeVar,
|
|
8
6
|
Union,
|
|
9
7
|
overload,
|
|
@@ -25,19 +23,19 @@ T = TypeVar("T", bound=builtins.type)
|
|
|
25
23
|
|
|
26
24
|
|
|
27
25
|
def _impl_type(
|
|
28
|
-
cls:
|
|
26
|
+
cls: T | None,
|
|
29
27
|
*,
|
|
30
|
-
name:
|
|
31
|
-
description:
|
|
32
|
-
one_of:
|
|
28
|
+
name: str | None = None,
|
|
29
|
+
description: str | None = None,
|
|
30
|
+
one_of: bool | None = None,
|
|
33
31
|
directives: Iterable[object] = (),
|
|
34
32
|
authenticated: bool = False,
|
|
35
33
|
keys: Iterable[Union["Key", str]] = (),
|
|
36
34
|
extend: bool = False,
|
|
37
35
|
shareable: bool = False,
|
|
38
36
|
inaccessible: bool = UNSET,
|
|
39
|
-
policy:
|
|
40
|
-
requires_scopes:
|
|
37
|
+
policy: list[list[str]] | None = None,
|
|
38
|
+
requires_scopes: list[list[str]] | None = None,
|
|
41
39
|
tags: Iterable[str] = (),
|
|
42
40
|
is_input: bool = False,
|
|
43
41
|
is_interface: bool = False,
|
|
@@ -106,15 +104,15 @@ def _impl_type(
|
|
|
106
104
|
def type(
|
|
107
105
|
cls: T,
|
|
108
106
|
*,
|
|
109
|
-
name:
|
|
110
|
-
description:
|
|
107
|
+
name: str | None = None,
|
|
108
|
+
description: str | None = None,
|
|
111
109
|
directives: Iterable[object] = (),
|
|
112
110
|
authenticated: bool = False,
|
|
113
111
|
extend: bool = False,
|
|
114
112
|
inaccessible: bool = UNSET,
|
|
115
113
|
keys: Iterable[Union["Key", str]] = (),
|
|
116
|
-
policy:
|
|
117
|
-
requires_scopes:
|
|
114
|
+
policy: list[list[str]] | None = None,
|
|
115
|
+
requires_scopes: list[list[str]] | None = None,
|
|
118
116
|
shareable: bool = False,
|
|
119
117
|
tags: Iterable[str] = (),
|
|
120
118
|
) -> T: ...
|
|
@@ -128,32 +126,32 @@ def type(
|
|
|
128
126
|
)
|
|
129
127
|
def type(
|
|
130
128
|
*,
|
|
131
|
-
name:
|
|
132
|
-
description:
|
|
129
|
+
name: str | None = None,
|
|
130
|
+
description: str | None = None,
|
|
133
131
|
directives: Iterable[object] = (),
|
|
134
132
|
authenticated: bool = False,
|
|
135
133
|
extend: bool = False,
|
|
136
134
|
inaccessible: bool = UNSET,
|
|
137
135
|
keys: Iterable[Union["Key", str]] = (),
|
|
138
|
-
policy:
|
|
139
|
-
requires_scopes:
|
|
136
|
+
policy: list[list[str]] | None = None,
|
|
137
|
+
requires_scopes: list[list[str]] | None = None,
|
|
140
138
|
shareable: bool = False,
|
|
141
139
|
tags: Iterable[str] = (),
|
|
142
140
|
) -> Callable[[T], T]: ...
|
|
143
141
|
|
|
144
142
|
|
|
145
143
|
def type(
|
|
146
|
-
cls:
|
|
144
|
+
cls: T | None = None,
|
|
147
145
|
*,
|
|
148
|
-
name:
|
|
149
|
-
description:
|
|
146
|
+
name: str | None = None,
|
|
147
|
+
description: str | None = None,
|
|
150
148
|
directives: Iterable[object] = (),
|
|
151
149
|
authenticated: bool = False,
|
|
152
150
|
extend: bool = False,
|
|
153
151
|
inaccessible: bool = UNSET,
|
|
154
152
|
keys: Iterable[Union["Key", str]] = (),
|
|
155
|
-
policy:
|
|
156
|
-
requires_scopes:
|
|
153
|
+
policy: list[list[str]] | None = None,
|
|
154
|
+
requires_scopes: list[list[str]] | None = None,
|
|
157
155
|
shareable: bool = False,
|
|
158
156
|
tags: Iterable[str] = (),
|
|
159
157
|
):
|
|
@@ -182,9 +180,9 @@ def type(
|
|
|
182
180
|
def input(
|
|
183
181
|
cls: T,
|
|
184
182
|
*,
|
|
185
|
-
name:
|
|
186
|
-
one_of:
|
|
187
|
-
description:
|
|
183
|
+
name: str | None = None,
|
|
184
|
+
one_of: bool | None = None,
|
|
185
|
+
description: str | None = None,
|
|
188
186
|
directives: Sequence[object] = (),
|
|
189
187
|
inaccessible: bool = UNSET,
|
|
190
188
|
tags: Iterable[str] = (),
|
|
@@ -199,9 +197,9 @@ def input(
|
|
|
199
197
|
)
|
|
200
198
|
def input(
|
|
201
199
|
*,
|
|
202
|
-
name:
|
|
203
|
-
description:
|
|
204
|
-
one_of:
|
|
200
|
+
name: str | None = None,
|
|
201
|
+
description: str | None = None,
|
|
202
|
+
one_of: bool | None = None,
|
|
205
203
|
directives: Sequence[object] = (),
|
|
206
204
|
inaccessible: bool = UNSET,
|
|
207
205
|
tags: Iterable[str] = (),
|
|
@@ -209,11 +207,11 @@ def input(
|
|
|
209
207
|
|
|
210
208
|
|
|
211
209
|
def input(
|
|
212
|
-
cls:
|
|
210
|
+
cls: T | None = None,
|
|
213
211
|
*,
|
|
214
|
-
name:
|
|
215
|
-
one_of:
|
|
216
|
-
description:
|
|
212
|
+
name: str | None = None,
|
|
213
|
+
one_of: bool | None = None,
|
|
214
|
+
description: str | None = None,
|
|
217
215
|
directives: Sequence[object] = (),
|
|
218
216
|
inaccessible: bool = UNSET,
|
|
219
217
|
tags: Iterable[str] = (),
|
|
@@ -239,14 +237,14 @@ def input(
|
|
|
239
237
|
def interface(
|
|
240
238
|
cls: T,
|
|
241
239
|
*,
|
|
242
|
-
name:
|
|
243
|
-
description:
|
|
240
|
+
name: str | None = None,
|
|
241
|
+
description: str | None = None,
|
|
244
242
|
directives: Iterable[object] = (),
|
|
245
243
|
authenticated: bool = False,
|
|
246
244
|
inaccessible: bool = UNSET,
|
|
247
245
|
keys: Iterable[Union["Key", str]] = (),
|
|
248
|
-
policy:
|
|
249
|
-
requires_scopes:
|
|
246
|
+
policy: list[list[str]] | None = None,
|
|
247
|
+
requires_scopes: list[list[str]] | None = None,
|
|
250
248
|
tags: Iterable[str] = (),
|
|
251
249
|
) -> T: ...
|
|
252
250
|
|
|
@@ -259,29 +257,29 @@ def interface(
|
|
|
259
257
|
)
|
|
260
258
|
def interface(
|
|
261
259
|
*,
|
|
262
|
-
name:
|
|
263
|
-
description:
|
|
260
|
+
name: str | None = None,
|
|
261
|
+
description: str | None = None,
|
|
264
262
|
directives: Iterable[object] = (),
|
|
265
263
|
authenticated: bool = False,
|
|
266
264
|
inaccessible: bool = UNSET,
|
|
267
265
|
keys: Iterable[Union["Key", str]] = (),
|
|
268
|
-
policy:
|
|
269
|
-
requires_scopes:
|
|
266
|
+
policy: list[list[str]] | None = None,
|
|
267
|
+
requires_scopes: list[list[str]] | None = None,
|
|
270
268
|
tags: Iterable[str] = (),
|
|
271
269
|
) -> Callable[[T], T]: ...
|
|
272
270
|
|
|
273
271
|
|
|
274
272
|
def interface(
|
|
275
|
-
cls:
|
|
273
|
+
cls: T | None = None,
|
|
276
274
|
*,
|
|
277
|
-
name:
|
|
278
|
-
description:
|
|
275
|
+
name: str | None = None,
|
|
276
|
+
description: str | None = None,
|
|
279
277
|
directives: Iterable[object] = (),
|
|
280
278
|
authenticated: bool = False,
|
|
281
279
|
inaccessible: bool = UNSET,
|
|
282
280
|
keys: Iterable[Union["Key", str]] = (),
|
|
283
|
-
policy:
|
|
284
|
-
requires_scopes:
|
|
281
|
+
policy: list[list[str]] | None = None,
|
|
282
|
+
requires_scopes: list[list[str]] | None = None,
|
|
285
283
|
tags: Iterable[str] = (),
|
|
286
284
|
):
|
|
287
285
|
return _impl_type(
|
|
@@ -308,14 +306,14 @@ def interface(
|
|
|
308
306
|
def interface_object(
|
|
309
307
|
cls: T,
|
|
310
308
|
*,
|
|
311
|
-
name:
|
|
312
|
-
description:
|
|
309
|
+
name: str | None = None,
|
|
310
|
+
description: str | None = None,
|
|
313
311
|
directives: Iterable[object] = (),
|
|
314
312
|
authenticated: bool = False,
|
|
315
313
|
inaccessible: bool = UNSET,
|
|
316
314
|
keys: Iterable[Union["Key", str]] = (),
|
|
317
|
-
policy:
|
|
318
|
-
requires_scopes:
|
|
315
|
+
policy: list[list[str]] | None = None,
|
|
316
|
+
requires_scopes: list[list[str]] | None = None,
|
|
319
317
|
tags: Iterable[str] = (),
|
|
320
318
|
) -> T: ...
|
|
321
319
|
|
|
@@ -328,29 +326,29 @@ def interface_object(
|
|
|
328
326
|
)
|
|
329
327
|
def interface_object(
|
|
330
328
|
*,
|
|
331
|
-
name:
|
|
332
|
-
description:
|
|
329
|
+
name: str | None = None,
|
|
330
|
+
description: str | None = None,
|
|
333
331
|
directives: Iterable[object] = (),
|
|
334
332
|
authenticated: bool = False,
|
|
335
333
|
inaccessible: bool = UNSET,
|
|
336
334
|
keys: Iterable[Union["Key", str]] = (),
|
|
337
|
-
policy:
|
|
338
|
-
requires_scopes:
|
|
335
|
+
policy: list[list[str]] | None = None,
|
|
336
|
+
requires_scopes: list[list[str]] | None = None,
|
|
339
337
|
tags: Iterable[str] = (),
|
|
340
338
|
) -> Callable[[T], T]: ...
|
|
341
339
|
|
|
342
340
|
|
|
343
341
|
def interface_object(
|
|
344
|
-
cls:
|
|
342
|
+
cls: T | None = None,
|
|
345
343
|
*,
|
|
346
|
-
name:
|
|
347
|
-
description:
|
|
344
|
+
name: str | None = None,
|
|
345
|
+
description: str | None = None,
|
|
348
346
|
directives: Iterable[object] = (),
|
|
349
347
|
authenticated: bool = False,
|
|
350
348
|
inaccessible: bool = UNSET,
|
|
351
349
|
keys: Iterable[Union["Key", str]] = (),
|
|
352
|
-
policy:
|
|
353
|
-
requires_scopes:
|
|
350
|
+
policy: list[list[str]] | None = None,
|
|
351
|
+
requires_scopes: list[list[str]] | None = None,
|
|
354
352
|
tags: Iterable[str] = (),
|
|
355
353
|
):
|
|
356
354
|
return _impl_type(
|
strawberry/federation/scalar.py
CHANGED
|
@@ -1,22 +1,14 @@
|
|
|
1
|
-
import
|
|
2
|
-
from collections.abc import Iterable
|
|
1
|
+
from collections.abc import Callable, Iterable
|
|
3
2
|
from typing import (
|
|
4
3
|
Any,
|
|
5
|
-
Callable,
|
|
6
4
|
NewType,
|
|
7
|
-
Optional,
|
|
8
5
|
TypeVar,
|
|
9
|
-
Union,
|
|
10
6
|
overload,
|
|
11
7
|
)
|
|
12
8
|
|
|
13
9
|
from strawberry.types.scalar import ScalarWrapper, _process_scalar
|
|
14
10
|
|
|
15
|
-
|
|
16
|
-
if sys.version_info >= (3, 10):
|
|
17
|
-
_T = TypeVar("_T", bound=Union[type, NewType])
|
|
18
|
-
else:
|
|
19
|
-
_T = TypeVar("_T", bound=type)
|
|
11
|
+
_T = TypeVar("_T", bound=type | NewType)
|
|
20
12
|
|
|
21
13
|
|
|
22
14
|
def identity(x: _T) -> _T: # pragma: no cover
|
|
@@ -26,18 +18,18 @@ def identity(x: _T) -> _T: # pragma: no cover
|
|
|
26
18
|
@overload
|
|
27
19
|
def scalar(
|
|
28
20
|
*,
|
|
29
|
-
name:
|
|
30
|
-
description:
|
|
31
|
-
specified_by_url:
|
|
21
|
+
name: str | None = None,
|
|
22
|
+
description: str | None = None,
|
|
23
|
+
specified_by_url: str | None = None,
|
|
32
24
|
serialize: Callable = identity,
|
|
33
|
-
parse_value:
|
|
34
|
-
parse_literal:
|
|
25
|
+
parse_value: Callable | None = None,
|
|
26
|
+
parse_literal: Callable | None = None,
|
|
35
27
|
directives: Iterable[object] = (),
|
|
36
28
|
authenticated: bool = False,
|
|
37
29
|
inaccessible: bool = False,
|
|
38
|
-
policy:
|
|
39
|
-
requires_scopes:
|
|
40
|
-
tags:
|
|
30
|
+
policy: list[list[str]] | None = None,
|
|
31
|
+
requires_scopes: list[list[str]] | None = None,
|
|
32
|
+
tags: Iterable[str] | None = (),
|
|
41
33
|
) -> Callable[[_T], _T]: ...
|
|
42
34
|
|
|
43
35
|
|
|
@@ -45,36 +37,36 @@ def scalar(
|
|
|
45
37
|
def scalar(
|
|
46
38
|
cls: _T,
|
|
47
39
|
*,
|
|
48
|
-
name:
|
|
49
|
-
description:
|
|
50
|
-
specified_by_url:
|
|
40
|
+
name: str | None = None,
|
|
41
|
+
description: str | None = None,
|
|
42
|
+
specified_by_url: str | None = None,
|
|
51
43
|
serialize: Callable = identity,
|
|
52
|
-
parse_value:
|
|
53
|
-
parse_literal:
|
|
44
|
+
parse_value: Callable | None = None,
|
|
45
|
+
parse_literal: Callable | None = None,
|
|
54
46
|
directives: Iterable[object] = (),
|
|
55
47
|
authenticated: bool = False,
|
|
56
48
|
inaccessible: bool = False,
|
|
57
|
-
policy:
|
|
58
|
-
requires_scopes:
|
|
59
|
-
tags:
|
|
49
|
+
policy: list[list[str]] | None = None,
|
|
50
|
+
requires_scopes: list[list[str]] | None = None,
|
|
51
|
+
tags: Iterable[str] | None = (),
|
|
60
52
|
) -> _T: ...
|
|
61
53
|
|
|
62
54
|
|
|
63
55
|
def scalar(
|
|
64
|
-
cls:
|
|
56
|
+
cls: _T | None = None,
|
|
65
57
|
*,
|
|
66
|
-
name:
|
|
67
|
-
description:
|
|
68
|
-
specified_by_url:
|
|
58
|
+
name: str | None = None,
|
|
59
|
+
description: str | None = None,
|
|
60
|
+
specified_by_url: str | None = None,
|
|
69
61
|
serialize: Callable = identity,
|
|
70
|
-
parse_value:
|
|
71
|
-
parse_literal:
|
|
62
|
+
parse_value: Callable | None = None,
|
|
63
|
+
parse_literal: Callable | None = None,
|
|
72
64
|
directives: Iterable[object] = (),
|
|
73
65
|
authenticated: bool = False,
|
|
74
66
|
inaccessible: bool = False,
|
|
75
|
-
policy:
|
|
76
|
-
requires_scopes:
|
|
77
|
-
tags:
|
|
67
|
+
policy: list[list[str]] | None = None,
|
|
68
|
+
requires_scopes: list[list[str]] | None = None,
|
|
69
|
+
tags: Iterable[str] | None = (),
|
|
78
70
|
) -> Any:
|
|
79
71
|
"""Annotates a class or type as a GraphQL custom scalar.
|
|
80
72
|
|