union

Creates a new named Union type.

Signature:

def union(
name: str,
types: Collection[Type[Any]] | None = None,
description: str | None = None,
directives: Iterable[object] = (),
inaccessible: bool = False,
tags: Iterable[str] | None = (),
) -> StrawberryUnion:
...

Parameters:

  1. name:

    The GraphQL name of the Union type.

    Type
    str
  2. types:

    The types that the Union can be. (Deprecated, use Annotated[U, strawberry.federation.union("Name")] instead)

    Type
    Collection[Type[Any]] | None
    Default
    None
  3. description:

    The GraphQL description of the Union type.

    Type
    str | None
    Default
    None
  4. directives:

    The directives to attach to the Union type.

    Type
    Iterable[object]
    Default
    ()
  5. inaccessible:

    Whether the Union type is inaccessible.

    Type
    bool
    Default
    False
  6. tags:

    The federation tags to attach to the Union type.

    Type
    Iterable[str] | None
    Default
    ()