++ed by:
NEYASOV AERO CKRAS SKOLYCHEV KFLY

7 PAUSE users
3 non-PAUSE users.

Ed J

NAME

GraphQL::Schema - GraphQL schema object

SYNOPSIS

  use GraphQL::Schema;
  use GraphQL::Type::Object;
  my $schema = GraphQL::Schema->new(
    query => GraphQL::Type::Object->new(
      name => 'Query',
      fields => {
        getObject => {
          type => $interfaceType,
          resolve => sub {
            return {};
          }
        }
      }
    )
  );

DESCRIPTION

Class implementing GraphQL schema.

ATTRIBUTES

query

mutation

subscription

types

directives

METHODS

name2type

In this schema, returns a hash-ref mapping all types' names to their type object.

get_possible_types($abstract_type)

In this schema, get all of either the implementation types (if interface) or possible types (if union) of the $abstract_type.

is_possible_type($abstract_type, $possible_type)

In this schema, is the given $possible_type either an implementation (if interface) or a possibility (if union) of the $abstract_type?

assert_object_implements_interface($type, $iface)

In this schema, does the given $type implement interface $iface? If not, throw exception.

from_ast($ast[, \%kind2class])

Class method. Takes AST (array-ref of hash-refs) made by "parse" in GraphQL::Language::Parser and returns a schema object. Will not be a complete schema since it will have only default resolvers.

If \%kind2class is given, it will override the default mapping of SDL keywords to Perl classes. This is probably most useful for GraphQL::Type::Object. The default is available as %GraphQL::Schema::KIND2CLASS. E.g.

  my $schema = GraphQL::Schema->from_ast(
    $doc,
    { %GraphQL::Schema::KIND2CLASS, type => 'GraphQL::Type::Object::DBIC' }
  );

from_doc($doc)

Class method. Takes text that is a Schema Definition Language (SDL) (aka Interface Definition Language) document and returns a schema object. Will not be a complete schema since it will have only default resolvers.

to_doc($doc)

Returns Schema Definition Language (SDL) document that describes this schema object.

name2directive

In this schema, returns a hash-ref mapping all directives' names to their directive object.

FUNCTIONS

lookup_type($typedef, $name2type)

Turns given AST fragment into a type.

If the hash-ref's type member is a string, will return a type of that name.

If an array-ref, first element must be either list or non_null, second will be a recursive AST fragment, which will be passed into a recursive call. The result will then have the modifier method (list or non_null) called, and that will be returned.