.\" Automatically generated by Pod::Man 4.14 (Pod::Simple 3.42) .\" .\" Standard preamble: .\" ======================================================================== .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" Set up some character translations and predefined strings. \*(-- will .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left .\" double quote, and \*(R" will give a right double quote. \*(C+ will .\" give a nicer C++. Capital omega is used to do unbreakable dashes and .\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff, .\" nothing in troff, for use with C<>. .tr \(*W- .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' .ie n \{\ . ds -- \(*W- . ds PI pi . if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch . if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch . ds L" "" . ds R" "" . ds C` "" . ds C' "" 'br\} .el\{\ . ds -- \|\(em\| . ds PI \(*p . ds L" `` . ds R" '' . ds C` . ds C' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" If the F register is >0, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .\" .\" Avoid warning from groff about undefined register 'F'. .de IX .. .nr rF 0 .if \n(.g .if rF .nr rF 1 .if (\n(rF:(\n(.g==0)) \{\ . if \nF \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{\ . nr % 0 . nr F 2 . \} . \} .\} .rr rF .\" ======================================================================== .\" .IX Title "GraphQL::Schema 3pm" .TH GraphQL::Schema 3pm "2022-03-27" "perl v5.34.0" "User Contributed Perl Documentation" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH "NAME" GraphQL::Schema \- GraphQL schema object .SH "SYNOPSIS" .IX Header "SYNOPSIS" .Vb 10 \& use GraphQL::Schema; \& use GraphQL::Type::Object; \& my $schema = GraphQL::Schema\->new( \& query => GraphQL::Type::Object\->new( \& name => \*(AqQuery\*(Aq, \& fields => { \& getObject => { \& type => $interfaceType, \& resolve => sub { \& return {}; \& } \& } \& } \& ) \& ); .Ve .SH "DESCRIPTION" .IX Header "DESCRIPTION" Class implementing GraphQL schema. .SH "ATTRIBUTES" .IX Header "ATTRIBUTES" .SS "query" .IX Subsection "query" .SS "mutation" .IX Subsection "mutation" .SS "subscription" .IX Subsection "subscription" .SS "types" .IX Subsection "types" Defaults to the types returned by \*(L"registered\*(R" in GraphQL::Plugin::Type. Note that this includes the standard scalar types always loaded by GraphQL::Type::Scalar. If you wish to supply an overriding value for this attribute, bear that in mind. .SS "directives" .IX Subsection "directives" .SH "METHODS" .IX Header "METHODS" .SS "name2type" .IX Subsection "name2type" In this schema, returns a hash-ref mapping all types' names to their type object. .SS "get_possible_types($abstract_type)" .IX Subsection "get_possible_types($abstract_type)" In this schema, get all of either the implementation types (if interface) or possible types (if union) of the \f(CW$abstract_type\fR. .ie n .SS "is_possible_type($abstract_type, $possible_type)" .el .SS "is_possible_type($abstract_type, \f(CW$possible_type\fP)" .IX Subsection "is_possible_type($abstract_type, $possible_type)" In this schema, is the given \f(CW$possible_type\fR either an implementation (if interface) or a possibility (if union) of the \f(CW$abstract_type\fR? .ie n .SS "assert_object_implements_interface($type, $iface)" .el .SS "assert_object_implements_interface($type, \f(CW$iface\fP)" .IX Subsection "assert_object_implements_interface($type, $iface)" In this schema, does the given \f(CW$type\fR implement interface \f(CW$iface\fR? If not, throw exception. .SS "from_ast($ast[, \e%kind2class])" .IX Subsection "from_ast($ast[, %kind2class])" Class method. Takes \s-1AST\s0 (array-ref of hash-refs) made by \&\*(L"parse\*(R" in GraphQL::Language::Parser and returns a schema object. Will not be a complete schema since it will have only default resolvers. .PP If \f(CW\*(C`\e%kind2class\*(C'\fR is given, it will override the default mapping of \s-1SDL\s0 keywords to Perl classes. This is probably most useful for GraphQL::Type::Object. The default is available as \&\f(CW%GraphQL::Schema::KIND2CLASS\fR. E.g. .PP .Vb 4 \& my $schema = GraphQL::Schema\->from_ast( \& $doc, \& { %GraphQL::Schema::KIND2CLASS, type => \*(AqGraphQL::Type::Object::DBIC\*(Aq } \& ); .Ve .PP Makes available the additional types returned by \&\*(L"registered\*(R" in GraphQL::Plugin::Type. .SS "from_doc($doc[, \e%kind2class])" .IX Subsection "from_doc($doc[, %kind2class])" Class method. Takes text that is a Schema Definition Language (\s-1SDL\s0) (aka Interface Definition Language) document and returns a schema object. Will not be a complete schema since it will have only default resolvers. .PP As of v0.32, this accepts both old-style \*(L"meaningful comments\*(R" and new-style string values, as field or type descriptions. .PP If \f(CW\*(C`\e%kind2class\*(C'\fR is given, it will override the default mapping of \s-1SDL\s0 keywords to Perl classes. This is probably most useful for GraphQL::Type::Object. The default is available as \&\f(CW%GraphQL::Schema::KIND2CLASS\fR. .SS "to_doc($doc)" .IX Subsection "to_doc($doc)" Returns Schema Definition Language (\s-1SDL\s0) document that describes this schema object. .PP As of v0.32, this produces the new-style descriptions that are string values, rather than old-style \*(L"meaningful comments\*(R". .PP As of v0.33, will not return a description of types supplied with the attribute \*(L"types\*(R". Obviously, by default this includes types returned by \*(L"registered\*(R" in GraphQL::Plugin::Type. .SS "name2directive" .IX Subsection "name2directive" In this schema, returns a hash-ref mapping all directives' names to their directive object. .SH "FUNCTIONS" .IX Header "FUNCTIONS" .ie n .SS "lookup_type($typedef, $name2type)" .el .SS "lookup_type($typedef, \f(CW$name2type\fP)" .IX Subsection "lookup_type($typedef, $name2type)" Turns given \s-1AST\s0 fragment into a type. .PP If the hash-ref's \f(CW\*(C`type\*(C'\fR member is a string, will return a type of that name. .PP If an array-ref, first element must be either \f(CW\*(C`list\*(C'\fR or \f(CW\*(C`non_null\*(C'\fR, second will be a recursive \s-1AST\s0 fragment, which will be passed into a recursive call. The result will then have the modifier method (\f(CW\*(C`list\*(C'\fR or \f(CW\*(C`non_null\*(C'\fR) called, and that will be returned.