MaxTokensLimiter

Add a validator to limit the number of tokens in a GraphQL document.

Example:

import strawberry
from strawberry.extensions import MaxTokensLimiter
schema = strawberry.Schema(Query, extensions=[MaxTokensLimiter(max_token_count=1000)])

The following things are counted as tokens:

Not counted:

Constructor:

Initialize the MaxTokensLimiter.

Signature:

def __init__(self, max_token_count: int) -> None:
...

Parameters:

  1. max_token_count:

    The maximum number of tokens allowed in a GraphQL document.

    Type
    int

Methods:

Attributes:

  1. max_token_count: