22
33from ..error import GraphQLError
44from ..language import DocumentNode , ParallelVisitor , visit
5- from ..pyutils import inspect , is_collection
5+ from ..pyutils import is_collection
66from ..type import GraphQLSchema , assert_valid_schema
77from ..utilities import TypeInfo , TypeInfoVisitor
88from .rules import ASTValidationRule
@@ -22,7 +22,6 @@ def validate(
2222 document_ast : DocumentNode ,
2323 rules : Optional [Collection [Type [ASTValidationRule ]]] = None ,
2424 max_errors : Optional [int ] = None ,
25- type_info : Optional [TypeInfo ] = None ,
2625) -> List [GraphQLError ]:
2726 """Implements the "Validation" section of the spec.
2827
@@ -39,8 +38,6 @@ def validate(
3938 Validate will stop validation after a ``max_errors`` limit has been reached.
4039 Attackers can send pathologically invalid queries to induce a DoS attack,
4140 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.
4441 """
4542 if not document_ast or not isinstance (document_ast , DocumentNode ):
4643 raise TypeError ("Must provide document." )
@@ -50,10 +47,6 @@ def validate(
5047 max_errors = 100
5148 elif not isinstance (max_errors , int ):
5249 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 )} ." )
5750 if rules is None :
5851 rules = specified_rules
5952 elif not is_collection (rules ) or not all (
@@ -76,6 +69,7 @@ def on_error(error: GraphQLError) -> None:
7669 raise ValidationAbortedError
7770 errors .append (error )
7871
72+ type_info = TypeInfo (schema )
7973 context = ValidationContext (schema , document_ast , type_info , on_error )
8074
8175 # This uses a specialized visitor which runs multiple visitors in parallel,
0 commit comments