strawberry.argument

Function to add metadata to an argument, like a description or deprecation reason.

Returns:

A StrawberryArgumentAnnotation object that can be used to customise an argument

Signature:

def argument(
description: str | None = None,
name: str | None = None,
deprecation_reason: str | None = None,
directives: Iterable[object] = (),
metadata: Mapping[Any, Any] | None = None,
) -> StrawberryArgumentAnnotation:
...

Parameters:

  1. description:

    The GraphQL description of the argument

    Type
    str | None
    Default
    None
  2. name:

    The GraphQL name of the argument

    Type
    str | None
    Default
    None
  3. deprecation_reason:

    The reason why this argument is deprecated, setting this will mark the argument as deprecated

    Type
    str | None
    Default
    None
  4. directives:

    The directives to attach to the argument

    Type
    Iterable[object]
    Default
    ()
  5. metadata:

    Metadata to attach to the argument, this can be used to store custom data that can be used by custom logic or plugins

    Type
    Mapping[Any, Any] | None
    Default
    None