StrawberryField
Constructor:
Signature:
Parameters:
-
python_name:
- Type
-
str | None
- Default
-
None
-
graphql_name:
- Type
-
str | None
- Default
-
None
-
type_annotation:
- Type
-
StrawberryAnnotation | None
- Default
-
None
-
origin:
- Type
-
Type | Callable | staticmethod | classmethod | None
- Default
-
None
-
is_subscription:
- Type
-
bool
- Default
-
False
-
description:
- Type
-
str | None
- Default
-
None
-
base_resolver:
- Type
-
StrawberryResolver | None
- Default
-
None
-
permission_classes:
- Type
-
List[Type[BasePermission]]
- Default
-
()
-
default:
- Type
-
object
- Default
-
dataclasses.MISSING
-
default_factory:
- Type
-
Callable[[], Any] | object
- Default
-
dataclasses.MISSING
-
metadata:
- Type
-
Mapping[Any, Any] | None
- Default
-
None
-
deprecation_reason:
- Type
-
str | None
- Default
-
None
-
directives:
- Type
-
Sequence[object]
- Default
-
()
-
extensions:
- Type
-
List[FieldExtension]
- Default
-
()
Methods:
-
get_result
Calls the resolver defined for the StrawberryField.
If the field doesn’t have a resolver defined we default to using the default resolver specified in StrawberryConfig.
Signature:
Parameters:
-
source:
- Type
-
Any
-
info:
- Type
-
Info | None
-
args:
- Type
-
List[Any]
-
kwargs:
- Type
-
Any
-
-
resolve_type
Signature:
Parameters:
-
type_definition:
- Type
-
StrawberryObjectDefinition | None
- Default
-
None
-
-
copy_with
Signature:
Parameters:
-
type_var_map:
- Type
-
Mapping[str, StrawberryType | builtins.type]
-
Attributes:
-
type_annotation:
- Type
-
StrawberryAnnotation | None
-
default_resolver:
- Type
-
Callable[[Any, str], object]
-
graphql_name:
-
python_name:
- Type
-
str
-
description:
- Type
-
str | None
-
origin:
-
base_resolver:
- Type
-
StrawberryResolver | None
-
default_value:
-
is_subscription:
-
permission_classes:
- Type
-
List[Type[BasePermission]]
-
directives:
-
extensions:
- Type
-
List[FieldExtension]
-
deprecation_reason:
-
is_basic_field:
Returns a boolean indicating if the field is a basic field.
A “basic” field us a field that has no resolver or permission classes, i.e. it just returns the relevant attribute from the source object. If it is a basic field we can avoid constructing an
Info
object and running any permission checks in the resolver which improves performance.- Type
-
bool
-
arguments:
- Type
-
List[StrawberryArgument]
-
is_graphql_generic:
- Type
-
bool
-
type:
- Type
-
StrawberryType | Type[WithStrawberryObjectDefinition] | Literal[UNRESOLVED]
-
type_params:
- Type
-
List[TypeVar]
-
is_async:
- Type
-
bool