strawberry.type
Annotates a class as a GraphQL type.
Similar to dataclasses.dataclass
, but with additional functionality for
defining GraphQL types.
Returns:
The class.
Signature:
Parameters:
-
name:
The name of the GraphQL type.
- Type
-
str | None
- Default
-
None
-
is_input:
Whether the class is an input type. Used internally, use
@strawerry.input
instead of passing this flag.- Type
-
bool
- Default
-
False
-
is_interface:
Whether the class is an interface. Used internally, use
@strawerry.interface
instead of passing this flag.- Type
-
bool
- Default
-
False
-
description:
The description of the GraphQL type.
- Type
-
str | None
- Default
-
None
-
directives:
The directives of the GraphQL type.
- Type
-
Sequence[object] | None
- Default
-
()
-
extend:
Whether the class is extending an existing type.
- Type
-
bool
- Default
-
False