GraphQL::Type::Union(3pm)

GraphQL::Type::Union3pm

Graphql union type

Usage

  use GraphQL::Type::Union;
  my $union_type = GraphQL::Type::Union->new(
    name => 'Union',
    types => [ $type1, $type2 ],
    resolve_type => sub {
      return $type1 if ref $_[0] eq 'Type1';
      return $type2 if ref $_[0] eq 'Type2';
    },
  );

Attributes

Inherits "name", "description" from GraphQL::Type.

types

Thunked array-ref of GraphQL::Type::Object objects.

resolve_type

Optional code-ref. Input is a value, returns a GraphQL type object for it. If not given, relies on its possible type objects having a provided "is_type_of".

Methods

get_types

Returns list of GraphQL::Type::Objects of which the object is a union, performing validation.

Releases

Unchanged in 2 releases since Debian 12 (Bookworm).

  1. 12–13

From libgraphql-perl 0.54-1 in Debian 13 (Trixie). Parsed by carta from the page's man source.