strawberry.extensions.MaxTokensLimiter
Add a validator to limit the number of tokens in a GraphQL document.
Example:
The following things are counted as tokens:
- various brackets: "{", "}", "(", ")"
- colon :
- words
Not counted:
- quotes
Constructor:
Initialize the MaxTokensLimiter.
Signature:
Parameters:
-
max_token_count:
The maximum number of tokens allowed in a GraphQL document.
- Type
-
int
Methods:
-
on_operation
Signature:
Attributes:
-
max_token_count: