Update graphene/validation/disable_introspection.py

This commit is contained in:
Syrus Akbary 2021-08-19 14:02:45 -05:00 committed by GitHub
parent 0e4c14b076
commit 7d890bf915
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -8,12 +8,10 @@ from ..utils.is_introspection_key import is_introspection_key
class DisableIntrospection(ValidationRule):
def enter_field(self, node: FieldNode, *_args):
field_name = node.name.value
if not is_introspection_key(field_name):
return
self.report_error(
GraphQLError(
f"Cannot query '{field_name}': introspection is disabled.",
node,
if is_introspection_key(field_name):
self.report_error(
GraphQLError(
f"Cannot query '{field_name}': introspection is disabled.",
node,
)
)
)