strawberry.extensions.QueryDepthLimiter
Add a validator to limit the query depth of GraphQL operations.
Example:
Constructor:
Initialize the QueryDepthLimiter.
Signature:
Parameters:
-
max_depth:
The maximum allowed depth for any operation in a GraphQL document.
- Type
-
int
-
callback:
Called each time validation runs. Receives an Object which is a map of the depths for each operation.
- Type
-
Callable[[Dict[str, int]], None] | None
- Default
-
None
-
should_ignore:
Stops recursive depth checking based on a field name and arguments. A function that returns a boolean and conforms to the ShouldIgnoreType function signature.
- Type
-
ShouldIgnoreType | None
- Default
-
None