strawberry-graphql 0.276.1__py3-none-any.whl → 0.276.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.
- strawberry/extensions/validation_cache.py +1 -1
- strawberry/schema/schema.py +17 -14
- strawberry/types/execution.py +8 -2
- {strawberry_graphql-0.276.1.dist-info → strawberry_graphql-0.276.2.dist-info}/METADATA +1 -1
- {strawberry_graphql-0.276.1.dist-info → strawberry_graphql-0.276.2.dist-info}/RECORD +8 -8
- {strawberry_graphql-0.276.1.dist-info → strawberry_graphql-0.276.2.dist-info}/LICENSE +0 -0
- {strawberry_graphql-0.276.1.dist-info → strawberry_graphql-0.276.2.dist-info}/WHEEL +0 -0
- {strawberry_graphql-0.276.1.dist-info → strawberry_graphql-0.276.2.dist-info}/entry_points.txt +0 -0
strawberry/schema/schema.py
CHANGED
@@ -129,9 +129,12 @@ def validate_document(
|
|
129
129
|
def _run_validation(execution_context: ExecutionContext) -> None:
|
130
130
|
# Check if there are any validation rules or if validation has
|
131
131
|
# already been run by an extension
|
132
|
-
if
|
132
|
+
if (
|
133
|
+
len(execution_context.validation_rules) > 0
|
134
|
+
and execution_context.pre_execution_errors is None
|
135
|
+
):
|
133
136
|
assert execution_context.graphql_document
|
134
|
-
execution_context.
|
137
|
+
execution_context.pre_execution_errors = validate_document(
|
135
138
|
execution_context.schema._schema,
|
136
139
|
execution_context.graphql_document,
|
137
140
|
execution_context.validation_rules,
|
@@ -489,12 +492,12 @@ class Schema(BaseSchema):
|
|
489
492
|
context.graphql_document = parse(context.query)
|
490
493
|
|
491
494
|
except GraphQLError as error:
|
492
|
-
context.
|
495
|
+
context.pre_execution_errors = [error]
|
493
496
|
return PreExecutionError(data=None, errors=[error])
|
494
497
|
|
495
498
|
except Exception as error: # noqa: BLE001
|
496
499
|
error = GraphQLError(str(error), original_error=error)
|
497
|
-
context.
|
500
|
+
context.pre_execution_errors = [error]
|
498
501
|
return PreExecutionError(data=None, errors=[error])
|
499
502
|
|
500
503
|
try:
|
@@ -507,10 +510,10 @@ class Schema(BaseSchema):
|
|
507
510
|
|
508
511
|
async with extensions_runner.validation():
|
509
512
|
_run_validation(context)
|
510
|
-
if context.
|
513
|
+
if context.pre_execution_errors:
|
511
514
|
return PreExecutionError(
|
512
515
|
data=None,
|
513
|
-
errors=context.
|
516
|
+
errors=context.pre_execution_errors,
|
514
517
|
)
|
515
518
|
|
516
519
|
return None
|
@@ -527,7 +530,7 @@ class Schema(BaseSchema):
|
|
527
530
|
# Set errors on the context so that it's easier
|
528
531
|
# to access in extensions
|
529
532
|
if result.errors:
|
530
|
-
context.
|
533
|
+
context.pre_execution_errors = result.errors
|
531
534
|
if not skip_process_errors:
|
532
535
|
self._process_errors(result.errors, context)
|
533
536
|
if isinstance(result, GraphQLExecutionResult):
|
@@ -604,7 +607,7 @@ class Schema(BaseSchema):
|
|
604
607
|
# Also set errors on the execution_context so that it's easier
|
605
608
|
# to access in extensions
|
606
609
|
if result.errors:
|
607
|
-
execution_context.
|
610
|
+
execution_context.pre_execution_errors = result.errors
|
608
611
|
|
609
612
|
# Run the `Schema.process_errors` function here before
|
610
613
|
# extensions have a chance to modify them (see the MaskErrors
|
@@ -677,7 +680,7 @@ class Schema(BaseSchema):
|
|
677
680
|
)
|
678
681
|
|
679
682
|
except GraphQLError as error:
|
680
|
-
execution_context.
|
683
|
+
execution_context.pre_execution_errors = [error]
|
681
684
|
self._process_errors([error], execution_context)
|
682
685
|
return ExecutionResult(
|
683
686
|
data=None,
|
@@ -697,13 +700,13 @@ class Schema(BaseSchema):
|
|
697
700
|
|
698
701
|
with extensions_runner.validation():
|
699
702
|
_run_validation(execution_context)
|
700
|
-
if execution_context.
|
703
|
+
if execution_context.pre_execution_errors:
|
701
704
|
self._process_errors(
|
702
|
-
execution_context.
|
705
|
+
execution_context.pre_execution_errors, execution_context
|
703
706
|
)
|
704
707
|
return ExecutionResult(
|
705
708
|
data=None,
|
706
|
-
errors=execution_context.
|
709
|
+
errors=execution_context.pre_execution_errors,
|
707
710
|
extensions=extensions_runner.get_extensions_results_sync(),
|
708
711
|
)
|
709
712
|
|
@@ -733,7 +736,7 @@ class Schema(BaseSchema):
|
|
733
736
|
# Also set errors on the context so that it's easier
|
734
737
|
# to access in extensions
|
735
738
|
if result.errors:
|
736
|
-
execution_context.
|
739
|
+
execution_context.pre_execution_errors = result.errors
|
737
740
|
|
738
741
|
# Run the `Schema.process_errors` function here before
|
739
742
|
# extensions have a chance to modify them (see the MaskErrors
|
@@ -748,7 +751,7 @@ class Schema(BaseSchema):
|
|
748
751
|
raise
|
749
752
|
except Exception as exc: # noqa: BLE001
|
750
753
|
errors = [_coerce_error(exc)]
|
751
|
-
execution_context.
|
754
|
+
execution_context.pre_execution_errors = errors
|
752
755
|
self._process_errors(errors, execution_context)
|
753
756
|
return ExecutionResult(
|
754
757
|
data=None,
|
strawberry/types/execution.py
CHANGED
@@ -7,7 +7,7 @@ from typing import (
|
|
7
7
|
Optional,
|
8
8
|
runtime_checkable,
|
9
9
|
)
|
10
|
-
from typing_extensions import Protocol, TypedDict
|
10
|
+
from typing_extensions import Protocol, TypedDict, deprecated
|
11
11
|
|
12
12
|
from graphql import specified_rules
|
13
13
|
|
@@ -48,7 +48,7 @@ class ExecutionContext:
|
|
48
48
|
# Values that get populated during the GraphQL execution so that they can be
|
49
49
|
# accessed by extensions
|
50
50
|
graphql_document: Optional[DocumentNode] = None
|
51
|
-
|
51
|
+
pre_execution_errors: Optional[list[GraphQLError]] = None
|
52
52
|
result: Optional[GraphQLExecutionResult] = None
|
53
53
|
extensions_results: dict[str, Any] = dataclasses.field(default_factory=dict)
|
54
54
|
|
@@ -86,6 +86,12 @@ class ExecutionContext:
|
|
86
86
|
|
87
87
|
return get_first_operation(graphql_document)
|
88
88
|
|
89
|
+
@property
|
90
|
+
@deprecated("Use 'pre_execution_errors' instead")
|
91
|
+
def errors(self) -> Optional[list[GraphQLError]]:
|
92
|
+
"""Deprecated: Use pre_execution_errors instead."""
|
93
|
+
return self.pre_execution_errors
|
94
|
+
|
89
95
|
|
90
96
|
@dataclasses.dataclass
|
91
97
|
class ExecutionResult:
|
@@ -111,7 +111,7 @@ strawberry/extensions/tracing/datadog.py,sha256=-5zVf5JSjujzNJQvpu7EANumhL1qeMET
|
|
111
111
|
strawberry/extensions/tracing/opentelemetry.py,sha256=Bre5HkUwZwRawSvS8Zlix67g46AaR4_XWA49LArm6UI,7304
|
112
112
|
strawberry/extensions/tracing/utils.py,sha256=tXZNyqfct6YNSWi3GRj4GU1fKQGvSce8ZESfoVeys7U,654
|
113
113
|
strawberry/extensions/utils.py,sha256=sjhxItHzbDhqHtnR63WbE35qzHhTyf9NSffidet79Hc,995
|
114
|
-
strawberry/extensions/validation_cache.py,sha256=
|
114
|
+
strawberry/extensions/validation_cache.py,sha256=Fp0bz0HfbMVjaOVfTyetR7Knhic0tthkzB_0kOOyJY0,1447
|
115
115
|
strawberry/fastapi/__init__.py,sha256=p5qg9AlkYjNOWKcT4uRiebIpR6pIb1HqDMiDfF5O3tg,147
|
116
116
|
strawberry/fastapi/context.py,sha256=O_cDNppfUJJecM0ZU_RJ-dhdF0o1x39JfYvYg-7uob4,684
|
117
117
|
strawberry/fastapi/router.py,sha256=cfRGP1SL_QaSNjCk3Zi7YDQte1EsIljvqTDB1J0O4fQ,12018
|
@@ -171,7 +171,7 @@ strawberry/schema/compat.py,sha256=xNpOEDfi-MODpplMGaKuKeQIVcr-tcAaKaU3TlBc1Zs,1
|
|
171
171
|
strawberry/schema/config.py,sha256=6d2MPrAgq97-7aze555dRcB3yw-aeUexYMP3KVN22c0,1024
|
172
172
|
strawberry/schema/exceptions.py,sha256=8gsMxxFDynMvRkUDuVL9Wwxk_zsmo6QoJ2l4NPxd64M,1137
|
173
173
|
strawberry/schema/name_converter.py,sha256=JG5JKLr9wp8BMJIvG3_bVkwFdoLGbknNR1Bt75urXN0,6950
|
174
|
-
strawberry/schema/schema.py,sha256
|
174
|
+
strawberry/schema/schema.py,sha256=gBUUcbCXQm3sbb3Ue56uNblRbml3i2tmVmCgNt5pKi0,38171
|
175
175
|
strawberry/schema/schema_converter.py,sha256=ZGkZjLsqjZ-0y5NItsECHZbOOhjJioYRT6YROwmo4Gg,40125
|
176
176
|
strawberry/schema/types/__init__.py,sha256=oHO3COWhL3L1KLYCJNY1XFf5xt2GGtHiMC-UaYbFfnA,68
|
177
177
|
strawberry/schema/types/base_scalars.py,sha256=JRUq0WjEkR9dFewstZnqnZKp0uOEipo4UXNF5dzRf4M,1971
|
@@ -204,7 +204,7 @@ strawberry/types/auto.py,sha256=WZ2cQAI8nREUigBzpzFqIKGjJ_C2VqpAPNe8vPjTciM,3007
|
|
204
204
|
strawberry/types/base.py,sha256=Bfa-5Wen8qR7m6tlSMRRGlGE-chRGMHjQMopfNdbbrk,15197
|
205
205
|
strawberry/types/cast.py,sha256=fx86MkLW77GIximBAwUk5vZxSGwDqUA6XicXvz8EXwQ,916
|
206
206
|
strawberry/types/enum.py,sha256=7bK7YUzlG117_V9x-f9hx5vogcCRF6UBUFteeKhjDHg,6306
|
207
|
-
strawberry/types/execution.py,sha256=
|
207
|
+
strawberry/types/execution.py,sha256=SSi2D317Xz2bhf_UKsl36jFHYwBbF-6P6Gh-y1mP_Go,4070
|
208
208
|
strawberry/types/field.py,sha256=vxb7JvkHfRmDCYsjhDmVnO2lMbtSOteQm3jQUeSFu6g,21605
|
209
209
|
strawberry/types/fields/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
210
210
|
strawberry/types/fields/resolver.py,sha256=b6lxfw6AMOUFWm7vs7a9KzNkpR8b_S110DoIosrrWDQ,14679
|
@@ -234,8 +234,8 @@ strawberry/utils/logging.py,sha256=U1cseHGquN09YFhFmRkiphfASKCyK0HUZREImPgVb0c,7
|
|
234
234
|
strawberry/utils/operation.py,sha256=ZgVOw3K2jQuLjNOYUHauF7itJD0QDNoPw9PBi0IYf6k,1234
|
235
235
|
strawberry/utils/str_converters.py,sha256=-eH1Cl16IO_wrBlsGM-km4IY0IKsjhjnSNGRGOwQjVM,897
|
236
236
|
strawberry/utils/typing.py,sha256=SDvX-Du-9HAV3-XXjqi7Q5f5qPDDFd_gASIITiwBQT4,14073
|
237
|
-
strawberry_graphql-0.276.
|
238
|
-
strawberry_graphql-0.276.
|
239
|
-
strawberry_graphql-0.276.
|
240
|
-
strawberry_graphql-0.276.
|
241
|
-
strawberry_graphql-0.276.
|
237
|
+
strawberry_graphql-0.276.2.dist-info/LICENSE,sha256=m-XnIVUKqlG_AWnfi9NReh9JfKhYOB-gJfKE45WM1W8,1072
|
238
|
+
strawberry_graphql-0.276.2.dist-info/METADATA,sha256=nTWL2l4S6tUqwCqreJyB-CkKszqa0WoNJTf-wW1CH3k,7393
|
239
|
+
strawberry_graphql-0.276.2.dist-info/WHEEL,sha256=b4K_helf-jlQoXBBETfwnf4B04YC67LOev0jo4fX5m8,88
|
240
|
+
strawberry_graphql-0.276.2.dist-info/entry_points.txt,sha256=Nk7-aT3_uEwCgyqtHESV9H6Mc31cK-VAvhnQNTzTb4k,49
|
241
|
+
strawberry_graphql-0.276.2.dist-info/RECORD,,
|
File without changes
|
File without changes
|
{strawberry_graphql-0.276.1.dist-info → strawberry_graphql-0.276.2.dist-info}/entry_points.txt
RENAMED
File without changes
|