22
22
Here is how you would implement depth-limiting on your schema.
23
23
24
24
.. code :: python
25
+
25
26
from graphql import validate, parse
26
27
from graphene import ObjectType, Schema, String
27
28
from graphene.validation import depth_limit_validator
@@ -37,7 +38,7 @@ Here is how you would implement depth-limiting on your schema.
37
38
# will not be executed.
38
39
39
40
validation_errors = validate(
40
- schema = schema,
41
+ schema = schema.graphql_schema ,
41
42
document_ast = parse(' THE QUERY' ),
42
43
rules = (
43
44
depth_limit_validator(
58
59
Here is how you would disable introspection for your schema.
59
60
60
61
.. code :: python
62
+
61
63
from graphql import validate, parse
62
64
from graphene import ObjectType, Schema, String
63
65
from graphene.validation import DisableIntrospection
@@ -72,7 +74,7 @@ Here is how you would disable introspection for your schema.
72
74
# introspection queries will not be executed.
73
75
74
76
validation_errors = validate(
75
- schema = schema,
77
+ schema = schema.graphql_schema ,
76
78
document_ast = parse(' THE QUERY' ),
77
79
rules = (
78
80
DisableIntrospection,
@@ -92,6 +94,7 @@ reason. Here is an example query validator that visits field definitions in Grap
92
94
if any of those fields are blacklisted:
93
95
94
96
.. code :: python
97
+
95
98
from graphql import GraphQLError
96
99
from graphql.language import FieldNode
97
100
from graphql.validation import ValidationRule
0 commit comments