scalar

Annotates a class or type as a GraphQL custom scalar.

Returns:

The decorated class or type

Signature:

def scalar(
cls: _T | None = None,
name: str | None = None,
description: str | None = None,
specified_by_url: str | None = None,
serialize: Callable = identity,
parse_value: Callable | None = None,
parse_literal: Callable | None = None,
directives: Iterable[object] = (),
authenticated: bool = False,
inaccessible: bool = False,
policy: List[List[str]] | None = None,
requires_scopes: List[List[str]] | None = None,
tags: Iterable[str] | None = (),
) -> Any:
...

Parameters:

  1. name:

    The GraphQL name of the scalar

    Type
    str | None
    Default
    None
  2. description:

    The description of the scalar

    Type
    str | None
    Default
    None
  3. specified_by_url:

    The URL of the specification

    Type
    str | None
    Default
    None
  4. serialize:

    The function to serialize the scalar

    Type
    Callable
    Default
    identity
  5. parse_value:

    The function to parse the value

    Type
    Callable | None
    Default
    None
  6. parse_literal:

    The function to parse the literal

    Type
    Callable | None
    Default
    None
  7. directives:

    The directives to apply to the scalar

    Type
    Iterable[object]
    Default
    ()
  8. authenticated:

    Whether to add the @authenticated directive

    Type
    bool
    Default
    False
  9. inaccessible:

    Whether to add the @inaccessible directive

    Type
    bool
    Default
    False
  10. policy:

    The list of policy names to add to the @policy directive

    Type
    List[List[str]] | None
    Default
    None
  11. requires_scopes:

    The list of scopes to add to the @requires directive

    Type
    List[List[str]] | None
    Default
    None
  12. tags:

    The list of tags to add to the @tag directive

    Type
    Iterable[str] | None
    Default
    ()