StrawberryField

Constructor:

Signature:

def __init__(
self,
python_name: str | None = None,
graphql_name: str | None = None,
type_annotation: StrawberryAnnotation | None = None,
origin: Type | Callable | staticmethod | classmethod | None = None,
is_subscription: bool = False,
description: str | None = None,
base_resolver: StrawberryResolver | None = None,
permission_classes: List[Type[BasePermission]] = (),
default: object = dataclasses.MISSING,
default_factory: Callable[[], Any] | object = dataclasses.MISSING,
metadata: Mapping[Any, Any] | None = None,
deprecation_reason: str | None = None,
directives: Sequence[object] = (),
extensions: List[FieldExtension] = (),
) -> None:
...

Parameters:

  1. python_name:

    Type
    str | None
    Default
    None
  2. graphql_name:

    Type
    str | None
    Default
    None
  3. type_annotation:

    Type
    StrawberryAnnotation | None
    Default
    None
  4. origin:

    Type
    Type | Callable | staticmethod | classmethod | None
    Default
    None
  5. is_subscription:

    Type
    bool
    Default
    False
  6. description:

    Type
    str | None
    Default
    None
  7. base_resolver:

    Type
    StrawberryResolver | None
    Default
    None
  8. permission_classes:

    Type
    List[Type[BasePermission]]
    Default
    ()
  9. default:

    Type
    object
    Default
    dataclasses.MISSING
  10. default_factory:

    Type
    Callable[[], Any] | object
    Default
    dataclasses.MISSING
  11. metadata:

    Type
    Mapping[Any, Any] | None
    Default
    None
  12. deprecation_reason:

    Type
    str | None
    Default
    None
  13. directives:

    Type
    Sequence[object]
    Default
    ()
  14. extensions:

    Type
    List[FieldExtension]
    Default
    ()

Methods:

Attributes:

  1. type_annotation:

    Type
    StrawberryAnnotation | None
  2. default_resolver:

    Type
    Callable[[Any, str], object]
  3. graphql_name:

  4. python_name:

    Type
    str
  5. description:

    Type
    str | None
  6. origin:

  7. base_resolver:

    Type
    StrawberryResolver | None
  8. default_value:

  9. is_subscription:

  10. permission_classes:

    Type
    List[Type[BasePermission]]
  11. directives:

  12. extensions:

    Type
    List[FieldExtension]
  13. deprecation_reason:

  14. 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
  15. arguments:

    Type
    List[StrawberryArgument]
  16. is_graphql_generic:

    Type
    bool
  17. type:

    Type
    StrawberryType | Type[WithStrawberryObjectDefinition] | Literal[UNRESOLVED]
  18. type_params:

    Type
    List[TypeVar]
  19. is_async:

    Type
    bool