.\" 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::Type 3pm" .TH GraphQL::Type 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::Type \- GraphQL type object .SH "SYNOPSIS" .IX Header "SYNOPSIS" .Vb 1 \& extends qw(GraphQL::Type); .Ve .SH "DESCRIPTION" .IX Header "DESCRIPTION" Superclass for other GraphQL type classes to inherit from. .SH "ENCODING" .IX Header "ENCODING" Those Perl classes each implement a GraphQL type. Each item of GraphQL data has a GraphQL type. Such an item of data can also be represented within Perl. Objects of that Perl class take responsibility for translating between the Perl representation and the \*(L"GraphQL representation\*(R". A \*(L"GraphQL representation\*(R" means something JSON-encodeable: an \*(L"object\*(R" (in Perl terms, a hash), an array (Perl: array-reference), string, number, boolean, or null. .PP See \*(L"\s-1METHODS\*(R"\s0 for generic methods to translate back and forth between these worlds. .PP Code that you provide to do this translation must return things that \&\fIcan\fR be JSON-encoded, not things that \fIhave been\fR so encoded: this means, among other things, do not surround strings in \f(CW\*(C`"\*(C'\fR, and for boolean values, use the mechanism in JSON::MaybeXS: \f(CW\*(C`JSON\-\*(C'\fRtrue> etc. .SH "SUBCLASSES" .IX Header "SUBCLASSES" These subclasses implement part of the GraphQL language specification. Objects of these classes implement user-defined types used to implement a GraphQL \s-1API.\s0 .IP "GraphQL::Type::Enum" 4 .IX Item "GraphQL::Type::Enum" .PD 0 .IP "GraphQL::Type::InputObject" 4 .IX Item "GraphQL::Type::InputObject" .IP "GraphQL::Type::Interface" 4 .IX Item "GraphQL::Type::Interface" .IP "GraphQL::Type::List" 4 .IX Item "GraphQL::Type::List" .IP "GraphQL::Type::NonNull" 4 .IX Item "GraphQL::Type::NonNull" .IP "GraphQL::Type::Object" 4 .IX Item "GraphQL::Type::Object" .ie n .IP "GraphQL::Type::Scalar \- also implements example types such as ""String""" 4 .el .IP "GraphQL::Type::Scalar \- also implements example types such as \f(CWString\fR" 4 .IX Item "GraphQL::Type::Scalar - also implements example types such as String" .IP "GraphQL::Type::Union" 4 .IX Item "GraphQL::Type::Union" .PD .SH "ROLES" .IX Header "ROLES" These roles implement part of the GraphQL language specification. They are applied to objects of GraphQL::Type classes, either to facilitate type constrants, or as noted below. .ie n .IP "GraphQL::Role::FieldsInput \- provides ""fields"" attribute for an input type" 4 .el .IP "GraphQL::Role::FieldsInput \- provides \f(CWfields\fR attribute for an input type" 4 .IX Item "GraphQL::Role::FieldsInput - provides fields attribute for an input type" .PD 0 .ie n .IP "GraphQL::Role::FieldsOutput \- provides ""fields"" attribute for an output type" 4 .el .IP "GraphQL::Role::FieldsOutput \- provides \f(CWfields\fR attribute for an output type" 4 .IX Item "GraphQL::Role::FieldsOutput - provides fields attribute for an output type" .IP "GraphQL::Role::Abstract \- abstract type" 4 .IX Item "GraphQL::Role::Abstract - abstract type" .IP "GraphQL::Role::Composite \- type has fields" 4 .IX Item "GraphQL::Role::Composite - type has fields" .IP "GraphQL::Role::Input \- type can be an input" 4 .IX Item "GraphQL::Role::Input - type can be an input" .IP "GraphQL::Role::Leaf \- simple type \- enum or scalar" 4 .IX Item "GraphQL::Role::Leaf - simple type - enum or scalar" .IP "GraphQL::Role::Listable \- can be list-wrapped; provides convenience method" 4 .IX Item "GraphQL::Role::Listable - can be list-wrapped; provides convenience method" .ie n .IP "GraphQL::Role::Named \- has a ""name"" and ""description"", provided by this role" 4 .el .IP "GraphQL::Role::Named \- has a \f(CWname\fR and \f(CWdescription\fR, provided by this role" 4 .IX Item "GraphQL::Role::Named - has a name and description, provided by this role" .IP "GraphQL::Role::Nullable \- can be null-valued" 4 .IX Item "GraphQL::Role::Nullable - can be null-valued" .IP "GraphQL::Role::Output \- type can be an output" 4 .IX Item "GraphQL::Role::Output - type can be an output" .PD .SH "TYPE LIBRARY" .IX Header "TYPE LIBRARY" GraphQL::Type::Library \- implements various Type::Tiny type constraints, for use in Moo attributes, and Function::Parameters/Return::Type methods and functions. .SH "METHODS" .IX Header "METHODS" .SS "uplift" .IX Subsection "uplift" Turn given Perl entity into valid Perl value for this type if possible. .SS "graphql_to_perl" .IX Subsection "graphql_to_perl" Turn given GraphQL entity into Perl entity. .SS "perl_to_graphql" .IX Subsection "perl_to_graphql" Turn given Perl entity into GraphQL entity. .ie n .SS "from_ast($name2type, $ast_node)" .el .SS "from_ast($name2type, \f(CW$ast_node\fP)" .IX Subsection "from_ast($name2type, $ast_node)" Class method. \f(CW$name2type\fR is a hash-ref populated by \&\*(L"from_ast\*(R" in GraphQL::Schema. Takes a hash-ref node from an \s-1AST\s0 made by \&\*(L"parse\*(R" in GraphQL::Language::Parser. Returns a type object. .SS "to_doc($doc)" .IX Subsection "to_doc($doc)" Returns Schema Definition Language (\s-1SDL\s0) document that describes this object.