strawberry.scalar
Annotates a class or type as a GraphQL custom scalar.
Returns:
The decorated class or type.
Signature:
Parameters:
-
name:
The GraphQL name of the scalar.
- Type
-
str | None
- Default
-
None
-
description:
The description of the scalar.
- Type
-
str | None
- Default
-
None
-
specified_by_url:
The URL of the specification.
- Type
-
str | None
- Default
-
None
-
serialize:
The function to serialize the scalar.
- Type
-
Callable
- Default
-
identity
-
parse_value:
The function to parse the value.
- Type
-
Callable | None
- Default
-
None
-
parse_literal:
The function to parse the literal.
- Type
-
Callable | None
- Default
-
None
-
directives:
The directives to apply to the scalar.
- Type
-
Iterable[object]
- Default
-
()