strawberry.experimental.pydantic.input

Convenience decorator for creating an input type from a Pydantic model.

Equal to partial(type, is_input=True)

See https://github.com/strawberry-graphql/strawberry/issues/1830 .

Signature:

def input(
model: Type[PydanticModel],
fields: List[str] | None = None,
name: str | None = None,
is_interface: bool = False,
description: str | None = None,
directives: Sequence[object] | None = (),
all_fields: bool = False,
use_pydantic_alias: bool = True,
) -> Callable[..., Type[StrawberryTypeFromPydantic[PydanticModel]]]:
...

Parameters:

  1. model:

    Type
    Type[PydanticModel]
  2. fields:

    Type
    List[str] | None
    Default
    None
  3. name:

    Type
    str | None
    Default
    None
  4. is_interface:

    Type
    bool
    Default
    False
  5. description:

    Type
    str | None
    Default
    None
  6. directives:

    Type
    Sequence[object] | None
    Default
    ()
  7. all_fields:

    Type
    bool
    Default
    False
  8. use_pydantic_alias:

    Type
    bool
    Default
    True