New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Document the approach to limiting query depth #361
Labels
documentation
Improvements or additions to documentation
Comments
Graphene now includes optional, configurable validation for this, so I don't think we need to do anything within grapple. To limit query depth, you can append the rule to a custom from typing import List
import graphql
from django.conf import settings
from graphene import validation as graphene_validation
from graphene_django import views as graphene_django_views
from graphql.error import graphql_error
from graphql.language import ast
class CustomGraphQLView(graphene_django_views.GraphQLView):
...
def validate_query(self, document_ast: ast.DocumentNode) -> List[graphql_error.GraphQLError]:
return graphql.validate(
schema=self.schema.graphql_schema,
document_ast=document_ast,
rules=[
graphene_validation.depth_limit_validator(
max_depth=settings.MAX_GRAPHQL_QUERY_DEPTH
),
],
) |
zerolab
changed the title
Add option to limit query depth
Document the approach to limiting query depth
Jan 12, 2024
@kbayliss that's neat. Updated the issue to reflect that this is now a documentation issue. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Refs:
#325 could help with some of the nesting for pages
The text was updated successfully, but these errors were encountered: