directive

Decorator to create a GraphQL operation directive.

Returns:

A StrawberryDirective object that can be used to customise a directive

Signature:

def directive(
locations: List[DirectiveLocation],
description: str | None = None,
name: str | None = None,
) -> Callable[[Callable[..., T]], StrawberryDirective[T]]:
...

Parameters:

  1. locations:

    The locations where the directive can be used

    Type
    List[DirectiveLocation]
  2. description:

    The GraphQL description of the directive

    Type
    str | None
    Default
    None
  3. name:

    The GraphQL name of the directive

    Type
    str | None
    Default
    None