2
2
3
3
from ..error import GraphQLError
4
4
from ..language import DocumentNode , ParallelVisitor , visit
5
- from ..pyutils import inspect , is_collection
5
+ from ..pyutils import is_collection
6
6
from ..type import GraphQLSchema , assert_valid_schema
7
7
from ..utilities import TypeInfo , TypeInfoVisitor
8
8
from .rules import ASTValidationRule
@@ -22,7 +22,6 @@ def validate(
22
22
document_ast : DocumentNode ,
23
23
rules : Optional [Collection [Type [ASTValidationRule ]]] = None ,
24
24
max_errors : Optional [int ] = None ,
25
- type_info : Optional [TypeInfo ] = None ,
26
25
) -> List [GraphQLError ]:
27
26
"""Implements the "Validation" section of the spec.
28
27
@@ -39,8 +38,6 @@ def validate(
39
38
Validate will stop validation after a ``max_errors`` limit has been reached.
40
39
Attackers can send pathologically invalid queries to induce a DoS attack,
41
40
so by default ``max_errors`` set to 100 errors.
42
-
43
- Providing a custom TypeInfo instance is deprecated and will be removed in v3.3.
44
41
"""
45
42
if not document_ast or not isinstance (document_ast , DocumentNode ):
46
43
raise TypeError ("Must provide document." )
@@ -50,10 +47,6 @@ def validate(
50
47
max_errors = 100
51
48
elif not isinstance (max_errors , int ):
52
49
raise TypeError ("The maximum number of errors must be passed as an int." )
53
- if type_info is None :
54
- type_info = TypeInfo (schema )
55
- elif not isinstance (type_info , TypeInfo ):
56
- raise TypeError (f"Not a TypeInfo object: { inspect (type_info )} ." )
57
50
if rules is None :
58
51
rules = specified_rules
59
52
elif not is_collection (rules ) or not all (
@@ -76,6 +69,7 @@ def on_error(error: GraphQLError) -> None:
76
69
raise ValidationAbortedError
77
70
errors .append (error )
78
71
72
+ type_info = TypeInfo (schema )
79
73
context = ValidationContext (schema , document_ast , type_info , on_error )
80
74
81
75
# This uses a specialized visitor which runs multiple visitors in parallel,
0 commit comments