graphene
graphene copied to clipboard
DisableIntrospection validation rule restrict __typename queries
-
What is the current behavior?
graphene.validation.disable_introspection.DisableIntrospection
doesn't allow to query__typename
-
If the current behavior is a bug, please provide the steps to reproduce and if possible a minimal demo of the problem https://github.com/graphql-python/graphene/blob/9c1db0f66247893c81d681fc3152ff0955fc3cd3/docs/execution/queryvalidation.rst#disable-introspection And then do some query witth
__typename
-
What is the expected behavior? Allow to query
__typename
field. The other way is to remove this validation rule in favour of built-in graphqlNoSchemaIntrospectionCustomRule
https://github.com/graphql-python/graphql-core/blob/main/src/graphql/validation/rules/custom/no_schema_introspection.py#L11 -
What is the motivation / use case for changing the behavior?
__typename
is important thing for Apollo client (for data caching) -
Please tell us about your environment:
- Version: Python 3.9, graphene 3.0b8
- Platform: Ubuntu 20
@antonmyronyuk could you just import this NoSchemaIntrospectionCustomRule
rule and use that instead?
from graphql.validation import NoSchemaIntrospectionCustomRule
...
validation_errors = validate(
schema=schema.graphql_schema,
document_ast=parse('THE QUERY'),
rules=(
NoSchemaIntrospectionCustomRule,
)
)
@theodesp yes, standard NoSchemaIntrospectionCustomRule
works fine
I mean graphene.validation.disable_introspection.DisableIntrospection
should be fixed or replaced with standard validator to have the same behaviour
Hey @theodesp, @antonmyronyuk, what is "THE QUERY'? Can you please explain it with an example? I want to disable introspection. What should I write here?