| 1 |
|
| package GraphQL::Schema; |
| 2 |
|
| |
| 3 |
17 |
▶ | use 5.014; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
|
| 4 |
17 |
▶ | use strict; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
|
| 5 |
39 |
▶ | use warnings; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
|
| 6 |
24 |
▶ | use Moo; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
|
| 7 |
371 |
▶ | use Types::Standard -all; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
|
| 8 |
5973 |
▶ | use GraphQL::Type::Library -all; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
|
| 9 |
1113 |
▶ | use GraphQL::MaybeTypeCheck; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
|
| 10 |
1113 |
▶ | use GraphQL::Debug qw(_debug); |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
|
| 11 |
1112 |
▶ | use GraphQL::Directive; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
|
| 12 |
1111 |
▶ | use GraphQL::Introspection qw($SCHEMA_META_TYPE); |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
|
| 13 |
2510 |
▶ | use GraphQL::Language::Parser qw(parse); |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
|
| 14 |
1107 |
▶ | use GraphQL::Plugin::Type; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
|
| 15 |
17 |
▶ | use Module::Runtime qw(require_module); |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
|
| 16 |
17 |
▶ | use Exporter 'import'; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
|
| 17 |
|
| |
| 18 |
|
| our $VERSION = '0.02'; |
| 19 |
|
| our @EXPORT_OK = qw(lookup_type); |
| 20 |
17 |
▶ | use constant DEBUG => $ENV{GRAPHQL_DEBUG}; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
|
| 21 |
|
| my @TYPE_ATTRS = qw(query mutation subscription); |
| 22 |
|
| |
| 23 |
|
| =head1 NAME |
| 24 |
|
| |
| 25 |
|
| GraphQL::Schema - GraphQL schema object |
| 26 |
|
| |
| 27 |
|
| =head1 SYNOPSIS |
| 28 |
|
| |
| 29 |
|
| use GraphQL::Schema; |
| 30 |
|
| use GraphQL::Type::Object; |
| 31 |
|
| my $schema = GraphQL::Schema->new( |
| 32 |
|
| query => GraphQL::Type::Object->new( |
| 33 |
|
| name => 'Query', |
| 34 |
|
| fields => { |
| 35 |
|
| getObject => { |
| 36 |
|
| type => $interfaceType, |
| 37 |
|
| resolve => sub { |
| 38 |
|
| return {}; |
| 39 |
|
| } |
| 40 |
|
| } |
| 41 |
|
| } |
| 42 |
|
| ) |
| 43 |
|
| ); |
| 44 |
|
| |
| 45 |
|
| =head1 DESCRIPTION |
| 46 |
|
| |
| 47 |
|
| Class implementing GraphQL schema. |
| 48 |
|
| |
| 49 |
|
| =head1 ATTRIBUTES |
| 50 |
|
| |
| 51 |
|
| =head2 query |
| 52 |
|
| |
| 53 |
|
| =cut |
| 54 |
|
| |
| 55 |
|
| has query => (is => 'ro', isa => InstanceOf['GraphQL::Type::Object'], required => 1); |
| 56 |
|
| |
| 57 |
|
| =head2 mutation |
| 58 |
|
| |
| 59 |
|
| =cut |
| 60 |
|
| |
| 61 |
|
| has mutation => (is => 'ro', isa => InstanceOf['GraphQL::Type::Object']); |
| 62 |
|
| |
| 63 |
|
| =head2 subscription |
| 64 |
|
| |
| 65 |
|
| =cut |
| 66 |
|
| |
| 67 |
|
| has subscription => (is => 'ro', isa => InstanceOf['GraphQL::Type::Object']); |
| 68 |
|
| |
| 69 |
|
| =head2 types |
| 70 |
|
| |
| 71 |
|
| Defaults to the types returned by L<GraphQL::Plugin::Type/registered>. |
| 72 |
|
| Note that this includes the standard scalar types always loaded by |
| 73 |
|
| L<GraphQL::Type::Scalar>. If you |
| 74 |
|
| wish to supply an overriding value for this attribute, bear that in mind. |
| 75 |
|
| |
| 76 |
|
| =cut |
| 77 |
|
| |
| 78 |
|
| has types => ( |
| 79 |
|
| is => 'ro', |
| 80 |
|
| isa => ArrayRef[ConsumerOf['GraphQL::Role::Named']], |
| 81 |
98 |
▶ | default => sub { [ GraphQL::Plugin::Type->registered ] }, |
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
|
| 82 |
|
| ); |
| 83 |
|
| |
| 84 |
|
| =head2 directives |
| 85 |
|
| |
| 86 |
|
| =cut |
| 87 |
|
| |
| 88 |
|
| has directives => ( |
| 89 |
|
| is => 'ro', |
| 90 |
|
| isa => ArrayRef[InstanceOf['GraphQL::Directive']], |
| 91 |
145 |
▶ | default => sub { \@GraphQL::Directive::SPECIFIED_DIRECTIVES }, |
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
|
| 92 |
|
| ); |
| 93 |
|
| |
| 94 |
|
| =head1 METHODS |
| 95 |
|
| |
| 96 |
|
| =head2 name2type |
| 97 |
|
| |
| 98 |
|
| In this schema, returns a hash-ref mapping all types' names to their |
| 99 |
|
| type object. |
| 100 |
|
| |
| 101 |
|
| =cut |
| 102 |
|
| |
| 103 |
|
| has name2type => (is => 'lazy', isa => Map[StrNameValid, ConsumerOf['GraphQL::Role::Named']]); |
| 104 |
75 |
▶ | sub _build_name2type { |
|
Subroutine
_build_name2type: called CC=2 SCAR=7.0
|
| 105 |
75 |
| my ($self) = @_; |
| 106 |
75 |
| my @types = grep $_, (map $self->$_, @TYPE_ATTRS), $SCHEMA_META_TYPE; |
| 107 |
75 |
▶ | push @types, @{ $self->types || [] }; |
MC/DC0%0/1
$self->types || []
$self->types
|
| 108 |
75 |
| my %name2type; |
| 109 |
75 |
| map _expand_type(\%name2type, $_), @types; |
| 110 |
71 |
| \%name2type; |
| 111 |
|
| } |
| 112 |
|
| |
| 113 |
|
| =head2 get_possible_types($abstract_type) |
| 114 |
|
| |
| 115 |
|
| In this schema, get all of either the implementation types |
| 116 |
|
| (if interface) or possible types (if union) of the C<$abstract_type>. |
| 117 |
|
| |
| 118 |
|
| =cut |
| 119 |
|
| |
| 120 |
5848 |
▶ | fun _expand_type( |
|
Subroutine
_expand_type: called CC=26 SCAR=34.0
|
| 121 |
|
| (Map[StrNameValid, ConsumerOf['GraphQL::Role::Named']]) $map, |
| 122 |
|
| (InstanceOf['GraphQL::Type']) $type, |
| 123 |
5848 |
▶ | ) :ReturnType(ArrayRef[ConsumerOf['GraphQL::Role::Named']]) { |
Branch: 4 branches
| Branch | True | False | Total |
| @_ < 2 and Function::Parameters::_croak('Too few arguments for fun _expand_type (expected 2, got ' . @_ . ')') |
18 |
5856 |
5874 |
| @_ > 2 and Function::Parameters::_croak('Too many arguments for fun _expand_type (expected 2, got ' . @_ . ')') |
13 |
5857 |
5870 |
| do {
package Type::Tiny;
Ref::Util::XS::is_plain_hashref($map) and do {
my $ok = 1;
foreach my $v (values %{$map;}) {
$ok = 0, last unless do {
builtin::blessed($v) and do {
my $method = $v->can("DOES") || $v->can("isa");
$v->$method("GraphQL::Role::Named")
}
};
};
foreach my $k (keys %{$map;}) {
$ok = 0, last unless defined $k and not ref $k and not !($k =~ qr/(?^u:^[_a-zA-Z][_a-zA-Z0-9]*$)/u);
};
$ok
}
} or Function::Parameters::_croak('In fun _expand_type: parameter 1 ($map): ' . ${my $v = bless( {"_build_coercion" => sub { package Type::Tiny; use warnings; use strict; my $coercion = shift(); my $built = $self->coercion_generator->($self, $P, @args); $coercion->add_type_coercions(@{$built->type_coercion_map;}) if $built; $coercion->freeze;},"_overload_coderef" => sub { package Sub::Defer; use warnings; use strict; $undeferred ||= undefer_sub($deferred_info->[4]); goto \&$undeferred;},"_overload_coderef_no_rebuild" => 1,"_overrides_assert_return" => !!0,"coercion" => bless( {"_compiled_type_constraint_check" => sub ($) { package Eval::TypeTiny::Sandbox; use strict; do { package Type::Tiny; Ref::Util::XS::is_plain_hashref($_[0]) and do { my $ok = 1; foreach my $v (values %{$_[0];}) { $ok = 0, last unless do { builtin::blessed($v) and do { my $method = $v->can('DOES') || $v->can('isa'); $v->$method('GraphQL::Role::Named') } }; } foreach my $k (keys %{$_[0];}) { $ok = 0, last unless defined $k and not ref $k and not !($k =~ qr/(?^u:^[_a-zA-Z][_a-zA-Z0-9]*$)/); } $ok } };},"frozen" => 1,"name" => "__ANON__","type_coercion_map" => [],"type_constraint" => {}}, 'Type::Coercion' ),"compiled_type_constraint" => do{my $o},"constraint" => sub { package Types::Standard::Map; no warnings; use strict; my $hash = shift(); ($keys->check($_) or return) foreach (keys %$hash); ($values->check($_) or return) foreach (values %$hash); return !0;},"definition_context" => {"file" => "/home/cpancover/.cpan/build/GraphQL-0.54-0/blib/lib/GraphQL/Schema.pm","line" => 121,"package" => "GraphQL::Schema"},"deprecated" => !!0,"display_name" => "Map[StrNameValid,ConsumerOf[\"GraphQL::Role::Named\"]]","exception_class" => "Error::TypeTiny::Assertion","inlined" => sub { package Types::Standard::Map; no warnings; use strict; my $h = $_[1]; return "$xsubname($h)" if $xsubname and not $Type::Tiny::AvoidCallbacks; my $p = &Types::Standard::HashRef()->inline_check($h); my $k_check = $k->inline_check('$k'); my $v_check = $v->inline_check('$v'); "$p and do { " . 'my $ok = 1; ' . "for my \$v (values %{$h}) { " . "(\$ok = 0, last) unless $v_check " . '}; ' . "for my \$k (keys %{$h}) { " . "(\$ok = 0, last) unless $k_check " . '}; ' . '$ok ' . '}';},"name" => "__ANON__","parameters" => [bless( {"_overload_coderef" => sub { package Sub::Defer; use warnings; use strict; $undeferred ||= undefer_sub($deferred_info->[4]); goto \&$undeferred;},"_overload_coderef_no_rebuild" => 1,"_overrides_assert_return" => !!0,"compiled_type_constraint" => sub ($) { package Eval::TypeTiny::Sandbox; use strict; defined $_[0] and not ref $_[0] and not !($_[0] =~ qr/(?^u:^[_a-zA-Z][_a-zA-Z0-9]*$)/);},"constraint" => sub { package Type::Tiny; use warnings; use strict; !0;},"definition_context" => {"file" => "/home/cpancover/.cpan/build/GraphQL-0.54-0/blib/lib/GraphQL/Type/Library.pm","line" => 42,"package" => "GraphQL::Type::Library"},"deprecated" => !!0,"display_name" => "StrNameValid","exception_class" => "Error::TypeTiny::Assertion","library" => "GraphQL::Type::Library","name" => "StrNameValid","parent" => bless( {"coercion" => bless( {"_compiled_type_constraint_check" => do{my $o},"frozen" => 1,"name" => "__ANON__","type_constraint" => {}}, 'Type::Coercion' ),"compiled_type_constraint" => do{my $o},"constraint" => sub { package Types::Standard::StrMatch; no warnings; use strict; my $value = shift(); defined $value and not ref $value and not !($value =~ /$regexp/);},"definition_context" => {"file" => "/home/cpancover/.cpan/build/GraphQL-0.54-0/blib/lib/GraphQL/Type/Library.pm","line" => 42,"package" => "GraphQL::Type::Library"},"deprecated" => !!0,"display_name" => "StrMatch[(?^u:^[_a-zA-Z][_a-zA-Z0-9]*\$)]","exception_class" => "Error::TypeTiny::Assertion","inlined" => sub { package Types::Standard::StrMatch; no warnings; use strict; my $v = $_[1]; if ($Type::Tiny::AvoidCallbacks and $serialized_re =~ /Types::Standard::StrMatch::expressions/) { require Carp; Carp::carp('Cannot serialize regexp without callbacks; serializing using callbacks'); } "defined($v) and !ref($v) and !!( $v =~ $serialized_re )";},"name" => "__ANON__","parameters" => [qr/^[_a-zA-Z][_a-zA-Z0-9]*$/u],"parent" => bless( {"_overload_coderef" => sub { package Type::Tiny; BEGIN {${^WARNING_BITS} = "\x10\x01\x00\x00\x00\x50\x04\x00\x00\x00\x00\x00\x01\x40\x05\x45\x55\x15\x55\x55\x01\x00"} use strict; Type::Tiny::XS::Str($_[0]) or _failed_check(33, 'StrMatch', $_[0], 'exception_class', 'Error::TypeTiny::Assertion'); $_[0];},"_overrides_assert_return" => !!0,"coercion" => bless( {"_compiled_type_constraint_check" => sub ;,"display_name" => "to_StrMatch","frozen" => 1,"name" => "__ANON__","type_coercion_map" => [],"type_constraint" => {}}, 'Type::Coercion' ),"compiled_type_constraint" => do{my $o},"constraint" => do{my $o},"constraint_generator" => sub { package Types::Standard::StrMatch; no warnings; use strict; return 'Types::Standard'->meta->get_type('StrMatch') unless @_; Type::Tiny::check_parameter_count_for_parameterized_type('Types::Standard', 'StrMatch', \@_, 2, 1); my($regexp, $checker) = @_; &Types::Standard::is_RegexpRef($regexp) or _croak "First parameter to StrMatch[`a] expected to be a Regexp; got $regexp"; if (@_ > 1) { $checker = Types::TypeTiny::to_TypeTiny($checker); Types::TypeTiny::is_TypeTiny($checker) or _croak "Second parameter to StrMatch[`a] expected to be a type constraint; got $checker"; } $checker ? sub { my $value = shift(); return unless defined $value; return if ref $value; my(@m) = $value =~ /$regexp/; $checker->check(\@m); } : sub { my $value = shift(); defined $value and not ref $value and not !($value =~ /$regexp/); } ;},"definition_context" => {"file" => "/usr/local/lib/perl5/site_perl/5.44.0/Types/Standard.pm","line" => 902,"package" => "Types::Standard"},"deprecated" => !!0,"display_name" => "StrMatch","exception_class" => "Error::TypeTiny::Assertion","inline_generator" => sub { package Types::Standard::StrMatch; no warnings; use strict; require B; my($regexp, $checker) = @_; my $serialized_re = $regexp->$serialize_regexp or return; if ($checker) { return unless $checker->can_be_inlined; return sub { my $v = $_[1]; if ($Type::Tiny::AvoidCallbacks and $serialized_re =~ /Types::Standard::StrMatch::expressions/) { require Carp; Carp::carp('Cannot serialize regexp without callbacks; serializing using callbacks'); } sprintf "defined($v) and !ref($v) and do { my \$m = [$v =~ %s]; %s }", $serialized_re, $checker->inline_check('$m'); } ; } else { my $regexp_string = "$regexp"; if ($regexp_string =~ /\A\(\?\^u?:\\A(\.+)\)\z/) { my $length = length $1; return sub { "defined($_) and !ref($_) and length($_)>=$length"; } ; } if ($regexp_string =~ /\A\(\?\^u?:\\A(\.+)\\z\)\z/) { my $length = length $1; return sub { "defined($_) and !ref($_) and length($_)==$length"; } ; } return sub { my $v = $_[1]; if ($Type::Tiny::AvoidCallbacks and $serialized_re =~ /Types::Standard::StrMatch::expressions/) { require Carp; Carp::carp('Cannot serialize regexp without callbacks; serializing using callbacks'); } "defined($v) and !ref($v) and !!( $v =~ $serialized_re )"; } ; }},"library" => "Types::Standard","name" => "StrMatch","name_generator" => sub { package Type::Tiny; use warnings; use strict; defined $_ and s/[\x00-\x1F]//gms foreach (my($s, @a) = @_); sprintf '%s[%s]', $s, join(',', map((!defined($_) ? 'undef' : (!ref($_) && /\W/ ? B::perlstring($_) : $_)), @a));},"parent" => bless( {"_is_core" => 1,"_overload_coderef" => sub { package Sub::Defer; use warnings; use strict; $undeferred ||= undefer_sub($deferred_info->[4]); goto \&$undeferred;},"_overload_coderef_no_rebuild" => 1,"_overrides_assert_return" => !!0,"coercion" => bless( {"_compiled_type_constraint_check" => do{my $o},"display_name" => "to_Str","frozen" => 1,"name" => "__ANON__","type_coercion_map" => [],"type_constraint" => {}}, 'Type::Coercion' ),"compiled_type_constraint" => do{my $o},"constraint" => sub { package Types::Standard; no warnings; use strict; ref \$_ eq 'SCALAR' or ref \(my $val = $_) eq 'SCALAR';},"definition_context" => {"file" => "/usr/local/lib/perl5/site_perl/5.44.0/Types/Standard.pm","line" => 291,"package" => "Types::Standard"},"deprecated" => !!0,"display_name" => "Str","exception_class" => "Error::TypeTiny::Assertion","inlined" => sub { package Types::Standard; use warnings; use strict; $Type::Tiny::AvoidCallbacks ? goto $orig_inlined : "$xsubname($_[1])";},"library" => "Types::Standard","name" => "Str","parent" => bless( {"_is_core" => 1,"_overload_coderef" => sub { package Type::Tiny; BEGIN {${^WARNING_BITS} = "\x10\x01\x00\x00\x00\x50\x04\x00\x00\x00\x00\x00\x01\x40\x05\x45\x55\x15\x55\x55\x01\x00"} use strict; defined $_[0] and not ref $_[0] or _failed_check(8, 'Value', $_[0], 'exception_class', 'Error::TypeTiny::Assertion'); $_[0];},"_overrides_assert_return" => !!0,"coercion" => bless( {"_compiled_type_constraint_check" => sub ;,"display_name" => "to_Value","frozen" => 1,"name" => "__ANON__","type_coercion_map" => [],"type_constraint" => {}}, 'Type::Coercion' ),"compiled_type_constraint" => do{my $o},"constraint" => sub { package Types::Standard; no warnings; use strict; not ref $_;},"definition_context" => {"file" => "/usr/local/lib/perl5/site_perl/5.44.0/Types/Standard.pm","line" => 276,"package" => "Types::Standard"},"deprecated" => !!0,"display_name" => "Value","exception_class" => "Error::TypeTiny::Assertion","inlined" => sub { package Types::Standard; no warnings; use strict; "defined($_[1]) and not ref($_[1])";},"library" => "Types::Standard","name" => "Value","parent" => bless( {"_is_core" => 1,"_overload_coderef" => sub { package Type::Tiny; BEGIN {${^WARNING_BITS} = "\x10\x01\x00\x00\x00\x50\x04\x00\x00\x00\x00\x00\x01\x40\x05\x45\x55\x15\x55\x55\x01\x00"} use strict; defined $_[0] or _failed_check(7, 'Defined', $_[0], 'exception_class', 'Error::TypeTiny::Assertion'); $_[0];},"_overrides_assert_return" => !!0,"coercion" => bless( {"_compiled_type_constraint_check" => sub ;,"display_name" => "to_Defined","frozen" => 1,"name" => "__ANON__","type_coercion_map" => [],"type_constraint" => {}}, 'Type::Coercion' ),"compiled_type_constraint" => do{my $o},"complementary_type" => bless( {"_is_core" => 1,"_overload_coderef" => sub { package Type::Tiny; BEGIN {${^WARNING_BITS} = "\x10\x01\x00\x00\x00\x50\x04\x00\x00\x00\x00\x00\x01\x40\x05\x45\x55\x15\x55\x55\x01\x00"} use strict; defined $_[0] and _failed_check(6, 'Undef', $_[0], 'exception_class', 'Error::TypeTiny::Assertion'); $_[0];},"_overrides_assert_return" => !!0,"coercion" => bless( {"_compiled_type_constraint_check" => sub ;,"display_name" => "to_Undef","frozen" => 1,"name" => "__ANON__","type_coercion_map" => [],"type_constraint" => {}}, 'Type::Coercion' ),"compiled_type_constraint" => do{my $o},"complementary_type" => {},"constraint" => sub { package Types::Standard; no warnings; use strict; not defined $_;},"definition_context" => {"file" => "/usr/local/lib/perl5/site_perl/5.44.0/Types/Standard.pm","line" => 254,"package" => "Types::Standard"},"deprecated" => !!0,"display_name" => "Undef","exception_class" => "Error::TypeTiny::Assertion","inlined" => sub { package Types::Standard; no warnings; use strict; "!defined($_[1])";},"library" => "Types::Standard","name" => "Undef","parent" => bless( {"_is_core" => 1,"_overload_coderef" => sub { package Type::Tiny; BEGIN {${^WARNING_BITS} = "\x10\x01\x00\x00\x00\x50\x04\x00\x00\x00\x00\x00\x01\x40\x05\x45\x55\x15\x55\x55\x01\x00"} use strict; '???'; $_[0];},"_overrides_assert_return" => !!0,"coercion" => bless( {"_compiled_type_constraint_check" => sub ;,"display_name" => "to_Item","frozen" => 1,"name" => "__ANON__","type_coercion_map" => [],"type_constraint" => {}}, 'Type::Coercion' ),"compiled_type_constraint" => do{my $o},"constraint" => do{my $o},"definition_context" => {"file" => "/usr/local/lib/perl5/site_perl/5.44.0/Types/Standard.pm","line" => 226,"package" => "Types::Standard"},"deprecated" => !!0,"display_name" => "Item","exception_class" => "Error::TypeTiny::Assertion","inlined" => sub { package Types::Standard; no warnings; use strict; '!!1';},"library" => "Types::Standard","name" => "Item","parent" => bless( {"_is_core" => 1,"_overload_coderef" => sub { package Sub::Defer; use warnings; use strict; $undeferred ||= undefer_sub($deferred_info->[4]); goto \&$undeferred;},"_overload_coderef_no_rebuild" => 1,"_overrides_assert_return" => !!0,"coercion" => bless( {"_compiled_type_constraint_check" => do{my $o},"display_name" => "to_Any","frozen" => 1,"name" => "__ANON__","type_coercion_map" => [],"type_constraint" => {}}, 'Type::Coercion' ),"compiled_type_constraint" => do{my $o},"complement_name" => "None","constraint" => do{my $o},"definition_context" => {"file" => "/usr/local/lib/perl5/site_perl/5.44.0/Types/Standard.pm","line" => 220,"package" => "Types::Standard"},"deprecated" => !!0,"display_name" => "Any","exception_class" => "Error::TypeTiny::Assertion","inlined" => sub { package Types::Standard; no warnings; use strict; '!!1';},"library" => "Types::Standard","name" => "Any","type_default" => sub { package Types::Standard; no warnings; use strict; return undef;},"uniq" => 1}, 'Type::Tiny' ),"uniq" => 2}, 'Type::Tiny' ),"type_default" => sub { package Types::Standard; no warnings; use strict; return undef;},"uniq" => 6}, 'Type::Tiny' ),"constraint" => sub { package Types::Standard; no warnings; use strict; defined $_;},"definition_context" => {"file" => "/usr/local/lib/perl5/site_perl/5.44.0/Types/Standard.pm","line" => 262,"package" => "Types::Standard"},"deprecated" => !!0,"display_name" => "Defined","exception_class" => "Error::TypeTiny::Assertion","inlined" => sub { package Types::Standard; no warnings; use strict; "defined($_[1])";},"library" => "Types::Standard","name" => "Defined","parent" => {},"uniq" => 7}, 'Type::Tiny' ),"uniq" => 8}, 'Type::Tiny' ),"sorter" => sub { package Types::Standard; no warnings; use strict; $_[0] cmp $_[1];},"type_default" => sub { package Types::Standard; no warnings; use strict; return '';},"uniq" => 9}, 'Type::Tiny' ),"uniq" => 33}, 'Type::Tiny' ),"uniq" => 40}, 'Type::Tiny' ),"uniq" => 41}, 'Type::Tiny' ),bless( {"coercion" => bless( {"_compiled_type_constraint_check" => sub ($) { package Eval::TypeTiny::Sandbox; use strict; do { package Type::Tiny; builtin::blessed($_[0]) and do { my $method = $_[0]->can('DOES') || $_[0]->can('isa'); $_[0]->$method('GraphQL::Role::Named') } };},"frozen" => 1,"name" => "__ANON__","type_coercion_map" => [],"type_constraint" => {}}, 'Type::Coercion' ),"compiled_type_constraint" => do{my $o},"definition_context" => {"file" => "/usr/local/lib/perl5/site_perl/5.44.0/Types/Standard.pm","line" => 1015,"package" => "Types::Standard"},"deprecated" => !!0,"display_name" => "ConsumerOf[\"GraphQL::Role::Named\"]","inlined" => sub { package Type::Tiny::Role; use warnings; use strict; my $var = $_[1]; my $code = "Scalar::Util::blessed($var) and do { my \$method = $var->can('DOES')||$var->can('isa'); $var->\$method(q[$role]) }"; return "do { use Scalar::Util (); $code }" if $Type::Tiny::AvoidCallbacks; $code;},"name" => "__ANON__","role" => "GraphQL::Role::Named","uniq" => 134}, 'Type::Tiny::Role' )],"parent" => bless( {"_overload_coderef" => sub { package Type::Tiny; BEGIN {${^WARNING_BITS} = "\x10\x01\x00\x00\x00\x50\x04\x00\x00\x00\x00\x00\x01\x40\x05\x45\x55\x15\x55\x55\x01\x00"} use strict; Ref::Util::XS::is_plain_hashref($_[0]) or _failed_check(26, 'Map', $_[0], 'exception_class', 'Error::TypeTiny::Assertion'); $_[0];},"_overrides_assert_return" => !!0,"coercion" => bless( {"_compiled_type_constraint_check" => sub ;,"display_name" => "to_Map","frozen" => 1,"name" => "__ANON__","type_coercion_map" => [],"type_constraint" => {}}, 'Type::Coercion' ),"coercion_generator" => sub { package Types::Standard::Map; no warnings; use strict; my($parent, $child, $kparam, $vparam) = @_; return unless $kparam->has_coercion or $vparam->has_coercion; my $kcoercable_item = $kparam->has_coercion ? $kparam->coercion->_source_type_union : $kparam; my $vcoercable_item = $vparam->has_coercion ? $vparam->coercion->_source_type_union : $vparam; my $C = 'Type::Coercion'->new('type_constraint', $child); if (!$kparam->has_coercion || $kparam->coercion->can_be_inlined and !$vparam->has_coercion || $vparam->coercion->can_be_inlined and $kcoercable_item->can_be_inlined and $vcoercable_item->can_be_inlined) { $C->add_type_coercions($parent, &Types::Standard::Stringable(sub { my @code; push @code, 'do { my ($orig, $return_orig, %new) = ($_, 0);'; push @code, 'for (keys %$orig) {'; push @code, sprintf('++$return_orig && last unless (%s);', $kcoercable_item->inline_check('$_')); push @code, sprintf('++$return_orig && last unless (%s);', $vcoercable_item->inline_check('$orig->{$_}')); push @code, sprintf('$new{(%s)} = (%s);', $kparam->has_coercion ? $kparam->coercion->inline_coercion('$_') : '$_', $vparam->has_coercion ? $vparam->coercion->inline_coercion('$orig->{$_}') : '$orig->{$_}'); push @code, '}'; push @code, '$return_orig ? $orig : \\%new'; push @code, '}'; join $", @code; } )); } else { $C->add_type_coercions($parent, sub { my $value = @_ ? $_[0] : $_; my %new; foreach my $k (keys %$value) { return $value unless $kcoercable_item->check($k) and $vcoercable_item->check($value->{$k}); $new{$kparam->has_coercion ? $kparam->coerce($k) : $k} = $vparam->has_coercion ? $vparam->coerce($value->{$k}) : $value->{$k}; } return \%new; } ); } return $C;},"compiled_type_constraint" => do{my $o},"constraint" => do{my $o},"constraint_generator" => sub { package Types::Standard::Map; no warnings; use strict; return $meta->get_type('Map') unless @_; Type::Tiny::check_parameter_count_for_parameterized_type('Types::Standard', 'Map', \@_, 2, 2); my($keys, $values) = @_; Types::TypeTiny::is_TypeTiny($keys) or _croak "First parameter to Map[`k,`v] expected to be a type constraint; got $keys"; Types::TypeTiny::is_TypeTiny($values) or _croak "Second parameter to Map[`k,`v] expected to be a type constraint; got $values"; my @xsub; do { my(@known) = map({my $known = Type::Tiny::XS::is_known($_->compiled_check); defined $known ? $known : ();} $keys, $values); if (@known == 2) { my $xsub = Type::Tiny::XS::get_coderef_for(sprintf('Map[%s,%s]', @known)); push @xsub, $xsub if $xsub; } }; sub { my $hash = shift(); ($keys->check($_) or return) foreach (keys %$hash); ($values->check($_) or return) foreach (values %$hash); return !0; } , @xsub;},"deep_explanation" => sub { package Types::Standard::Map; no warnings; use strict; require B; my($type, $value, $varname) = @_; my($kparam, $vparam) = @{$type->parameters;}; foreach my $k (sort keys %$value) { unless ($kparam->check($k)) { return [sprintf('"%s" constrains each key in the hash with "%s"', $type, $kparam), @{$kparam->validate_explain($k, sprintf('key %s->{%s}', $varname, B::perlstring($k)));}]; } unless ($vparam->check($value->{$k})) { return [sprintf('"%s" constrains each value in the hash with "%s"', $type, $vparam), @{$vparam->validate_explain($value->{$k}, sprintf('%s->{%s}', $varname, B::perlstring($k)));}]; } } return;},"definition_context" => {"file" => "/usr/local/lib/perl5/site_perl/5.44.0/Types/Standard.pm","line" => 675,"package" => "Types::Standard"},"deprecated" => !!0,"display_name" => "Map","exception_class" => "Error::TypeTiny::Assertion","inline_generator" => sub { package Types::Standard::Map; no warnings; use strict; my($k, $v) = @_; return unless $k->can_be_inlined and $v->can_be_inlined; my $xsubname; do { my(@known) = map({my $known = Type::Tiny::XS::is_known($_->compiled_check); defined $known ? $known : ();} $k, $v); if (@known == 2) { $xsubname = Type::Tiny::XS::get_subname_for(sprintf('Map[%s,%s]', @known)); } }; return sub { my $h = $_[1]; return "$xsubname($h)" if $xsubname and not $Type::Tiny::AvoidCallbacks; my $p = &Types::Standard::HashRef()->inline_check($h); my $k_check = $k->inline_check('$k'); my $v_check = $v->inline_check('$v'); "$p and do { " . 'my $ok = 1; ' . "for my \$v (values %{$h}) { " . "(\$ok = 0, last) unless $v_check " . '}; ' . "for my \$k (keys %{$h}) { " . "(\$ok = 0, last) unless $k_check " . '}; ' . '$ok ' . '}'; } ;},"library" => "Types::Standard","my_methods" => {"hashref_allows_key" => sub { package Types::Standard::Map; no warnings; use strict; my $self = shift(); my($key) = @_; return Types::Standard::is_Str($key) if $self == &Types::Standard::Map(); my $map = $self->find_parent(sub { $_->has_parent and $_->parent == &Types::Standard::Map(); } ); my($kcheck, $vcheck) = @{$map->parameters;}; ($kcheck || &Types::Standard::Any())->check($key);},"hashref_allows_value" => sub { package Types::Standard::Map; no warnings; use strict; my $self = shift(); my($key, $value) = @_; return !1 unless $self->my_hashref_allows_key($key); return !0 if $self == &Types::Standard::Map(); my $map = $self->find_parent(sub { $_->has_parent and $_->parent == &Types::Standard::Map(); } ); my($kcheck, $vcheck) = @{$map->parameters;}; ($kcheck || &Types::Standard::Any())->check($key) and ($vcheck || &Types::Standard::Any())->check($value);}},"name" => "Map","name_generator" => sub { package Type::Tiny; use warnings; use strict; defined $_ and s/[\x00-\x1F]//gms foreach (my($s, @a) = @_); sprintf '%s[%s]', $s, join(',', map((!defined($_) ? 'undef' : (!ref($_) && /\W/ ? B::perlstring($_) : $_)), @a));},"parent" => bless( {"_is_core" => 1,"_overload_coderef" => sub { package Sub::Defer; use warnings; use strict; $undeferred ||= undefer_sub($deferred_info->[4]); goto \&$undeferred;},"_overload_coderef_no_rebuild" => 1,"_overrides_assert_return" => !!0,"coercion" => bless( {"_compiled_type_constraint_check" => sub ;,"display_name" => "to_HashRef","frozen" => 1,"name" => "__ANON__","type_coercion_map" => [],"type_constraint" => {}}, 'Type::Coercion' ),"coercion_generator" => sub { package Types::Standard::HashRef; no warnings; use strict; my($parent, $child, $param) = @_; return unless $param->has_coercion; my $coercable_item = $param->coercion->_source_type_union; my $C = 'Type::Coercion'->new('type_constraint', $child); if ($param->coercion->can_be_inlined and $coercable_item->can_be_inlined) { $C->add_type_coercions($parent, &Types::Standard::Stringable(sub { my @code; push @code, 'do { my ($orig, $return_orig, %new) = ($_, 0);'; push @code, 'for (keys %$orig) {'; push @code, sprintf('$return_orig++ && last unless (%s);', $coercable_item->inline_check('$orig->{$_}')); push @code, sprintf('$new{$_} = (%s);', $param->coercion->inline_coercion('$orig->{$_}')); push @code, '}'; push @code, '$return_orig ? $orig : \\%new'; push @code, '}'; join $", @code; } )); } else { $C->add_type_coercions($parent, sub { my $value = @_ ? $_[0] : $_; my %new; foreach my $k (keys %$value) { return $value unless $coercable_item->check($value->{$k}); $new{$k} = $param->coerce($value->{$k}); } return \%new; } ); } return $C;},"compiled_type_constraint" => do{my $o},"constraint" => sub { package Types::Standard; no warnings; use strict; ref $_ eq 'HASH';},"constraint_generator" => sub { package Types::Standard::HashRef; no warnings; use strict; return &Types::Standard::HashRef() unless @_; require Error::TypeTiny::WrongNumberOfParameters; Type::Tiny::check_parameter_count_for_parameterized_type('Types::Standard', 'HashRef', \@_, 1); my $param = shift(); Types::TypeTiny::is_TypeTiny($param) or _croak "Parameter to HashRef[`a] expected to be a type constraint; got $param"; my $param_compiled_check = $param->compiled_check; my $xsub; do { my $paramname = Type::Tiny::XS::is_known($param_compiled_check); $xsub = Type::Tiny::XS::get_coderef_for("HashRef[$paramname]") if $paramname }; return sub { my $hash = shift(); ($param->check($_) or return) foreach (values %$hash); return !0; } , $xsub;},"deep_explanation" => sub { package Types::Standard::HashRef; no warnings; use strict; require B; my($type, $value, $varname) = @_; my $param = $type->parameters->[0]; foreach my $k (sort keys %$value) { my $item = $value->{$k}; next if $param->check($item); return [sprintf('"%s" constrains each value in the hash with "%s"', $type, $param), @{$param->validate_explain($item, sprintf('%s->{%s}', $varname, B::perlstring($k)));}]; } return;},"definition_context" => {"file" => "/usr/local/lib/perl5/site_perl/5.44.0/Types/Standard.pm","line" => 544,"package" => "Types::Standard"},"deprecated" => !!0,"display_name" => "HashRef","exception_class" => "Error::TypeTiny::Assertion","inline_generator" => sub { package Types::Standard::HashRef; no warnings; use strict; my $param = shift(); my $compiled = $param->compiled_check; my $xsubname; unless ($Type::Tiny::AvoidCallbacks) { my $paramname = Type::Tiny::XS::is_known($compiled); $xsubname = Type::Tiny::XS::get_subname_for("HashRef[$paramname]"); } return unless $param->can_be_inlined; return sub { my $v = $_[1]; return "$xsubname($v)" if $xsubname and not $Type::Tiny::AvoidCallbacks; my $p = &Types::Standard::HashRef()->inline_check($v); my $param_check = $param->inline_check('$i'); "$p and do { " . 'my $ok = 1; ' . "for my \$i (values %{$v}) { " . "(\$ok = 0, last) unless $param_check " . '}; ' . '$ok ' . '}'; } ;},"inlined" => sub { package Types::Standard; no warnings; use strict; !$Type::Tiny::AvoidCallbacks ? "Ref::Util::XS::is_plain_hashref($_[1])" : "ref($_[1]) eq 'HASH'";},"library" => "Types::Standard","my_methods" => {"hashref_allows_key" => sub { package Types::Standard::HashRef; no warnings; use strict; my $self = shift(); Types::Standard::is_Str($_[0]);},"hashref_allows_value" => sub { package Types::Standard::HashRef; no warnings; use strict; my $self = shift(); my($key, $value) = @_; return !1 unless $self->my_hashref_allows_key($key); return !0 if $self == &Types::Standard::HashRef(); my $href = $self->find_parent(sub { $_->has_parent and $_->parent == &Types::Standard::HashRef(); } ); my $param = $href->type_parameter; Types::Standard::is_Str($key) and $param->check($value);}},"name" => "HashRef","name_generator" => sub { package Type::Tiny; use warnings; use strict; defined $_ and s/[\x00-\x1F]//gms foreach (my($s, @a) = @_); sprintf '%s[%s]', $s, join(',', map((!defined($_) ? 'undef' : (!ref($_) && /\W/ ? B::perlstring($_) : $_)), @a));},"parent" => bless( {"_is_core" => 1,"_overload_coderef" => sub { package Type::Tiny; BEGIN {${^WARNING_BITS} = "\x10\x01\x00\x00\x00\x50\x04\x00\x00\x00\x00\x00\x01\x40\x05\x45\x55\x15\x55\x55\x01\x00"} use strict; not ref $_[0] and _failed_check(16, 'Ref', $_[0], 'exception_class', 'Error::TypeTiny::Assertion'); $_[0];},"_overrides_assert_return" => !!0,"coercion" => bless( {"_compiled_type_constraint_check" => sub ;,"display_name" => "to_Ref","frozen" => 1,"name" => "__ANON__","type_coercion_map" => [],"type_constraint" => {}}, 'Type::Coercion' ),"compiled_type_constraint" => do{my $o},"constraint" => sub { package Types::Standard; no warnings; use strict; ref $_;},"constraint_generator" => sub { package Types::Standard; no warnings; use strict; return $meta->get_type('Ref') unless @_; Type::Tiny::check_parameter_count_for_parameterized_type('Types::Standard', 'Ref', \@_, 1); my $reftype = shift(); $reftype =~ /^(SCALAR|ARRAY|HASH|CODE|REF|GLOB|LVALUE|FORMAT|IO|VSTRING|REGEXP|Regexp)$/i or _croak "Parameter to Ref[`a] expected to be a Perl ref type; got $reftype"; $reftype = "$reftype"; return sub { ref $_[0] and builtin::reftype($_[0]) eq $reftype; } ;},"deep_explanation" => sub { package Types::Standard; no warnings; use strict; require B; my($type, $value, $varname) = @_; my $param = $type->parameters->[0]; return if $type->check($value); my $reftype = builtin::reftype($value); return [sprintf('"%s" constrains reftype(%s) to be equal to %s', $type, $varname, B::perlstring($param)), sprintf('reftype(%s) is %s', $varname, defined $reftype ? B::perlstring($reftype) : 'undef')];},"definition_context" => {"file" => "/usr/local/lib/perl5/site_perl/5.44.0/Types/Standard.pm","line" => 438,"package" => "Types::Standard"},"deprecated" => !!0,"display_name" => "Ref","exception_class" => "Error::TypeTiny::Assertion","inline_generator" => sub { package Types::Standard; no warnings; use strict; my $reftype = shift(); return sub { my $v = $_[1]; &$maybe_load_modules('Scalar::Util', "ref($v) and Scalar::Util::reftype($v) eq q($reftype)"); } ;},"inlined" => sub { package Types::Standard; no warnings; use strict; "!!ref($_[1])";},"library" => "Types::Standard","name" => "Ref","parent" => {},"uniq" => 16}, 'Type::Tiny' ),"type_default" => sub { package Types::Standard; no warnings; use strict; return {};},"type_default_generator" => sub { package Types::Standard; no warnings; use strict; return $Type::Tiny::parameterize_type->type_default if @_ < 2; return undef;},"uniq" => 22}, 'Type::Tiny' ),"type_default_generator" => sub { package Types::Standard; no warnings; use strict; return $Type::Tiny::parameterize_type->type_default;},"uniq" => 26}, 'Type::Tiny' ),"type_default" => do{my $o},"uniq" => 135}, 'Type::Tiny' );$v->{"coercion"}{"type_constraint"} = $v;$v->{"compiled_type_constraint"} = $v->{"coercion"}{"_compiled_type_constraint_check"};$v->{"parameters"}[0]{"parent"}{"coercion"}{"_compiled_type_constraint_check"} = $v->{"parameters"}[0]{"compiled_type_constraint"};$v->{"parameters"}[0]{"parent"}{"coercion"}{"type_constraint"} = $v->{"parameters"}[0]{"parent"};$v->{"parameters"}[0]{"parent"}{"compiled_type_constraint"} = $v->{"parameters"}[0]{"compiled_type_constraint"};$v->{"parameters"}[0]{"parent"}{"parent"}{"coercion"}{"type_constraint"} = $v->{"parameters"}[0]{"parent"}{"parent"};$v->{"parameters"}[0]{"parent"}{"parent"}{"compiled_type_constraint"} = $v->{"parameters"}[0]{"parent"}{"parent"}{"coercion"}{"_compiled_type_constraint_check"};$v->{"parameters"}[0]{"parent"}{"parent"}{"constraint"} = $v->{"parameters"}[0]{"constraint"};$v->{"parameters"}[0]{"parent"}{"parent"}{"parent"}{"coercion"}{"_compiled_type_constraint_check"} = $v->{"parameters"}[0]{"parent"}{"parent"}{"coercion"}{"_compiled_type_constraint_check"};$v->{"parameters"}[0]{"parent"}{"parent"}{"parent"}{"coercion"}{"type_constraint"} = $v->{"parameters"}[0]{"parent"}{"parent"}{"parent"};$v->{"parameters"}[0]{"parent"}{"parent"}{"parent"}{"compiled_type_constraint"} = $v->{"parameters"}[0]{"parent"}{"parent"}{"coercion"}{"_compiled_type_constraint_check"};$v->{"parameters"}[0]{"parent"}{"parent"}{"parent"}{"parent"}{"coercion"}{"type_constraint"} = $v->{"parameters"}[0]{"parent"}{"parent"}{"parent"}{"parent"};$v->{"parameters"}[0]{"parent"}{"parent"}{"parent"}{"parent"}{"compiled_type_constraint"} = $v->{"parameters"}[0]{"parent"}{"parent"}{"parent"}{"parent"}{"coercion"}{"_compiled_type_constraint_check"};$v->{"parameters"}[0]{"parent"}{"parent"}{"parent"}{"parent"}{"parent"}{"coercion"}{"type_constraint"} = $v->{"parameters"}[0]{"parent"}{"parent"}{"parent"}{"parent"}{"parent"};$v->{"parameters"}[0]{"parent"}{"parent"}{"parent"}{"parent"}{"parent"}{"compiled_type_constraint"} = $v->{"parameters"}[0]{"parent"}{"parent"}{"parent"}{"parent"}{"parent"}{"coercion"}{"_compiled_type_constraint_check"};$v->{"parameters"}[0]{"parent"}{"parent"}{"parent"}{"parent"}{"parent"}{"complementary_type"}{"coercion"}{"type_constraint"} = $v->{"parameters"}[0]{"parent"}{"parent"}{"parent"}{"parent"}{"parent"}{"complementary_type"};$v->{"parameters"}[0]{"parent"}{"parent"}{"parent"}{"parent"}{"parent"}{"complementary_type"}{"compiled_type_constraint"} = $v->{"parameters"}[0]{"parent"}{"parent"}{"parent"}{"parent"}{"parent"}{"complementary_type"}{"coercion"}{"_compiled_type_constraint_check"};$v->{"parameters"}[0]{"parent"}{"parent"}{"parent"}{"parent"}{"parent"}{"complementary_type"}{"complementary_type"} = $v->{"parameters"}[0]{"parent"}{"parent"}{"parent"}{"parent"}{"parent"};$v->{"parameters"}[0]{"parent"}{"parent"}{"parent"}{"parent"}{"parent"}{"complementary_type"}{"parent"}{"coercion"}{"type_constraint"} = $v->{"parameters"}[0]{"parent"}{"parent"}{"parent"}{"parent"}{"parent"}{"complementary_type"}{"parent"};$v->{"parameters"}[0]{"parent"}{"parent"}{"parent"}{"parent"}{"parent"}{"complementary_type"}{"parent"}{"compiled_type_constraint"} = $v->{"parameters"}[0]{"parent"}{"parent"}{"parent"}{"parent"}{"parent"}{"complementary_type"}{"parent"}{"coercion"}{"_compiled_type_constraint_check"};$v->{"parameters"}[0]{"parent"}{"parent"}{"parent"}{"parent"}{"parent"}{"complementary_type"}{"parent"}{"constraint"} = $v->{"parameters"}[0]{"constraint"};$v->{"parameters"}[0]{"parent"}{"parent"}{"parent"}{"parent"}{"parent"}{"complementary_type"}{"parent"}{"parent"}{"coercion"}{"_compiled_type_constraint_check"} = $v->{"parameters"}[0]{"parent"}{"parent"}{"parent"}{"parent"}{"parent"}{"complementary_type"}{"parent"}{"coercion"}{"_compiled_type_constraint_check"};$v->{"parameters"}[0]{"parent"}{"parent"}{"parent"}{"parent"}{"parent"}{"complementary_type"}{"parent"}{"parent"}{"coercion"}{"type_constraint"} = $v->{"parameters"}[0]{"parent"}{"parent"}{"parent"}{"parent"}{"parent"}{"complementary_type"}{"parent"}{"parent"};$v->{"parameters"}[0]{"parent"}{"parent"}{"parent"}{"parent"}{"parent"}{"complementary_type"}{"parent"}{"parent"}{"compiled_type_constraint"} = $v->{"parameters"}[0]{"parent"}{"parent"}{"parent"}{"parent"}{"parent"}{"complementary_type"}{"parent"}{"coercion"}{"_compiled_type_constraint_check"};$v->{"parameters"}[0]{"parent"}{"parent"}{"parent"}{"parent"}{"parent"}{"complementary_type"}{"parent"}{"parent"}{"constraint"} = $v->{"parameters"}[0]{"constraint"};$v->{"parameters"}[0]{"parent"}{"parent"}{"parent"}{"parent"}{"parent"}{"parent"} = $v->{"parameters"}[0]{"parent"}{"parent"}{"parent"}{"parent"}{"parent"}{"complementary_type"}{"parent"};$v->{"parameters"}[1]{"coercion"}{"type_constraint"} = $v->{"parameters"}[1];$v->{"parameters"}[1]{"compiled_type_constraint"} = $v->{"parameters"}[1]{"coercion"}{"_compiled_type_constraint_check"};$v->{"parent"}{"coercion"}{"type_constraint"} = $v->{"parent"};$v->{"parent"}{"compiled_type_constraint"} = $v->{"parent"}{"coercion"}{"_compiled_type_constraint_check"};$v->{"parent"}{"constraint"} = $v->{"parameters"}[0]{"constraint"};$v->{"parent"}{"parent"}{"coercion"}{"type_constraint"} = $v->{"parent"}{"parent"};$v->{"parent"}{"parent"}{"compiled_type_constraint"} = $v->{"parent"}{"parent"}{"coercion"}{"_compiled_type_constraint_check"};$v->{"parent"}{"parent"}{"parent"}{"coercion"}{"type_constraint"} = $v->{"parent"}{"parent"}{"parent"};$v->{"parent"}{"parent"}{"parent"}{"compiled_type_constraint"} = $v->{"parent"}{"parent"}{"parent"}{"coercion"}{"_compiled_type_constraint_check"};$v->{"parent"}{"parent"}{"parent"}{"parent"} = $v->{"parameters"}[0]{"parent"}{"parent"}{"parent"}{"parent"}{"parent"};$v->{"type_default"} = $v->{"parent"}{"parent"}{"type_default"}; \$v}->get_message($map)) |
11698 |
353 |
12051 |
| Type::Tiny::XS::AUTO::TC9($type) or Function::Parameters::_croak('In fun _expand_type: parameter 2 ($type): ' . ${my $v = bless( {"_overload_coderef" => sub { package Sub::Defer; use warnings; use strict; $undeferred ||= undefer_sub($deferred_info->[4]); goto \&$undeferred;},"_overload_coderef_no_rebuild" => 1,"_overrides_assert_return" => !!0,"class" => "GraphQL::Type","coercion" => bless( {"_compiled_type_constraint_check" => sub ;,"frozen" => 1,"name" => "__ANON__","type_coercion_map" => [],"type_constraint" => {}}, 'Type::Coercion' ),"compiled_type_constraint" => do{my $o},"definition_context" => {"file" => "/usr/local/lib/perl5/site_perl/5.44.0/Types/Standard.pm","line" => 985,"package" => "Types::Standard"},"deprecated" => !!0,"display_name" => "InstanceOf[\"GraphQL::Type\"]","exception_class" => "Error::TypeTiny::Assertion","inlined" => sub { package Type::Tiny::Class; use warnings; use strict; my $var = $_[1]; return "do { use Scalar::Util (); Scalar::Util::blessed($var) and $var->isa(q[$class]) }" if $Type::Tiny::AvoidCallbacks; return "$xsub($var)" if $xsub; "Scalar::Util::blessed($var) and $var->isa(q[$class])";},"name" => "__ANON__","parent" => bless( {"compiled_type_constraint" => sub ;,"definition_context" => {"file" => "/usr/local/lib/perl5/site_perl/5.44.0/Method/Generate/Accessor.pm","line" => 716,"package" => "Method::Generate::Accessor"},"deprecated" => !!0,"exception_class" => "Error::TypeTiny::Assertion","name" => "__ANON__","type_constraints" => [bless( {"class" => "Moo::Object","compiled_type_constraint" => sub ;,"definition_context" => {"file" => "/usr/local/lib/perl5/site_perl/5.44.0/Method/Generate/Accessor.pm","line" => 716,"package" => "Method::Generate::Accessor"},"deprecated" => !!0,"exception_class" => "Error::TypeTiny::Assertion","inlined" => sub { package Type::Tiny::Class; use warnings; use strict; my $var = $_[1]; return "do { use Scalar::Util (); Scalar::Util::blessed($var) and $var->isa(q[$class]) }" if $Type::Tiny::AvoidCallbacks; return "$xsub($var)" if $xsub; "Scalar::Util::blessed($var) and $var->isa(q[$class])";},"name" => "__ANON__","parent" => bless( {"_is_core" => 1,"_overload_coderef" => sub { package Type::Tiny; BEGIN {${^WARNING_BITS} = "\x10\x01\x00\x00\x00\x50\x04\x00\x00\x00\x00\x00\x01\x40\x05\x45\x55\x15\x55\x55\x01\x00"} use strict; Ref::Util::XS::is_blessed_ref($_[0]) or _failed_check(24, 'Object', $_[0], 'exception_class', 'Error::TypeTiny::Assertion'); $_[0];},"_overrides_assert_return" => !!0,"coercion" => bless( {"_compiled_type_constraint_check" => sub ;,"display_name" => "to_Object","frozen" => 1,"name" => "__ANON__","type_coercion_map" => [],"type_constraint" => {}}, 'Type::Coercion' ),"compiled_type_constraint" => do{my $o},"constraint" => sub { package Types::Standard; no warnings; use strict; builtin::blessed($_);},"definition_context" => {"file" => "/usr/local/lib/perl5/site_perl/5.44.0/Types/Standard.pm","line" => 578,"package" => "Types::Standard"},"deprecated" => !!0,"display_name" => "Object","exception_class" => "Error::TypeTiny::Assertion","inlined" => sub { package Types::Standard; no warnings; use strict; !$Type::Tiny::AvoidCallbacks ? "Ref::Util::XS::is_blessed_ref($_[1])" : &$maybe_load_modules('Scalar::Util', "Scalar::Util::blessed($_[1])");},"is_object" => 1,"library" => "Types::Standard","name" => "Object","parent" => bless( {"_is_core" => 1,"_overload_coderef" => sub { package Type::Tiny; BEGIN {${^WARNING_BITS} = "\x10\x01\x00\x00\x00\x50\x04\x00\x00\x00\x00\x00\x01\x40\x05\x45\x55\x15\x55\x55\x01\x00"} use strict; not ref $_[0] and _failed_check(16, 'Ref', $_[0], 'exception_class', 'Error::TypeTiny::Assertion'); $_[0];},"_overrides_assert_return" => !!0,"coercion" => bless( {"_compiled_type_constraint_check" => sub ;,"display_name" => "to_Ref","frozen" => 1,"name" => "__ANON__","type_coercion_map" => [],"type_constraint" => {}}, 'Type::Coercion' ),"compiled_type_constraint" => do{my $o},"constraint" => sub { package Types::Standard; no warnings; use strict; ref $_;},"constraint_generator" => sub { package Types::Standard; no warnings; use strict; return $meta->get_type('Ref') unless @_; Type::Tiny::check_parameter_count_for_parameterized_type('Types::Standard', 'Ref', \@_, 1); my $reftype = shift(); $reftype =~ /^(SCALAR|ARRAY|HASH|CODE|REF|GLOB|LVALUE|FORMAT|IO|VSTRING|REGEXP|Regexp)$/i or _croak "Parameter to Ref[`a] expected to be a Perl ref type; got $reftype"; $reftype = "$reftype"; return sub { ref $_[0] and builtin::reftype($_[0]) eq $reftype; } ;},"deep_explanation" => sub { package Types::Standard; no warnings; use strict; require B; my($type, $value, $varname) = @_; my $param = $type->parameters->[0]; return if $type->check($value); my $reftype = builtin::reftype($value); return [sprintf('"%s" constrains reftype(%s) to be equal to %s', $type, $varname, B::perlstring($param)), sprintf('reftype(%s) is %s', $varname, defined $reftype ? B::perlstring($reftype) : 'undef')];},"definition_context" => {"file" => "/usr/local/lib/perl5/site_perl/5.44.0/Types/Standard.pm","line" => 438,"package" => "Types::Standard"},"deprecated" => !!0,"display_name" => "Ref","exception_class" => "Error::TypeTiny::Assertion","inline_generator" => sub { package Types::Standard; no warnings; use strict; my $reftype = shift(); return sub { my $v = $_[1]; &$maybe_load_modules('Scalar::Util', "ref($v) and Scalar::Util::reftype($v) eq q($reftype)"); } ;},"inlined" => sub { package Types::Standard; no warnings; use strict; "!!ref($_[1])";},"library" => "Types::Standard","name" => "Ref","parent" => bless( {"_is_core" => 1,"_overload_coderef" => sub { package Type::Tiny; BEGIN {${^WARNING_BITS} = "\x10\x01\x00\x00\x00\x50\x04\x00\x00\x00\x00\x00\x01\x40\x05\x45\x55\x15\x55\x55\x01\x00"} use strict; defined $_[0] or _failed_check(7, 'Defined', $_[0], 'exception_class', 'Error::TypeTiny::Assertion'); $_[0];},"_overrides_assert_return" => !!0,"coercion" => bless( {"_compiled_type_constraint_check" => sub ;,"display_name" => "to_Defined","frozen" => 1,"name" => "__ANON__","type_coercion_map" => [],"type_constraint" => {}}, 'Type::Coercion' ),"compiled_type_constraint" => do{my $o},"complementary_type" => bless( {"_is_core" => 1,"_overload_coderef" => sub { package Type::Tiny; BEGIN {${^WARNING_BITS} = "\x10\x01\x00\x00\x00\x50\x04\x00\x00\x00\x00\x00\x01\x40\x05\x45\x55\x15\x55\x55\x01\x00"} use strict; defined $_[0] and _failed_check(6, 'Undef', $_[0], 'exception_class', 'Error::TypeTiny::Assertion'); $_[0];},"_overrides_assert_return" => !!0,"coercion" => bless( {"_compiled_type_constraint_check" => sub ;,"display_name" => "to_Undef","frozen" => 1,"name" => "__ANON__","type_coercion_map" => [],"type_constraint" => {}}, 'Type::Coercion' ),"compiled_type_constraint" => do{my $o},"complementary_type" => {},"constraint" => sub { package Types::Standard; no warnings; use strict; not defined $_;},"definition_context" => {"file" => "/usr/local/lib/perl5/site_perl/5.44.0/Types/Standard.pm","line" => 254,"package" => "Types::Standard"},"deprecated" => !!0,"display_name" => "Undef","exception_class" => "Error::TypeTiny::Assertion","inlined" => sub { package Types::Standard; no warnings; use strict; "!defined($_[1])";},"library" => "Types::Standard","name" => "Undef","parent" => bless( {"_is_core" => 1,"_overload_coderef" => sub { package Type::Tiny; BEGIN {${^WARNING_BITS} = "\x10\x01\x00\x00\x00\x50\x04\x00\x00\x00\x00\x00\x01\x40\x05\x45\x55\x15\x55\x55\x01\x00"} use strict; '???'; $_[0];},"_overrides_assert_return" => !!0,"coercion" => bless( {"_compiled_type_constraint_check" => sub ;,"display_name" => "to_Item","frozen" => 1,"name" => "__ANON__","type_coercion_map" => [],"type_constraint" => {}}, 'Type::Coercion' ),"compiled_type_constraint" => do{my $o},"constraint" => sub { package Type::Tiny; use warnings; use strict; !0;},"definition_context" => {"file" => "/usr/local/lib/perl5/site_perl/5.44.0/Types/Standard.pm","line" => 226,"package" => "Types::Standard"},"deprecated" => !!0,"display_name" => "Item","exception_class" => "Error::TypeTiny::Assertion","inlined" => sub { package Types::Standard; no warnings; use strict; '!!1';},"library" => "Types::Standard","name" => "Item","parent" => bless( {"_is_core" => 1,"_overload_coderef" => sub { package Sub::Defer; use warnings; use strict; $undeferred ||= undefer_sub($deferred_info->[4]); goto \&$undeferred;},"_overload_coderef_no_rebuild" => 1,"_overrides_assert_return" => !!0,"coercion" => bless( {"_compiled_type_constraint_check" => do{my $o},"display_name" => "to_Any","frozen" => 1,"name" => "__ANON__","type_coercion_map" => [],"type_constraint" => {}}, 'Type::Coercion' ),"compiled_type_constraint" => do{my $o},"complement_name" => "None","constraint" => do{my $o},"definition_context" => {"file" => "/usr/local/lib/perl5/site_perl/5.44.0/Types/Standard.pm","line" => 220,"package" => "Types::Standard"},"deprecated" => !!0,"display_name" => "Any","exception_class" => "Error::TypeTiny::Assertion","inlined" => sub { package Types::Standard; no warnings; use strict; '!!1';},"library" => "Types::Standard","name" => "Any","type_default" => sub { package Types::Standard; no warnings; use strict; return undef;},"uniq" => 1}, 'Type::Tiny' ),"uniq" => 2}, 'Type::Tiny' ),"type_default" => sub { package Types::Standard; no warnings; use strict; return undef;},"uniq" => 6}, 'Type::Tiny' ),"constraint" => sub { package Types::Standard; no warnings; use strict; defined $_;},"definition_context" => {"file" => "/usr/local/lib/perl5/site_perl/5.44.0/Types/Standard.pm","line" => 262,"package" => "Types::Standard"},"deprecated" => !!0,"display_name" => "Defined","exception_class" => "Error::TypeTiny::Assertion","inlined" => sub { package Types::Standard; no warnings; use strict; "defined($_[1])";},"library" => "Types::Standard","name" => "Defined","parent" => {},"uniq" => 7}, 'Type::Tiny' ),"uniq" => 16}, 'Type::Tiny' ),"uniq" => 24}, 'Type::Tiny' ),"uniq" => 103}, 'Type::Tiny::Class' ),bless( {"class" => "GraphQL::MaybeTypeCheck","compiled_type_constraint" => sub ;,"definition_context" => {"file" => "/usr/local/lib/perl5/site_perl/5.44.0/Method/Generate/Accessor.pm","line" => 716,"package" => "Method::Generate::Accessor"},"deprecated" => !!0,"inlined" => sub { package Type::Tiny::Class; use warnings; use strict; my $var = $_[1]; return "do { use Scalar::Util (); Scalar::Util::blessed($var) and $var->isa(q[$class]) }" if $Type::Tiny::AvoidCallbacks; return "$xsub($var)" if $xsub; "Scalar::Util::blessed($var) and $var->isa(q[$class])";},"name" => "__ANON__","uniq" => 104}, 'Type::Tiny::Class' )],"uniq" => 105,"xs_sub" => "Type::Tiny::XS::AUTO::TC12"}, 'Type::Tiny::Intersection' ),"uniq" => 101}, 'Type::Tiny::Class' );$v->{"coercion"}{"type_constraint"} = $v;$v->{"compiled_type_constraint"} = $v->{"coercion"}{"_compiled_type_constraint_check"};$v->{"parent"}{"type_constraints"}[0]{"parent"}{"coercion"}{"type_constraint"} = $v->{"parent"}{"type_constraints"}[0]{"parent"};$v->{"parent"}{"type_constraints"}[0]{"parent"}{"compiled_type_constraint"} = $v->{"parent"}{"type_constraints"}[0]{"parent"}{"coercion"}{"_compiled_type_constraint_check"};$v->{"parent"}{"type_constraints"}[0]{"parent"}{"parent"}{"coercion"}{"type_constraint"} = $v->{"parent"}{"type_constraints"}[0]{"parent"}{"parent"};$v->{"parent"}{"type_constraints"}[0]{"parent"}{"parent"}{"compiled_type_constraint"} = $v->{"parent"}{"type_constraints"}[0]{"parent"}{"parent"}{"coercion"}{"_compiled_type_constraint_check"};$v->{"parent"}{"type_constraints"}[0]{"parent"}{"parent"}{"parent"}{"coercion"}{"type_constraint"} = $v->{"parent"}{"type_constraints"}[0]{"parent"}{"parent"}{"parent"};$v->{"parent"}{"type_constraints"}[0]{"parent"}{"parent"}{"parent"}{"compiled_type_constraint"} = $v->{"parent"}{"type_constraints"}[0]{"parent"}{"parent"}{"parent"}{"coercion"}{"_compiled_type_constraint_check"};$v->{"parent"}{"type_constraints"}[0]{"parent"}{"parent"}{"parent"}{"complementary_type"}{"coercion"}{"type_constraint"} = $v->{"parent"}{"type_constraints"}[0]{"parent"}{"parent"}{"parent"}{"complementary_type"};$v->{"parent"}{"type_constraints"}[0]{"parent"}{"parent"}{"parent"}{"complementary_type"}{"compiled_type_constraint"} = $v->{"parent"}{"type_constraints"}[0]{"parent"}{"parent"}{"parent"}{"complementary_type"}{"coercion"}{"_compiled_type_constraint_check"};$v->{"parent"}{"type_constraints"}[0]{"parent"}{"parent"}{"parent"}{"complementary_type"}{"complementary_type"} = $v->{"parent"}{"type_constraints"}[0]{"parent"}{"parent"}{"parent"};$v->{"parent"}{"type_constraints"}[0]{"parent"}{"parent"}{"parent"}{"complementary_type"}{"parent"}{"coercion"}{"type_constraint"} = $v->{"parent"}{"type_constraints"}[0]{"parent"}{"parent"}{"parent"}{"complementary_type"}{"parent"};$v->{"parent"}{"type_constraints"}[0]{"parent"}{"parent"}{"parent"}{"complementary_type"}{"parent"}{"compiled_type_constraint"} = $v->{"parent"}{"type_constraints"}[0]{"parent"}{"parent"}{"parent"}{"complementary_type"}{"parent"}{"coercion"}{"_compiled_type_constraint_check"};$v->{"parent"}{"type_constraints"}[0]{"parent"}{"parent"}{"parent"}{"complementary_type"}{"parent"}{"parent"}{"coercion"}{"_compiled_type_constraint_check"} = $v->{"parent"}{"type_constraints"}[0]{"parent"}{"parent"}{"parent"}{"complementary_type"}{"parent"}{"coercion"}{"_compiled_type_constraint_check"};$v->{"parent"}{"type_constraints"}[0]{"parent"}{"parent"}{"parent"}{"complementary_type"}{"parent"}{"parent"}{"coercion"}{"type_constraint"} = $v->{"parent"}{"type_constraints"}[0]{"parent"}{"parent"}{"parent"}{"complementary_type"}{"parent"}{"parent"};$v->{"parent"}{"type_constraints"}[0]{"parent"}{"parent"}{"parent"}{"complementary_type"}{"parent"}{"parent"}{"compiled_type_constraint"} = $v->{"parent"}{"type_constraints"}[0]{"parent"}{"parent"}{"parent"}{"complementary_type"}{"parent"}{"coercion"}{"_compiled_type_constraint_check"};$v->{"parent"}{"type_constraints"}[0]{"parent"}{"parent"}{"parent"}{"complementary_type"}{"parent"}{"parent"}{"constraint"} = $v->{"parent"}{"type_constraints"}[0]{"parent"}{"parent"}{"parent"}{"complementary_type"}{"parent"}{"constraint"};$v->{"parent"}{"type_constraints"}[0]{"parent"}{"parent"}{"parent"}{"parent"} = $v->{"parent"}{"type_constraints"}[0]{"parent"}{"parent"}{"parent"}{"complementary_type"}{"parent"}; \$v}->get_message($type)) |
2780 |
3427 |
6207 |
|
| 124 |
6 |
▶ | @_ = ($map, $type->of), goto &_expand_type if $type->can('of'); # avoid blowing out the stack |
Branch: 1 branch
| Branch | True | False | Total |
| if $type->can("of") |
3313 |
12 |
3325 |
|
| 125 |
6 |
▶ | my $name = $type->name if $type->can('name'); |
Branch: 1 branch
| Branch | True | False | Total |
| if $type->can("name") |
2229 |
1096 |
3325 |
|
| 126 |
49 |
▶ | return [] if $name and $map->{$name} and $map->{$name} == $type; # seen |
Branch: 1 branch
| Branch | True | False | Total |
| if $name and $map->{$name} and $map->{$name} == $type |
0 |
1110 |
1110 |
Condition50%3/6
$name and $map->{$name} and $map->{$name} == $type
MC/DC0%0/3
$name and $map->{$name} and $map->{$name} == $type
$name
$map->{$name}
$map->{$name} == $type
Truth table0%0/4
A and B and C
A= $nameB= $map->{$name}C= $map->{$name} == $type
| A | B | C | result |
| 0 | X | X | 0 |
| 1 | 0 | X | 0 |
| 1 | 1 | 0 | 0 |
| 1 | 1 | 1 | 1 |
|
| 127 |
49 |
▶ | die "Duplicate type $name" if $map->{$name}; |
Branch: 1 branch
| Branch | True | False | Total |
| if $map->{$name} |
543 |
567 |
1110 |
|
| 128 |
7 |
| $map->{$name} = $type; |
| 129 |
7 |
| my @types; |
| 130 |
49 |
▶ | push @types, ($type, map @{ _expand_type($map, $_) }, @{ $type->interfaces || [] }) |
Branch: 1 branch
| Branch | True | False | Total |
| if $type->isa("GraphQL::Type::Object") |
21 |
1088 |
1109 |
MC/DC100%1/1
$type->interfaces || []
$type->interfaces
|
| 131 |
|
| if $type->isa('GraphQL::Type::Object'); |
| 132 |
12 |
▶ | push @types, ($type, map @{ _expand_type($map, $_) }, @{ $type->get_types }) |
Branch: 1 branch
| Branch | True | False | Total |
| if $type->isa("GraphQL::Type::Union") |
566 |
528 |
1094 |
|
| 133 |
|
| if $type->isa('GraphQL::Type::Union'); |
| 134 |
12 |
▶ | if (grep $type->DOES($_), qw(GraphQL::Role::FieldsInput GraphQL::Role::FieldsOutput)) { |
Branch: 1 branch
| Branch | True | False | Total |
| if (grep $type->DOES($_), ("GraphQL::Role::FieldsInput", "GraphQL::Role::FieldsOutput")) |
0 |
0 |
0 |
|
| 135 |
14 |
▶ | my $fields = $type->fields||{}; |
MC/DC0%0/1
$type->fields || {}
$type->fields
|
| 136 |
|
| push @types, map { |
| 137 |
14 |
▶ | map @{ _expand_type($map, $_->{type}) }, $_, values %{ $_->{args}||{} } |
MC/DC0%0/1
$_->{'args'} || {}
$_->{'args'}
|
| 138 |
|
| } values %$fields; |
| 139 |
|
| } |
| 140 |
0 |
| DEBUG and _debug('_expand_type', \@types); |
| 141 |
0 |
| \@types; |
| 142 |
17 |
▶ | } |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
|
| 143 |
|
| |
| 144 |
|
| has _interface2types => (is => 'lazy', isa => Map[StrNameValid, ArrayRef[InstanceOf['GraphQL::Type::Object']]]); |
| 145 |
6 |
▶ | sub _build__interface2types { |
|
Subroutine
_build__interface2types: called CC=3 SCAR=11.5
|
| 146 |
0 |
| my ($self) = @_; |
| 147 |
0 |
▶ | my $name2type = $self->name2type||{}; |
MC/DC0%0/1
$self->name2type || {}
$self->name2type
|
| 148 |
0 |
| my %interface2types; |
| 149 |
|
| map { |
| 150 |
55 |
| my $o = $_; |
| 151 |
|
| map { |
| 152 |
55 |
| push @{$interface2types{$_->name}}, $o; |
| 153 |
|
| # TODO assert_object_implements_interface |
| 154 |
55 |
▶ | } @{ $o->interfaces||[] }; |
MC/DC100%1/1
$o->interfaces || []
$o->interfaces
|
| 155 |
|
| } grep $_->isa('GraphQL::Type::Object'), values %$name2type; |
| 156 |
55 |
| \%interface2types; |
| 157 |
|
| } |
| 158 |
|
| |
| 159 |
12 |
▶ | method get_possible_types( |
|
Subroutine
get_possible_types: called CC=8 SCAR=22.4
Pod
documented
|
| 160 |
|
| (ConsumerOf['GraphQL::Role::Abstract']) $abstract_type |
| 161 |
55 |
▶ | ) :ReturnType(ArrayRef[InstanceOf['GraphQL::Type::Object']]) { |
Branch: 3 branches
| Branch | True | False | Total |
| @_ < 2 and Function::Parameters::_croak('Too few arguments for method get_possible_types (expected 2, got ' . @_ . ')') |
0 |
0 |
0 |
| @_ > 2 and Function::Parameters::_croak('Too many arguments for method get_possible_types (expected 2, got ' . @_ . ')') |
0 |
55 |
55 |
| do {
package Type::Tiny;
builtin::blessed($abstract_type) and do {
my $method = $abstract_type->can("DOES") || $abstract_type->can("isa");
$abstract_type->$method("GraphQL::Role::Abstract")
}
} or Function::Parameters::_croak('In method get_possible_types: parameter 1 ($abstract_type): ' . ${my $v = bless( {"coercion" => bless( {"_compiled_type_constraint_check" => sub ($) { package Eval::TypeTiny::Sandbox; use strict; do { package Type::Tiny; builtin::blessed($_[0]) and do { my $method = $_[0]->can('DOES') || $_[0]->can('isa'); $_[0]->$method('GraphQL::Role::Abstract') } };},"frozen" => 1,"name" => "__ANON__","type_coercion_map" => [],"type_constraint" => {}}, 'Type::Coercion' ),"compiled_type_constraint" => do{my $o},"definition_context" => {"file" => "/usr/local/lib/perl5/site_perl/5.44.0/Types/Standard.pm","line" => 1015,"package" => "Types::Standard"},"deprecated" => !!0,"display_name" => "ConsumerOf[\"GraphQL::Role::Abstract\"]","inlined" => sub { package Type::Tiny::Role; use warnings; use strict; my $var = $_[1]; my $code = "Scalar::Util::blessed($var) and do { my \$method = $var->can('DOES')||$var->can('isa'); $var->\$method(q[$role]) }"; return "do { use Scalar::Util (); $code }" if $Type::Tiny::AvoidCallbacks; $code;},"name" => "__ANON__","role" => "GraphQL::Role::Abstract","uniq" => 136}, 'Type::Tiny::Role' );$v->{"coercion"}{"type_constraint"} = $v;$v->{"compiled_type_constraint"} = $v->{"coercion"}{"_compiled_type_constraint_check"}; \$v}->get_message($abstract_type)) |
0 |
55 |
55 |
|
| 162 |
54 |
▶ | return $abstract_type->get_types if $abstract_type->isa('GraphQL::Type::Union'); |
Branch: 1 branch
| Branch | True | False | Total |
| if $abstract_type->isa("GraphQL::Type::Union") |
2 |
53 |
55 |
|
| 163 |
96 |
▶ | $self->_interface2types->{$abstract_type->name} || []; |
Branch: 1 branch
| Branch | True | False | Total |
| $self->_interface2types->{$abstract_type->name} or [] |
55 |
0 |
55 |
|
| 164 |
17 |
▶ | } |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
|
| 165 |
|
| |
| 166 |
|
| =head2 is_possible_type($abstract_type, $possible_type) |
| 167 |
|
| |
| 168 |
|
| In this schema, is the given C<$possible_type> either an implementation |
| 169 |
|
| (if interface) or a possibility (if union) of the C<$abstract_type>? |
| 170 |
|
| |
| 171 |
|
| =cut |
| 172 |
|
| |
| 173 |
|
| has _possible_type_map => (is => 'rw', isa => Map[StrNameValid, Map[StrNameValid, Bool]]); |
| 174 |
14 |
▶ | method is_possible_type( |
|
Subroutine
is_possible_type: called CC=11 SCAR=24.0
Pod
documented
|
| 175 |
|
| (ConsumerOf['GraphQL::Role::Abstract']) $abstract_type, |
| 176 |
|
| (InstanceOf['GraphQL::Type::Object']) $possible_type, |
| 177 |
95 |
▶ | ) :ReturnType(Bool) { |
Branch: 4 branches
| Branch | True | False | Total |
| @_ < 3 and Function::Parameters::_croak('Too few arguments for method is_possible_type (expected 3, got ' . @_ . ')') |
55 |
0 |
55 |
| @_ > 3 and Function::Parameters::_croak('Too many arguments for method is_possible_type (expected 3, got ' . @_ . ')') |
1 |
54 |
55 |
| do {
package Type::Tiny;
builtin::blessed($abstract_type) and do {
my $method = $abstract_type->can("DOES") || $abstract_type->can("isa");
$abstract_type->$method("GraphQL::Role::Abstract")
}
} or Function::Parameters::_croak('In method is_possible_type: parameter 1 ($abstract_type): ' . ${my $v = bless( {"coercion" => bless( {"_compiled_type_constraint_check" => sub ($) { package Eval::TypeTiny::Sandbox; use strict; do { package Type::Tiny; builtin::blessed($_[0]) and do { my $method = $_[0]->can('DOES') || $_[0]->can('isa'); $_[0]->$method('GraphQL::Role::Abstract') } };},"frozen" => 1,"name" => "__ANON__","type_coercion_map" => [],"type_constraint" => {}}, 'Type::Coercion' ),"compiled_type_constraint" => do{my $o},"definition_context" => {"file" => "/usr/local/lib/perl5/site_perl/5.44.0/Types/Standard.pm","line" => 1015,"package" => "Types::Standard"},"deprecated" => !!0,"display_name" => "ConsumerOf[\"GraphQL::Role::Abstract\"]","inlined" => sub { package Type::Tiny::Role; use warnings; use strict; my $var = $_[1]; my $code = "Scalar::Util::blessed($var) and do { my \$method = $var->can('DOES')||$var->can('isa'); $var->\$method(q[$role]) }"; return "do { use Scalar::Util (); $code }" if $Type::Tiny::AvoidCallbacks; $code;},"name" => "__ANON__","role" => "GraphQL::Role::Abstract","uniq" => 136}, 'Type::Tiny::Role' );$v->{"coercion"}{"type_constraint"} = $v;$v->{"compiled_type_constraint"} = $v->{"coercion"}{"_compiled_type_constraint_check"}; \$v}->get_message($abstract_type)) |
1 |
95 |
96 |
| Type::Tiny::XS::AUTO::TC24($possible_type) or Function::Parameters::_croak('In method is_possible_type: parameter 2 ($possible_type): ' . ${my $v = bless( {"_overload_coderef" => sub { package Sub::Defer; use warnings; use strict; $undeferred ||= undefer_sub($deferred_info->[4]); goto \&$undeferred;},"_overload_coderef_no_rebuild" => 1,"_overrides_assert_return" => !!0,"class" => "GraphQL::Type::Object","coercion" => bless( {"_compiled_type_constraint_check" => sub ;,"frozen" => 1,"name" => "__ANON__","type_coercion_map" => [],"type_constraint" => {}}, 'Type::Coercion' ),"compiled_type_constraint" => do{my $o},"definition_context" => {"file" => "/usr/local/lib/perl5/site_perl/5.44.0/Types/Standard.pm","line" => 985,"package" => "Types::Standard"},"deprecated" => !!0,"display_name" => "InstanceOf[\"GraphQL::Type::Object\"]","exception_class" => "Error::TypeTiny::Assertion","inlined" => sub { package Type::Tiny::Class; use warnings; use strict; my $var = $_[1]; return "do { use Scalar::Util (); Scalar::Util::blessed($var) and $var->isa(q[$class]) }" if $Type::Tiny::AvoidCallbacks; return "$xsub($var)" if $xsub; "Scalar::Util::blessed($var) and $var->isa(q[$class])";},"name" => "__ANON__","parent" => bless( {"class" => "GraphQL::Type","compiled_type_constraint" => sub ;,"definition_context" => {"file" => "/usr/local/lib/perl5/site_perl/5.44.0/Method/Generate/Accessor.pm","line" => 716,"package" => "Method::Generate::Accessor"},"deprecated" => !!0,"exception_class" => "Error::TypeTiny::Assertion","inlined" => sub { package Type::Tiny::Class; use warnings; use strict; my $var = $_[1]; return "do { use Scalar::Util (); Scalar::Util::blessed($var) and $var->isa(q[$class]) }" if $Type::Tiny::AvoidCallbacks; return "$xsub($var)" if $xsub; "Scalar::Util::blessed($var) and $var->isa(q[$class])";},"name" => "__ANON__","parent" => bless( {"compiled_type_constraint" => sub ;,"definition_context" => {"file" => "/usr/local/lib/perl5/site_perl/5.44.0/Method/Generate/Accessor.pm","line" => 716,"package" => "Method::Generate::Accessor"},"deprecated" => !!0,"exception_class" => "Error::TypeTiny::Assertion","name" => "__ANON__","type_constraints" => [bless( {"class" => "Moo::Object","compiled_type_constraint" => sub ;,"definition_context" => {"file" => "/usr/local/lib/perl5/site_perl/5.44.0/Method/Generate/Accessor.pm","line" => 716,"package" => "Method::Generate::Accessor"},"deprecated" => !!0,"exception_class" => "Error::TypeTiny::Assertion","inlined" => sub { package Type::Tiny::Class; use warnings; use strict; my $var = $_[1]; return "do { use Scalar::Util (); Scalar::Util::blessed($var) and $var->isa(q[$class]) }" if $Type::Tiny::AvoidCallbacks; return "$xsub($var)" if $xsub; "Scalar::Util::blessed($var) and $var->isa(q[$class])";},"name" => "__ANON__","parent" => bless( {"_is_core" => 1,"_overload_coderef" => sub { package Type::Tiny; BEGIN {${^WARNING_BITS} = "\x10\x01\x00\x00\x00\x50\x04\x00\x00\x00\x00\x00\x01\x40\x05\x45\x55\x15\x55\x55\x01\x00"} use strict; Ref::Util::XS::is_blessed_ref($_[0]) or _failed_check(24, 'Object', $_[0], 'exception_class', 'Error::TypeTiny::Assertion'); $_[0];},"_overrides_assert_return" => !!0,"coercion" => bless( {"_compiled_type_constraint_check" => sub ;,"display_name" => "to_Object","frozen" => 1,"name" => "__ANON__","type_coercion_map" => [],"type_constraint" => {}}, 'Type::Coercion' ),"compiled_type_constraint" => do{my $o},"constraint" => sub { package Types::Standard; no warnings; use strict; builtin::blessed($_);},"definition_context" => {"file" => "/usr/local/lib/perl5/site_perl/5.44.0/Types/Standard.pm","line" => 578,"package" => "Types::Standard"},"deprecated" => !!0,"display_name" => "Object","exception_class" => "Error::TypeTiny::Assertion","inlined" => sub { package Types::Standard; no warnings; use strict; !$Type::Tiny::AvoidCallbacks ? "Ref::Util::XS::is_blessed_ref($_[1])" : &$maybe_load_modules('Scalar::Util', "Scalar::Util::blessed($_[1])");},"is_object" => 1,"library" => "Types::Standard","name" => "Object","parent" => bless( {"_is_core" => 1,"_overload_coderef" => sub { package Type::Tiny; BEGIN {${^WARNING_BITS} = "\x10\x01\x00\x00\x00\x50\x04\x00\x00\x00\x00\x00\x01\x40\x05\x45\x55\x15\x55\x55\x01\x00"} use strict; not ref $_[0] and _failed_check(16, 'Ref', $_[0], 'exception_class', 'Error::TypeTiny::Assertion'); $_[0];},"_overrides_assert_return" => !!0,"coercion" => bless( {"_compiled_type_constraint_check" => sub ;,"display_name" => "to_Ref","frozen" => 1,"name" => "__ANON__","type_coercion_map" => [],"type_constraint" => {}}, 'Type::Coercion' ),"compiled_type_constraint" => do{my $o},"constraint" => sub { package Types::Standard; no warnings; use strict; ref $_;},"constraint_generator" => sub { package Types::Standard; no warnings; use strict; return $meta->get_type('Ref') unless @_; Type::Tiny::check_parameter_count_for_parameterized_type('Types::Standard', 'Ref', \@_, 1); my $reftype = shift(); $reftype =~ /^(SCALAR|ARRAY|HASH|CODE|REF|GLOB|LVALUE|FORMAT|IO|VSTRING|REGEXP|Regexp)$/i or _croak "Parameter to Ref[`a] expected to be a Perl ref type; got $reftype"; $reftype = "$reftype"; return sub { ref $_[0] and builtin::reftype($_[0]) eq $reftype; } ;},"deep_explanation" => sub { package Types::Standard; no warnings; use strict; require B; my($type, $value, $varname) = @_; my $param = $type->parameters->[0]; return if $type->check($value); my $reftype = builtin::reftype($value); return [sprintf('"%s" constrains reftype(%s) to be equal to %s', $type, $varname, B::perlstring($param)), sprintf('reftype(%s) is %s', $varname, defined $reftype ? B::perlstring($reftype) : 'undef')];},"definition_context" => {"file" => "/usr/local/lib/perl5/site_perl/5.44.0/Types/Standard.pm","line" => 438,"package" => "Types::Standard"},"deprecated" => !!0,"display_name" => "Ref","exception_class" => "Error::TypeTiny::Assertion","inline_generator" => sub { package Types::Standard; no warnings; use strict; my $reftype = shift(); return sub { my $v = $_[1]; &$maybe_load_modules('Scalar::Util', "ref($v) and Scalar::Util::reftype($v) eq q($reftype)"); } ;},"inlined" => sub { package Types::Standard; no warnings; use strict; "!!ref($_[1])";},"library" => "Types::Standard","name" => "Ref","parent" => bless( {"_is_core" => 1,"_overload_coderef" => sub { package Type::Tiny; BEGIN {${^WARNING_BITS} = "\x10\x01\x00\x00\x00\x50\x04\x00\x00\x00\x00\x00\x01\x40\x05\x45\x55\x15\x55\x55\x01\x00"} use strict; defined $_[0] or _failed_check(7, 'Defined', $_[0], 'exception_class', 'Error::TypeTiny::Assertion'); $_[0];},"_overrides_assert_return" => !!0,"coercion" => bless( {"_compiled_type_constraint_check" => sub ;,"display_name" => "to_Defined","frozen" => 1,"name" => "__ANON__","type_coercion_map" => [],"type_constraint" => {}}, 'Type::Coercion' ),"compiled_type_constraint" => do{my $o},"complementary_type" => bless( {"_is_core" => 1,"_overload_coderef" => sub { package Type::Tiny; BEGIN {${^WARNING_BITS} = "\x10\x01\x00\x00\x00\x50\x04\x00\x00\x00\x00\x00\x01\x40\x05\x45\x55\x15\x55\x55\x01\x00"} use strict; defined $_[0] and _failed_check(6, 'Undef', $_[0], 'exception_class', 'Error::TypeTiny::Assertion'); $_[0];},"_overrides_assert_return" => !!0,"coercion" => bless( {"_compiled_type_constraint_check" => sub ;,"display_name" => "to_Undef","frozen" => 1,"name" => "__ANON__","type_coercion_map" => [],"type_constraint" => {}}, 'Type::Coercion' ),"compiled_type_constraint" => do{my $o},"complementary_type" => {},"constraint" => sub { package Types::Standard; no warnings; use strict; not defined $_;},"definition_context" => {"file" => "/usr/local/lib/perl5/site_perl/5.44.0/Types/Standard.pm","line" => 254,"package" => "Types::Standard"},"deprecated" => !!0,"display_name" => "Undef","exception_class" => "Error::TypeTiny::Assertion","inlined" => sub { package Types::Standard; no warnings; use strict; "!defined($_[1])";},"library" => "Types::Standard","name" => "Undef","parent" => bless( {"_is_core" => 1,"_overload_coderef" => sub { package Type::Tiny; BEGIN {${^WARNING_BITS} = "\x10\x01\x00\x00\x00\x50\x04\x00\x00\x00\x00\x00\x01\x40\x05\x45\x55\x15\x55\x55\x01\x00"} use strict; '???'; $_[0];},"_overrides_assert_return" => !!0,"coercion" => bless( {"_compiled_type_constraint_check" => sub ;,"display_name" => "to_Item","frozen" => 1,"name" => "__ANON__","type_coercion_map" => [],"type_constraint" => {}}, 'Type::Coercion' ),"compiled_type_constraint" => do{my $o},"constraint" => sub { package Type::Tiny; use warnings; use strict; !0;},"definition_context" => {"file" => "/usr/local/lib/perl5/site_perl/5.44.0/Types/Standard.pm","line" => 226,"package" => "Types::Standard"},"deprecated" => !!0,"display_name" => "Item","exception_class" => "Error::TypeTiny::Assertion","inlined" => sub { package Types::Standard; no warnings; use strict; '!!1';},"library" => "Types::Standard","name" => "Item","parent" => bless( {"_is_core" => 1,"_overload_coderef" => sub { package Sub::Defer; use warnings; use strict; $undeferred ||= undefer_sub($deferred_info->[4]); goto \&$undeferred;},"_overload_coderef_no_rebuild" => 1,"_overrides_assert_return" => !!0,"coercion" => bless( {"_compiled_type_constraint_check" => do{my $o},"display_name" => "to_Any","frozen" => 1,"name" => "__ANON__","type_coercion_map" => [],"type_constraint" => {}}, 'Type::Coercion' ),"compiled_type_constraint" => do{my $o},"complement_name" => "None","constraint" => do{my $o},"definition_context" => {"file" => "/usr/local/lib/perl5/site_perl/5.44.0/Types/Standard.pm","line" => 220,"package" => "Types::Standard"},"deprecated" => !!0,"display_name" => "Any","exception_class" => "Error::TypeTiny::Assertion","inlined" => sub { package Types::Standard; no warnings; use strict; '!!1';},"library" => "Types::Standard","name" => "Any","type_default" => sub { package Types::Standard; no warnings; use strict; return undef;},"uniq" => 1}, 'Type::Tiny' ),"uniq" => 2}, 'Type::Tiny' ),"type_default" => sub { package Types::Standard; no warnings; use strict; return undef;},"uniq" => 6}, 'Type::Tiny' ),"constraint" => sub { package Types::Standard; no warnings; use strict; defined $_;},"definition_context" => {"file" => "/usr/local/lib/perl5/site_perl/5.44.0/Types/Standard.pm","line" => 262,"package" => "Types::Standard"},"deprecated" => !!0,"display_name" => "Defined","exception_class" => "Error::TypeTiny::Assertion","inlined" => sub { package Types::Standard; no warnings; use strict; "defined($_[1])";},"library" => "Types::Standard","name" => "Defined","parent" => {},"uniq" => 7}, 'Type::Tiny' ),"uniq" => 16}, 'Type::Tiny' ),"uniq" => 24}, 'Type::Tiny' ),"uniq" => 140}, 'Type::Tiny::Class' ),bless( {"class" => "GraphQL::MaybeTypeCheck","compiled_type_constraint" => sub ;,"definition_context" => {"file" => "/usr/local/lib/perl5/site_perl/5.44.0/Method/Generate/Accessor.pm","line" => 716,"package" => "Method::Generate::Accessor"},"deprecated" => !!0,"inlined" => sub { package Type::Tiny::Class; use warnings; use strict; my $var = $_[1]; return "do { use Scalar::Util (); Scalar::Util::blessed($var) and $var->isa(q[$class]) }" if $Type::Tiny::AvoidCallbacks; return "$xsub($var)" if $xsub; "Scalar::Util::blessed($var) and $var->isa(q[$class])";},"name" => "__ANON__","uniq" => 141}, 'Type::Tiny::Class' )],"uniq" => 142,"xs_sub" => "Type::Tiny::XS::AUTO::TC12"}, 'Type::Tiny::Intersection' ),"uniq" => 139}, 'Type::Tiny::Class' ),"uniq" => 137}, 'Type::Tiny::Class' );$v->{"coercion"}{"type_constraint"} = $v;$v->{"compiled_type_constraint"} = $v->{"coercion"}{"_compiled_type_constraint_check"};$v->{"parent"}{"parent"}{"type_constraints"}[0]{"parent"}{"coercion"}{"type_constraint"} = $v->{"parent"}{"parent"}{"type_constraints"}[0]{"parent"};$v->{"parent"}{"parent"}{"type_constraints"}[0]{"parent"}{"compiled_type_constraint"} = $v->{"parent"}{"parent"}{"type_constraints"}[0]{"parent"}{"coercion"}{"_compiled_type_constraint_check"};$v->{"parent"}{"parent"}{"type_constraints"}[0]{"parent"}{"parent"}{"coercion"}{"type_constraint"} = $v->{"parent"}{"parent"}{"type_constraints"}[0]{"parent"}{"parent"};$v->{"parent"}{"parent"}{"type_constraints"}[0]{"parent"}{"parent"}{"compiled_type_constraint"} = $v->{"parent"}{"parent"}{"type_constraints"}[0]{"parent"}{"parent"}{"coercion"}{"_compiled_type_constraint_check"};$v->{"parent"}{"parent"}{"type_constraints"}[0]{"parent"}{"parent"}{"parent"}{"coercion"}{"type_constraint"} = $v->{"parent"}{"parent"}{"type_constraints"}[0]{"parent"}{"parent"}{"parent"};$v->{"parent"}{"parent"}{"type_constraints"}[0]{"parent"}{"parent"}{"parent"}{"compiled_type_constraint"} = $v->{"parent"}{"parent"}{"type_constraints"}[0]{"parent"}{"parent"}{"parent"}{"coercion"}{"_compiled_type_constraint_check"};$v->{"parent"}{"parent"}{"type_constraints"}[0]{"parent"}{"parent"}{"parent"}{"complementary_type"}{"coercion"}{"type_constraint"} = $v->{"parent"}{"parent"}{"type_constraints"}[0]{"parent"}{"parent"}{"parent"}{"complementary_type"};$v->{"parent"}{"parent"}{"type_constraints"}[0]{"parent"}{"parent"}{"parent"}{"complementary_type"}{"compiled_type_constraint"} = $v->{"parent"}{"parent"}{"type_constraints"}[0]{"parent"}{"parent"}{"parent"}{"complementary_type"}{"coercion"}{"_compiled_type_constraint_check"};$v->{"parent"}{"parent"}{"type_constraints"}[0]{"parent"}{"parent"}{"parent"}{"complementary_type"}{"complementary_type"} = $v->{"parent"}{"parent"}{"type_constraints"}[0]{"parent"}{"parent"}{"parent"};$v->{"parent"}{"parent"}{"type_constraints"}[0]{"parent"}{"parent"}{"parent"}{"complementary_type"}{"parent"}{"coercion"}{"type_constraint"} = $v->{"parent"}{"parent"}{"type_constraints"}[0]{"parent"}{"parent"}{"parent"}{"complementary_type"}{"parent"};$v->{"parent"}{"parent"}{"type_constraints"}[0]{"parent"}{"parent"}{"parent"}{"complementary_type"}{"parent"}{"compiled_type_constraint"} = $v->{"parent"}{"parent"}{"type_constraints"}[0]{"parent"}{"parent"}{"parent"}{"complementary_type"}{"parent"}{"coercion"}{"_compiled_type_constraint_check"};$v->{"parent"}{"parent"}{"type_constraints"}[0]{"parent"}{"parent"}{"parent"}{"complementary_type"}{"parent"}{"parent"}{"coercion"}{"_compiled_type_constraint_check"} = $v->{"parent"}{"parent"}{"type_constraints"}[0]{"parent"}{"parent"}{"parent"}{"complementary_type"}{"parent"}{"coercion"}{"_compiled_type_constraint_check"};$v->{"parent"}{"parent"}{"type_constraints"}[0]{"parent"}{"parent"}{"parent"}{"complementary_type"}{"parent"}{"parent"}{"coercion"}{"type_constraint"} = $v->{"parent"}{"parent"}{"type_constraints"}[0]{"parent"}{"parent"}{"parent"}{"complementary_type"}{"parent"}{"parent"};$v->{"parent"}{"parent"}{"type_constraints"}[0]{"parent"}{"parent"}{"parent"}{"complementary_type"}{"parent"}{"parent"}{"compiled_type_constraint"} = $v->{"parent"}{"parent"}{"type_constraints"}[0]{"parent"}{"parent"}{"parent"}{"complementary_type"}{"parent"}{"coercion"}{"_compiled_type_constraint_check"};$v->{"parent"}{"parent"}{"type_constraints"}[0]{"parent"}{"parent"}{"parent"}{"complementary_type"}{"parent"}{"parent"}{"constraint"} = $v->{"parent"}{"parent"}{"type_constraints"}[0]{"parent"}{"parent"}{"parent"}{"complementary_type"}{"parent"}{"constraint"};$v->{"parent"}{"parent"}{"type_constraints"}[0]{"parent"}{"parent"}{"parent"}{"parent"} = $v->{"parent"}{"parent"}{"type_constraints"}[0]{"parent"}{"parent"}{"parent"}{"complementary_type"}{"parent"}; \$v}->get_message($possible_type)) |
18 |
35 |
53 |
|
| 178 |
51 |
▶ | my $map = $self->_possible_type_map || {}; |
Condition50%1/2
$self->_possible_type_map || {}
MC/DC0%0/1
$self->_possible_type_map || {}
$self->_possible_type_map
Truth table50%1/2
A
A= $self->_possible_type_map
|
| 179 |
|
| return $map->{$abstract_type->name}{$possible_type->name} |
| 180 |
146 |
▶ | if $map->{$abstract_type->name}; # we know about the abstract_type |
Branch: 1 branch
| Branch | True | False | Total |
| if $$map{$abstract_type->name} |
20 |
34 |
54 |
|
| 181 |
46 |
▶ | my @possibles = @{ $self->get_possible_types($abstract_type)||[] }; |
Condition100%2/2
$self->get_possible_types($abstract_type) || []
MC/DC100%1/1
$self->get_possible_types($abstract_type) || []
$self->get_possible_types($abstract_type)
Truth table100%2/2
A
A= $self->get_possible_types($abstract_type)
|
| 182 |
56 |
▶ | die <<EOF if !@possibles; |
Branch: 1 branch
| Branch | True | False | Total |
| unless @possibles |
2 |
51 |
53 |
|
| 183 |
56 |
| Could not find possible implementing types for @{[$abstract_type->name]} |
| 184 |
|
| in schema. Check that schema.types is defined and is an array of |
| 185 |
|
| all possible types in the schema. |
| 186 |
|
| EOF |
| 187 |
56 |
| $map->{$abstract_type->name} = { map { ($_->name => 1) } @possibles }; |
| 188 |
56 |
| $self->_possible_type_map($map); |
| 189 |
56 |
| $map->{$abstract_type->name}{$possible_type->name}; |
| 190 |
17 |
▶ | } |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
|
| 191 |
|
| |
| 192 |
|
| =head2 assert_object_implements_interface($type, $iface) |
| 193 |
|
| |
| 194 |
|
| In this schema, does the given C<$type> implement interface C<$iface>? If |
| 195 |
|
| not, throw exception. |
| 196 |
|
| |
| 197 |
|
| =cut |
| 198 |
|
| |
| 199 |
0 |
▶ | method assert_object_implements_interface( |
|
Subroutine
assert_object_implements_interface: not called CC=7 SCAR=19.6
Pod
documented
|
| 200 |
|
| (ConsumerOf['GraphQL::Role::Abstract']) $abstract_type, |
| 201 |
|
| (InstanceOf['GraphQL::Type::Object']) $possible_type, |
| 202 |
56 |
▶ | ) { |
Branch: 4 branches
| Branch | True | False | Total |
| @_ < 3 and Function::Parameters::_croak('Too few arguments for method assert_object_implements_interface (expected 3, got ' . @_ . ')') |
59 |
87 |
146 |
| @_ > 3 and Function::Parameters::_croak('Too many arguments for method assert_object_implements_interface (expected 3, got ' . @_ . ')') |
6 |
40 |
46 |
| do {
package Type::Tiny;
builtin::blessed($abstract_type) and do {
my $method = $abstract_type->can("DOES") || $abstract_type->can("isa");
$abstract_type->$method("GraphQL::Role::Abstract")
}
} or Function::Parameters::_croak('In method assert_object_implements_interface: parameter 1 ($abstract_type): ' . ${my $v = bless( {"coercion" => bless( {"_compiled_type_constraint_check" => sub ($) { package Eval::TypeTiny::Sandbox; use strict; do { package Type::Tiny; builtin::blessed($_[0]) and do { my $method = $_[0]->can('DOES') || $_[0]->can('isa'); $_[0]->$method('GraphQL::Role::Abstract') } };},"frozen" => 1,"name" => "__ANON__","type_coercion_map" => [],"type_constraint" => {}}, 'Type::Coercion' ),"compiled_type_constraint" => do{my $o},"definition_context" => {"file" => "/usr/local/lib/perl5/site_perl/5.44.0/Types/Standard.pm","line" => 1015,"package" => "Types::Standard"},"deprecated" => !!0,"display_name" => "ConsumerOf[\"GraphQL::Role::Abstract\"]","inlined" => sub { package Type::Tiny::Role; use warnings; use strict; my $var = $_[1]; my $code = "Scalar::Util::blessed($var) and do { my \$method = $var->can('DOES')||$var->can('isa'); $var->\$method(q[$role]) }"; return "do { use Scalar::Util (); $code }" if $Type::Tiny::AvoidCallbacks; $code;},"name" => "__ANON__","role" => "GraphQL::Role::Abstract","uniq" => 136}, 'Type::Tiny::Role' );$v->{"coercion"}{"type_constraint"} = $v;$v->{"compiled_type_constraint"} = $v->{"coercion"}{"_compiled_type_constraint_check"}; \$v}->get_message($abstract_type)) |
0 |
56 |
56 |
| Type::Tiny::XS::AUTO::TC24($possible_type) or Function::Parameters::_croak('In method assert_object_implements_interface: parameter 2 ($possible_type): ' . ${my $v = bless( {"_overload_coderef" => sub { package Sub::Defer; use warnings; use strict; $undeferred ||= undefer_sub($deferred_info->[4]); goto \&$undeferred;},"_overload_coderef_no_rebuild" => 1,"_overrides_assert_return" => !!0,"class" => "GraphQL::Type::Object","coercion" => bless( {"_compiled_type_constraint_check" => sub ;,"frozen" => 1,"name" => "__ANON__","type_coercion_map" => [],"type_constraint" => {}}, 'Type::Coercion' ),"compiled_type_constraint" => do{my $o},"definition_context" => {"file" => "/usr/local/lib/perl5/site_perl/5.44.0/Types/Standard.pm","line" => 985,"package" => "Types::Standard"},"deprecated" => !!0,"display_name" => "InstanceOf[\"GraphQL::Type::Object\"]","exception_class" => "Error::TypeTiny::Assertion","inlined" => sub { package Type::Tiny::Class; use warnings; use strict; my $var = $_[1]; return "do { use Scalar::Util (); Scalar::Util::blessed($var) and $var->isa(q[$class]) }" if $Type::Tiny::AvoidCallbacks; return "$xsub($var)" if $xsub; "Scalar::Util::blessed($var) and $var->isa(q[$class])";},"name" => "__ANON__","parent" => bless( {"class" => "GraphQL::Type","compiled_type_constraint" => sub ;,"definition_context" => {"file" => "/usr/local/lib/perl5/site_perl/5.44.0/Method/Generate/Accessor.pm","line" => 716,"package" => "Method::Generate::Accessor"},"deprecated" => !!0,"exception_class" => "Error::TypeTiny::Assertion","inlined" => sub { package Type::Tiny::Class; use warnings; use strict; my $var = $_[1]; return "do { use Scalar::Util (); Scalar::Util::blessed($var) and $var->isa(q[$class]) }" if $Type::Tiny::AvoidCallbacks; return "$xsub($var)" if $xsub; "Scalar::Util::blessed($var) and $var->isa(q[$class])";},"name" => "__ANON__","parent" => bless( {"compiled_type_constraint" => sub ;,"definition_context" => {"file" => "/usr/local/lib/perl5/site_perl/5.44.0/Method/Generate/Accessor.pm","line" => 716,"package" => "Method::Generate::Accessor"},"deprecated" => !!0,"exception_class" => "Error::TypeTiny::Assertion","name" => "__ANON__","type_constraints" => [bless( {"class" => "Moo::Object","compiled_type_constraint" => sub ;,"definition_context" => {"file" => "/usr/local/lib/perl5/site_perl/5.44.0/Method/Generate/Accessor.pm","line" => 716,"package" => "Method::Generate::Accessor"},"deprecated" => !!0,"exception_class" => "Error::TypeTiny::Assertion","inlined" => sub { package Type::Tiny::Class; use warnings; use strict; my $var = $_[1]; return "do { use Scalar::Util (); Scalar::Util::blessed($var) and $var->isa(q[$class]) }" if $Type::Tiny::AvoidCallbacks; return "$xsub($var)" if $xsub; "Scalar::Util::blessed($var) and $var->isa(q[$class])";},"name" => "__ANON__","parent" => bless( {"_is_core" => 1,"_overload_coderef" => sub { package Type::Tiny; BEGIN {${^WARNING_BITS} = "\x10\x01\x00\x00\x00\x50\x04\x00\x00\x00\x00\x00\x01\x40\x05\x45\x55\x15\x55\x55\x01\x00"} use strict; Ref::Util::XS::is_blessed_ref($_[0]) or _failed_check(24, 'Object', $_[0], 'exception_class', 'Error::TypeTiny::Assertion'); $_[0];},"_overrides_assert_return" => !!0,"coercion" => bless( {"_compiled_type_constraint_check" => sub ;,"display_name" => "to_Object","frozen" => 1,"name" => "__ANON__","type_coercion_map" => [],"type_constraint" => {}}, 'Type::Coercion' ),"compiled_type_constraint" => do{my $o},"constraint" => sub { package Types::Standard; no warnings; use strict; builtin::blessed($_);},"definition_context" => {"file" => "/usr/local/lib/perl5/site_perl/5.44.0/Types/Standard.pm","line" => 578,"package" => "Types::Standard"},"deprecated" => !!0,"display_name" => "Object","exception_class" => "Error::TypeTiny::Assertion","inlined" => sub { package Types::Standard; no warnings; use strict; !$Type::Tiny::AvoidCallbacks ? "Ref::Util::XS::is_blessed_ref($_[1])" : &$maybe_load_modules('Scalar::Util', "Scalar::Util::blessed($_[1])");},"is_object" => 1,"library" => "Types::Standard","name" => "Object","parent" => bless( {"_is_core" => 1,"_overload_coderef" => sub { package Type::Tiny; BEGIN {${^WARNING_BITS} = "\x10\x01\x00\x00\x00\x50\x04\x00\x00\x00\x00\x00\x01\x40\x05\x45\x55\x15\x55\x55\x01\x00"} use strict; not ref $_[0] and _failed_check(16, 'Ref', $_[0], 'exception_class', 'Error::TypeTiny::Assertion'); $_[0];},"_overrides_assert_return" => !!0,"coercion" => bless( {"_compiled_type_constraint_check" => sub ;,"display_name" => "to_Ref","frozen" => 1,"name" => "__ANON__","type_coercion_map" => [],"type_constraint" => {}}, 'Type::Coercion' ),"compiled_type_constraint" => do{my $o},"constraint" => sub { package Types::Standard; no warnings; use strict; ref $_;},"constraint_generator" => sub { package Types::Standard; no warnings; use strict; return $meta->get_type('Ref') unless @_; Type::Tiny::check_parameter_count_for_parameterized_type('Types::Standard', 'Ref', \@_, 1); my $reftype = shift(); $reftype =~ /^(SCALAR|ARRAY|HASH|CODE|REF|GLOB|LVALUE|FORMAT|IO|VSTRING|REGEXP|Regexp)$/i or _croak "Parameter to Ref[`a] expected to be a Perl ref type; got $reftype"; $reftype = "$reftype"; return sub { ref $_[0] and builtin::reftype($_[0]) eq $reftype; } ;},"deep_explanation" => sub { package Types::Standard; no warnings; use strict; require B; my($type, $value, $varname) = @_; my $param = $type->parameters->[0]; return if $type->check($value); my $reftype = builtin::reftype($value); return [sprintf('"%s" constrains reftype(%s) to be equal to %s', $type, $varname, B::perlstring($param)), sprintf('reftype(%s) is %s', $varname, defined $reftype ? B::perlstring($reftype) : 'undef')];},"definition_context" => {"file" => "/usr/local/lib/perl5/site_perl/5.44.0/Types/Standard.pm","line" => 438,"package" => "Types::Standard"},"deprecated" => !!0,"display_name" => "Ref","exception_class" => "Error::TypeTiny::Assertion","inline_generator" => sub { package Types::Standard; no warnings; use strict; my $reftype = shift(); return sub { my $v = $_[1]; &$maybe_load_modules('Scalar::Util', "ref($v) and Scalar::Util::reftype($v) eq q($reftype)"); } ;},"inlined" => sub { package Types::Standard; no warnings; use strict; "!!ref($_[1])";},"library" => "Types::Standard","name" => "Ref","parent" => bless( {"_is_core" => 1,"_overload_coderef" => sub { package Type::Tiny; BEGIN {${^WARNING_BITS} = "\x10\x01\x00\x00\x00\x50\x04\x00\x00\x00\x00\x00\x01\x40\x05\x45\x55\x15\x55\x55\x01\x00"} use strict; defined $_[0] or _failed_check(7, 'Defined', $_[0], 'exception_class', 'Error::TypeTiny::Assertion'); $_[0];},"_overrides_assert_return" => !!0,"coercion" => bless( {"_compiled_type_constraint_check" => sub ;,"display_name" => "to_Defined","frozen" => 1,"name" => "__ANON__","type_coercion_map" => [],"type_constraint" => {}}, 'Type::Coercion' ),"compiled_type_constraint" => do{my $o},"complementary_type" => bless( {"_is_core" => 1,"_overload_coderef" => sub { package Type::Tiny; BEGIN {${^WARNING_BITS} = "\x10\x01\x00\x00\x00\x50\x04\x00\x00\x00\x00\x00\x01\x40\x05\x45\x55\x15\x55\x55\x01\x00"} use strict; defined $_[0] and _failed_check(6, 'Undef', $_[0], 'exception_class', 'Error::TypeTiny::Assertion'); $_[0];},"_overrides_assert_return" => !!0,"coercion" => bless( {"_compiled_type_constraint_check" => sub ;,"display_name" => "to_Undef","frozen" => 1,"name" => "__ANON__","type_coercion_map" => [],"type_constraint" => {}}, 'Type::Coercion' ),"compiled_type_constraint" => do{my $o},"complementary_type" => {},"constraint" => sub { package Types::Standard; no warnings; use strict; not defined $_;},"definition_context" => {"file" => "/usr/local/lib/perl5/site_perl/5.44.0/Types/Standard.pm","line" => 254,"package" => "Types::Standard"},"deprecated" => !!0,"display_name" => "Undef","exception_class" => "Error::TypeTiny::Assertion","inlined" => sub { package Types::Standard; no warnings; use strict; "!defined($_[1])";},"library" => "Types::Standard","name" => "Undef","parent" => bless( {"_is_core" => 1,"_overload_coderef" => sub { package Type::Tiny; BEGIN {${^WARNING_BITS} = "\x10\x01\x00\x00\x00\x50\x04\x00\x00\x00\x00\x00\x01\x40\x05\x45\x55\x15\x55\x55\x01\x00"} use strict; '???'; $_[0];},"_overrides_assert_return" => !!0,"coercion" => bless( {"_compiled_type_constraint_check" => sub ;,"display_name" => "to_Item","frozen" => 1,"name" => "__ANON__","type_coercion_map" => [],"type_constraint" => {}}, 'Type::Coercion' ),"compiled_type_constraint" => do{my $o},"constraint" => sub { package Type::Tiny; use warnings; use strict; !0;},"definition_context" => {"file" => "/usr/local/lib/perl5/site_perl/5.44.0/Types/Standard.pm","line" => 226,"package" => "Types::Standard"},"deprecated" => !!0,"display_name" => "Item","exception_class" => "Error::TypeTiny::Assertion","inlined" => sub { package Types::Standard; no warnings; use strict; '!!1';},"library" => "Types::Standard","name" => "Item","parent" => bless( {"_is_core" => 1,"_overload_coderef" => sub { package Sub::Defer; use warnings; use strict; $undeferred ||= undefer_sub($deferred_info->[4]); goto \&$undeferred;},"_overload_coderef_no_rebuild" => 1,"_overrides_assert_return" => !!0,"coercion" => bless( {"_compiled_type_constraint_check" => do{my $o},"display_name" => "to_Any","frozen" => 1,"name" => "__ANON__","type_coercion_map" => [],"type_constraint" => {}}, 'Type::Coercion' ),"compiled_type_constraint" => do{my $o},"complement_name" => "None","constraint" => do{my $o},"definition_context" => {"file" => "/usr/local/lib/perl5/site_perl/5.44.0/Types/Standard.pm","line" => 220,"package" => "Types::Standard"},"deprecated" => !!0,"display_name" => "Any","exception_class" => "Error::TypeTiny::Assertion","inlined" => sub { package Types::Standard; no warnings; use strict; '!!1';},"library" => "Types::Standard","name" => "Any","type_default" => sub { package Types::Standard; no warnings; use strict; return undef;},"uniq" => 1}, 'Type::Tiny' ),"uniq" => 2}, 'Type::Tiny' ),"type_default" => sub { package Types::Standard; no warnings; use strict; return undef;},"uniq" => 6}, 'Type::Tiny' ),"constraint" => sub { package Types::Standard; no warnings; use strict; defined $_;},"definition_context" => {"file" => "/usr/local/lib/perl5/site_perl/5.44.0/Types/Standard.pm","line" => 262,"package" => "Types::Standard"},"deprecated" => !!0,"display_name" => "Defined","exception_class" => "Error::TypeTiny::Assertion","inlined" => sub { package Types::Standard; no warnings; use strict; "defined($_[1])";},"library" => "Types::Standard","name" => "Defined","parent" => {},"uniq" => 7}, 'Type::Tiny' ),"uniq" => 16}, 'Type::Tiny' ),"uniq" => 24}, 'Type::Tiny' ),"uniq" => 140}, 'Type::Tiny::Class' ),bless( {"class" => "GraphQL::MaybeTypeCheck","compiled_type_constraint" => sub ;,"definition_context" => {"file" => "/usr/local/lib/perl5/site_perl/5.44.0/Method/Generate/Accessor.pm","line" => 716,"package" => "Method::Generate::Accessor"},"deprecated" => !!0,"inlined" => sub { package Type::Tiny::Class; use warnings; use strict; my $var = $_[1]; return "do { use Scalar::Util (); Scalar::Util::blessed($var) and $var->isa(q[$class]) }" if $Type::Tiny::AvoidCallbacks; return "$xsub($var)" if $xsub; "Scalar::Util::blessed($var) and $var->isa(q[$class])";},"name" => "__ANON__","uniq" => 141}, 'Type::Tiny::Class' )],"uniq" => 142,"xs_sub" => "Type::Tiny::XS::AUTO::TC12"}, 'Type::Tiny::Intersection' ),"uniq" => 139}, 'Type::Tiny::Class' ),"uniq" => 137}, 'Type::Tiny::Class' );$v->{"coercion"}{"type_constraint"} = $v;$v->{"compiled_type_constraint"} = $v->{"coercion"}{"_compiled_type_constraint_check"};$v->{"parent"}{"parent"}{"type_constraints"}[0]{"parent"}{"coercion"}{"type_constraint"} = $v->{"parent"}{"parent"}{"type_constraints"}[0]{"parent"};$v->{"parent"}{"parent"}{"type_constraints"}[0]{"parent"}{"compiled_type_constraint"} = $v->{"parent"}{"parent"}{"type_constraints"}[0]{"parent"}{"coercion"}{"_compiled_type_constraint_check"};$v->{"parent"}{"parent"}{"type_constraints"}[0]{"parent"}{"parent"}{"coercion"}{"type_constraint"} = $v->{"parent"}{"parent"}{"type_constraints"}[0]{"parent"}{"parent"};$v->{"parent"}{"parent"}{"type_constraints"}[0]{"parent"}{"parent"}{"compiled_type_constraint"} = $v->{"parent"}{"parent"}{"type_constraints"}[0]{"parent"}{"parent"}{"coercion"}{"_compiled_type_constraint_check"};$v->{"parent"}{"parent"}{"type_constraints"}[0]{"parent"}{"parent"}{"parent"}{"coercion"}{"type_constraint"} = $v->{"parent"}{"parent"}{"type_constraints"}[0]{"parent"}{"parent"}{"parent"};$v->{"parent"}{"parent"}{"type_constraints"}[0]{"parent"}{"parent"}{"parent"}{"compiled_type_constraint"} = $v->{"parent"}{"parent"}{"type_constraints"}[0]{"parent"}{"parent"}{"parent"}{"coercion"}{"_compiled_type_constraint_check"};$v->{"parent"}{"parent"}{"type_constraints"}[0]{"parent"}{"parent"}{"parent"}{"complementary_type"}{"coercion"}{"type_constraint"} = $v->{"parent"}{"parent"}{"type_constraints"}[0]{"parent"}{"parent"}{"parent"}{"complementary_type"};$v->{"parent"}{"parent"}{"type_constraints"}[0]{"parent"}{"parent"}{"parent"}{"complementary_type"}{"compiled_type_constraint"} = $v->{"parent"}{"parent"}{"type_constraints"}[0]{"parent"}{"parent"}{"parent"}{"complementary_type"}{"coercion"}{"_compiled_type_constraint_check"};$v->{"parent"}{"parent"}{"type_constraints"}[0]{"parent"}{"parent"}{"parent"}{"complementary_type"}{"complementary_type"} = $v->{"parent"}{"parent"}{"type_constraints"}[0]{"parent"}{"parent"}{"parent"};$v->{"parent"}{"parent"}{"type_constraints"}[0]{"parent"}{"parent"}{"parent"}{"complementary_type"}{"parent"}{"coercion"}{"type_constraint"} = $v->{"parent"}{"parent"}{"type_constraints"}[0]{"parent"}{"parent"}{"parent"}{"complementary_type"}{"parent"};$v->{"parent"}{"parent"}{"type_constraints"}[0]{"parent"}{"parent"}{"parent"}{"complementary_type"}{"parent"}{"compiled_type_constraint"} = $v->{"parent"}{"parent"}{"type_constraints"}[0]{"parent"}{"parent"}{"parent"}{"complementary_type"}{"parent"}{"coercion"}{"_compiled_type_constraint_check"};$v->{"parent"}{"parent"}{"type_constraints"}[0]{"parent"}{"parent"}{"parent"}{"complementary_type"}{"parent"}{"parent"}{"coercion"}{"_compiled_type_constraint_check"} = $v->{"parent"}{"parent"}{"type_constraints"}[0]{"parent"}{"parent"}{"parent"}{"complementary_type"}{"parent"}{"coercion"}{"_compiled_type_constraint_check"};$v->{"parent"}{"parent"}{"type_constraints"}[0]{"parent"}{"parent"}{"parent"}{"complementary_type"}{"parent"}{"parent"}{"coercion"}{"type_constraint"} = $v->{"parent"}{"parent"}{"type_constraints"}[0]{"parent"}{"parent"}{"parent"}{"complementary_type"}{"parent"}{"parent"};$v->{"parent"}{"parent"}{"type_constraints"}[0]{"parent"}{"parent"}{"parent"}{"complementary_type"}{"parent"}{"parent"}{"compiled_type_constraint"} = $v->{"parent"}{"parent"}{"type_constraints"}[0]{"parent"}{"parent"}{"parent"}{"complementary_type"}{"parent"}{"coercion"}{"_compiled_type_constraint_check"};$v->{"parent"}{"parent"}{"type_constraints"}[0]{"parent"}{"parent"}{"parent"}{"complementary_type"}{"parent"}{"parent"}{"constraint"} = $v->{"parent"}{"parent"}{"type_constraints"}[0]{"parent"}{"parent"}{"parent"}{"complementary_type"}{"parent"}{"constraint"};$v->{"parent"}{"parent"}{"type_constraints"}[0]{"parent"}{"parent"}{"parent"}{"parent"} = $v->{"parent"}{"parent"}{"type_constraints"}[0]{"parent"}{"parent"}{"parent"}{"complementary_type"}{"parent"}; \$v}->get_message($possible_type)) |
0 |
56 |
56 |
|
| 203 |
26 |
| my @types = @{ $self->types }; |
| 204 |
26 |
| return; |
| 205 |
|
| } |
| 206 |
|
| |
| 207 |
|
| =head2 from_ast($ast[, \%kind2class]) |
| 208 |
|
| |
| 209 |
|
| Class method. Takes AST (array-ref of hash-refs) made by |
| 210 |
|
| L<GraphQL::Language::Parser/parse> and returns a schema object. Will |
| 211 |
|
| not be a complete schema since it will have only default resolvers. |
| 212 |
|
| |
| 213 |
|
| If C<\%kind2class> is given, it will override the default |
| 214 |
|
| mapping of SDL keywords to Perl classes. This is probably most |
| 215 |
|
| useful for L<GraphQL::Type::Object>. The default is available as |
| 216 |
|
| C<%GraphQL::Schema::KIND2CLASS>. E.g. |
| 217 |
|
| |
| 218 |
|
| my $schema = GraphQL::Schema->from_ast( |
| 219 |
|
| $doc, |
| 220 |
|
| { %GraphQL::Schema::KIND2CLASS, type => 'GraphQL::Type::Object::DBIC' } |
| 221 |
|
| ); |
| 222 |
|
| |
| 223 |
|
| Makes available the additional types returned by |
| 224 |
|
| L<GraphQL::Plugin::Type/registered>. |
| 225 |
|
| |
| 226 |
|
| =cut |
| 227 |
|
| |
| 228 |
|
| our %KIND2CLASS = qw( |
| 229 |
|
| type GraphQL::Type::Object |
| 230 |
|
| enum GraphQL::Type::Enum |
| 231 |
|
| interface GraphQL::Type::Interface |
| 232 |
|
| union GraphQL::Type::Union |
| 233 |
|
| scalar GraphQL::Type::Scalar |
| 234 |
|
| input GraphQL::Type::InputObject |
| 235 |
|
| ); |
| 236 |
|
| my %CLASS2KIND = reverse %KIND2CLASS; |
| 237 |
55 |
▶ | method from_ast( |
|
Subroutine
from_ast: called CC=15 SCAR=28.1
Pod
documented
|
| 238 |
|
| ArrayRef[HashRef] $ast, |
| 239 |
|
| HashRef $kind2class = \%KIND2CLASS, |
| 240 |
0 |
▶ | ) :ReturnType(InstanceOf[__PACKAGE__]) { |
Branch: 5 branches
| Branch | True | False | Total |
| @_ < 2 and Function::Parameters::_croak('Too few arguments for method from_ast (expected 2, got ' . @_ . ')') |
55 |
1 |
56 |
| @_ > 3 and Function::Parameters::_croak('Too many arguments for method from_ast (expected 3, got ' . @_ . ')') |
56 |
0 |
56 |
| @_ < 2 and $kind2class = \%GraphQL::Schema::KIND2CLASS |
56 |
0 |
56 |
| Type::Tiny::XS::AUTO::TC1($ast) or Function::Parameters::_croak('In method from_ast: parameter 1 ($ast): ' . ${my $v = bless( {"_build_coercion" => sub { package Type::Tiny; use warnings; use strict; my $coercion = shift(); my $built = $self->coercion_generator->($self, $P, @args); $coercion->add_type_coercions(@{$built->type_coercion_map;}) if $built; $coercion->freeze;},"coercion" => bless( {"_compiled_type_constraint_check" => sub ;,"frozen" => 1,"name" => "__ANON__","type_coercion_map" => [],"type_constraint" => {}}, 'Type::Coercion' ),"compiled_type_constraint" => do{my $o},"constraint" => sub { package Types::Standard::ArrayRef; no warnings; use strict; my $array = shift(); ($param->check($_) or return) foreach (@$array); return !0;},"definition_context" => {"file" => "/home/cpancover/.cpan/build/GraphQL-0.54-0/blib/lib/GraphQL/Type/Library.pm","line" => 92,"package" => "GraphQL::Type::Library"},"deprecated" => !!0,"display_name" => "ArrayRef[HashRef]","exception_class" => "Error::TypeTiny::Assertion","inlined" => sub { package Types::Standard::ArrayRef; no warnings; use strict; my $v = $_[1]; return "$xsubname($v)" if $xsubname and not $Type::Tiny::AvoidCallbacks; my $p = &Types::Standard::ArrayRef()->inline_check($v); if ($min != 0) { $p .= sprintf(' and @{%s} >= %d', $v, $min); } if ($max > 0) { $p .= sprintf(' and @{%s} <= %d', $v, $max); } my $param_check = $param->inline_check('$i'); return $p if $param->{'uniq'} eq &Types::Standard::Any()->{'uniq'}; "$p and do { " . 'my $ok = 1; ' . "for my \$i (\@{$v}) { " . "(\$ok = 0, last) unless $param_check " . '}; ' . '$ok ' . '}';},"name" => "__ANON__","parameters" => [bless( {"_is_core" => 1,"_overload_coderef" => sub { package Sub::Defer; use warnings; use strict; $undeferred ||= undefer_sub($deferred_info->[4]); goto \&$undeferred;},"_overload_coderef_no_rebuild" => 1,"_overrides_assert_return" => !!0,"coercion" => bless( {"_compiled_type_constraint_check" => sub ;,"display_name" => "to_HashRef","frozen" => 1,"name" => "__ANON__","type_coercion_map" => [],"type_constraint" => {}}, 'Type::Coercion' ),"coercion_generator" => sub { package Types::Standard::HashRef; no warnings; use strict; my($parent, $child, $param) = @_; return unless $param->has_coercion; my $coercable_item = $param->coercion->_source_type_union; my $C = 'Type::Coercion'->new('type_constraint', $child); if ($param->coercion->can_be_inlined and $coercable_item->can_be_inlined) { $C->add_type_coercions($parent, &Types::Standard::Stringable(sub { my @code; push @code, 'do { my ($orig, $return_orig, %new) = ($_, 0);'; push @code, 'for (keys %$orig) {'; push @code, sprintf('$return_orig++ && last unless (%s);', $coercable_item->inline_check('$orig->{$_}')); push @code, sprintf('$new{$_} = (%s);', $param->coercion->inline_coercion('$orig->{$_}')); push @code, '}'; push @code, '$return_orig ? $orig : \\%new'; push @code, '}'; join $", @code; } )); } else { $C->add_type_coercions($parent, sub { my $value = @_ ? $_[0] : $_; my %new; foreach my $k (keys %$value) { return $value unless $coercable_item->check($value->{$k}); $new{$k} = $param->coerce($value->{$k}); } return \%new; } ); } return $C;},"compiled_type_constraint" => do{my $o},"constraint" => sub { package Types::Standard; no warnings; use strict; ref $_ eq 'HASH';},"constraint_generator" => sub { package Types::Standard::HashRef; no warnings; use strict; return &Types::Standard::HashRef() unless @_; require Error::TypeTiny::WrongNumberOfParameters; Type::Tiny::check_parameter_count_for_parameterized_type('Types::Standard', 'HashRef', \@_, 1); my $param = shift(); Types::TypeTiny::is_TypeTiny($param) or _croak "Parameter to HashRef[`a] expected to be a type constraint; got $param"; my $param_compiled_check = $param->compiled_check; my $xsub; do { my $paramname = Type::Tiny::XS::is_known($param_compiled_check); $xsub = Type::Tiny::XS::get_coderef_for("HashRef[$paramname]") if $paramname }; return sub { my $hash = shift(); ($param->check($_) or return) foreach (values %$hash); return !0; } , $xsub;},"deep_explanation" => sub { package Types::Standard::HashRef; no warnings; use strict; require B; my($type, $value, $varname) = @_; my $param = $type->parameters->[0]; foreach my $k (sort keys %$value) { my $item = $value->{$k}; next if $param->check($item); return [sprintf('"%s" constrains each value in the hash with "%s"', $type, $param), @{$param->validate_explain($item, sprintf('%s->{%s}', $varname, B::perlstring($k)));}]; } return;},"definition_context" => {"file" => "/usr/local/lib/perl5/site_perl/5.44.0/Types/Standard.pm","line" => 544,"package" => "Types::Standard"},"deprecated" => !!0,"display_name" => "HashRef","exception_class" => "Error::TypeTiny::Assertion","inline_generator" => sub { package Types::Standard::HashRef; no warnings; use strict; my $param = shift(); my $compiled = $param->compiled_check; my $xsubname; unless ($Type::Tiny::AvoidCallbacks) { my $paramname = Type::Tiny::XS::is_known($compiled); $xsubname = Type::Tiny::XS::get_subname_for("HashRef[$paramname]"); } return unless $param->can_be_inlined; return sub { my $v = $_[1]; return "$xsubname($v)" if $xsubname and not $Type::Tiny::AvoidCallbacks; my $p = &Types::Standard::HashRef()->inline_check($v); my $param_check = $param->inline_check('$i'); "$p and do { " . 'my $ok = 1; ' . "for my \$i (values %{$v}) { " . "(\$ok = 0, last) unless $param_check " . '}; ' . '$ok ' . '}'; } ;},"inlined" => sub { package Types::Standard; no warnings; use strict; !$Type::Tiny::AvoidCallbacks ? "Ref::Util::XS::is_plain_hashref($_[1])" : "ref($_[1]) eq 'HASH'";},"library" => "Types::Standard","my_methods" => {"hashref_allows_key" => sub { package Types::Standard::HashRef; no warnings; use strict; my $self = shift(); Types::Standard::is_Str($_[0]);},"hashref_allows_value" => sub { package Types::Standard::HashRef; no warnings; use strict; my $self = shift(); my($key, $value) = @_; return !1 unless $self->my_hashref_allows_key($key); return !0 if $self == &Types::Standard::HashRef(); my $href = $self->find_parent(sub { $_->has_parent and $_->parent == &Types::Standard::HashRef(); } ); my $param = $href->type_parameter; Types::Standard::is_Str($key) and $param->check($value);}},"name" => "HashRef","name_generator" => sub { package Type::Tiny; use warnings; use strict; defined $_ and s/[\x00-\x1F]//gms foreach (my($s, @a) = @_); sprintf '%s[%s]', $s, join(',', map((!defined($_) ? 'undef' : (!ref($_) && /\W/ ? B::perlstring($_) : $_)), @a));},"parent" => bless( {"_is_core" => 1,"_overload_coderef" => sub { package Type::Tiny; BEGIN {${^WARNING_BITS} = "\x10\x01\x00\x00\x00\x50\x04\x00\x00\x00\x00\x00\x01\x40\x05\x45\x55\x15\x55\x55\x01\x00"} use strict; not ref $_[0] and _failed_check(16, 'Ref', $_[0], 'exception_class', 'Error::TypeTiny::Assertion'); $_[0];},"_overrides_assert_return" => !!0,"coercion" => bless( {"_compiled_type_constraint_check" => sub ;,"display_name" => "to_Ref","frozen" => 1,"name" => "__ANON__","type_coercion_map" => [],"type_constraint" => {}}, 'Type::Coercion' ),"compiled_type_constraint" => do{my $o},"constraint" => sub { package Types::Standard; no warnings; use strict; ref $_;},"constraint_generator" => sub { package Types::Standard; no warnings; use strict; return $meta->get_type('Ref') unless @_; Type::Tiny::check_parameter_count_for_parameterized_type('Types::Standard', 'Ref', \@_, 1); my $reftype = shift(); $reftype =~ /^(SCALAR|ARRAY|HASH|CODE|REF|GLOB|LVALUE|FORMAT|IO|VSTRING|REGEXP|Regexp)$/i or _croak "Parameter to Ref[`a] expected to be a Perl ref type; got $reftype"; $reftype = "$reftype"; return sub { ref $_[0] and builtin::reftype($_[0]) eq $reftype; } ;},"deep_explanation" => sub { package Types::Standard; no warnings; use strict; require B; my($type, $value, $varname) = @_; my $param = $type->parameters->[0]; return if $type->check($value); my $reftype = builtin::reftype($value); return [sprintf('"%s" constrains reftype(%s) to be equal to %s', $type, $varname, B::perlstring($param)), sprintf('reftype(%s) is %s', $varname, defined $reftype ? B::perlstring($reftype) : 'undef')];},"definition_context" => {"file" => "/usr/local/lib/perl5/site_perl/5.44.0/Types/Standard.pm","line" => 438,"package" => "Types::Standard"},"deprecated" => !!0,"display_name" => "Ref","exception_class" => "Error::TypeTiny::Assertion","inline_generator" => sub { package Types::Standard; no warnings; use strict; my $reftype = shift(); return sub { my $v = $_[1]; &$maybe_load_modules('Scalar::Util', "ref($v) and Scalar::Util::reftype($v) eq q($reftype)"); } ;},"inlined" => sub { package Types::Standard; no warnings; use strict; "!!ref($_[1])";},"library" => "Types::Standard","name" => "Ref","parent" => bless( {"_is_core" => 1,"_overload_coderef" => sub { package Type::Tiny; BEGIN {${^WARNING_BITS} = "\x10\x01\x00\x00\x00\x50\x04\x00\x00\x00\x00\x00\x01\x40\x05\x45\x55\x15\x55\x55\x01\x00"} use strict; defined $_[0] or _failed_check(7, 'Defined', $_[0], 'exception_class', 'Error::TypeTiny::Assertion'); $_[0];},"_overrides_assert_return" => !!0,"coercion" => bless( {"_compiled_type_constraint_check" => sub ;,"display_name" => "to_Defined","frozen" => 1,"name" => "__ANON__","type_coercion_map" => [],"type_constraint" => {}}, 'Type::Coercion' ),"compiled_type_constraint" => do{my $o},"complementary_type" => bless( {"_is_core" => 1,"_overload_coderef" => sub { package Type::Tiny; BEGIN {${^WARNING_BITS} = "\x10\x01\x00\x00\x00\x50\x04\x00\x00\x00\x00\x00\x01\x40\x05\x45\x55\x15\x55\x55\x01\x00"} use strict; defined $_[0] and _failed_check(6, 'Undef', $_[0], 'exception_class', 'Error::TypeTiny::Assertion'); $_[0];},"_overrides_assert_return" => !!0,"coercion" => bless( {"_compiled_type_constraint_check" => sub ;,"display_name" => "to_Undef","frozen" => 1,"name" => "__ANON__","type_coercion_map" => [],"type_constraint" => {}}, 'Type::Coercion' ),"compiled_type_constraint" => do{my $o},"complementary_type" => {},"constraint" => sub { package Types::Standard; no warnings; use strict; not defined $_;},"definition_context" => {"file" => "/usr/local/lib/perl5/site_perl/5.44.0/Types/Standard.pm","line" => 254,"package" => "Types::Standard"},"deprecated" => !!0,"display_name" => "Undef","exception_class" => "Error::TypeTiny::Assertion","inlined" => sub { package Types::Standard; no warnings; use strict; "!defined($_[1])";},"library" => "Types::Standard","name" => "Undef","parent" => bless( {"_is_core" => 1,"_overload_coderef" => sub { package Type::Tiny; BEGIN {${^WARNING_BITS} = "\x10\x01\x00\x00\x00\x50\x04\x00\x00\x00\x00\x00\x01\x40\x05\x45\x55\x15\x55\x55\x01\x00"} use strict; '???'; $_[0];},"_overrides_assert_return" => !!0,"coercion" => bless( {"_compiled_type_constraint_check" => sub ;,"display_name" => "to_Item","frozen" => 1,"name" => "__ANON__","type_coercion_map" => [],"type_constraint" => {}}, 'Type::Coercion' ),"compiled_type_constraint" => do{my $o},"constraint" => sub { package Type::Tiny; use warnings; use strict; !0;},"definition_context" => {"file" => "/usr/local/lib/perl5/site_perl/5.44.0/Types/Standard.pm","line" => 226,"package" => "Types::Standard"},"deprecated" => !!0,"display_name" => "Item","exception_class" => "Error::TypeTiny::Assertion","inlined" => sub { package Types::Standard; no warnings; use strict; '!!1';},"library" => "Types::Standard","name" => "Item","parent" => bless( {"_is_core" => 1,"_overload_coderef" => sub { package Sub::Defer; use warnings; use strict; $undeferred ||= undefer_sub($deferred_info->[4]); goto \&$undeferred;},"_overload_coderef_no_rebuild" => 1,"_overrides_assert_return" => !!0,"coercion" => bless( {"_compiled_type_constraint_check" => do{my $o},"display_name" => "to_Any","frozen" => 1,"name" => "__ANON__","type_coercion_map" => [],"type_constraint" => {}}, 'Type::Coercion' ),"compiled_type_constraint" => do{my $o},"complement_name" => "None","constraint" => do{my $o},"definition_context" => {"file" => "/usr/local/lib/perl5/site_perl/5.44.0/Types/Standard.pm","line" => 220,"package" => "Types::Standard"},"deprecated" => !!0,"display_name" => "Any","exception_class" => "Error::TypeTiny::Assertion","inlined" => sub { package Types::Standard; no warnings; use strict; '!!1';},"library" => "Types::Standard","name" => "Any","type_default" => sub { package Types::Standard; no warnings; use strict; return undef;},"uniq" => 1}, 'Type::Tiny' ),"uniq" => 2}, 'Type::Tiny' ),"type_default" => sub { package Types::Standard; no warnings; use strict; return undef;},"uniq" => 6}, 'Type::Tiny' ),"constraint" => sub { package Types::Standard; no warnings; use strict; defined $_;},"definition_context" => {"file" => "/usr/local/lib/perl5/site_perl/5.44.0/Types/Standard.pm","line" => 262,"package" => "Types::Standard"},"deprecated" => !!0,"display_name" => "Defined","exception_class" => "Error::TypeTiny::Assertion","inlined" => sub { package Types::Standard; no warnings; use strict; "defined($_[1])";},"library" => "Types::Standard","name" => "Defined","parent" => {},"uniq" => 7}, 'Type::Tiny' ),"uniq" => 16}, 'Type::Tiny' ),"type_default" => sub { package Types::Standard; no warnings; use strict; return {};},"type_default_generator" => sub { package Types::Standard; no warnings; use strict; return $Type::Tiny::parameterize_type->type_default if @_ < 2; return undef;},"uniq" => 22}, 'Type::Tiny' )],"parent" => bless( {"_is_core" => 1,"_overload_coderef" => sub { package Type::Tiny; BEGIN {${^WARNING_BITS} = "\x10\x01\x00\x00\x00\x50\x04\x00\x00\x00\x00\x00\x01\x40\x05\x45\x55\x15\x55\x55\x01\x00"} use strict; Ref::Util::XS::is_plain_arrayref($_[0]) or _failed_check(21, 'ArrayRef', $_[0], 'exception_class', 'Error::TypeTiny::Assertion'); $_[0];},"_overrides_assert_return" => !!0,"coercion" => bless( {"_compiled_type_constraint_check" => sub ;,"display_name" => "to_ArrayRef","frozen" => 1,"name" => "__ANON__","type_coercion_map" => [],"type_constraint" => {}}, 'Type::Coercion' ),"coercion_generator" => sub { package Types::Standard::ArrayRef; no warnings; use strict; my($parent, $child, $param) = @_; return unless $param->has_coercion; my $coercable_item = $param->coercion->_source_type_union; my $C = 'Type::Coercion'->new('type_constraint', $child); if ($param->coercion->can_be_inlined and $coercable_item->can_be_inlined) { $C->add_type_coercions($parent, &Types::Standard::Stringable(sub { my @code; push @code, 'do { my ($orig, $return_orig, @new) = ($_, 0);'; push @code, 'for (@$orig) {'; push @code, sprintf('++$return_orig && last unless (%s);', $coercable_item->inline_check('$_')); push @code, sprintf('push @new, (%s);', $param->coercion->inline_coercion('$_')); push @code, '}'; push @code, '$return_orig ? $orig : \\@new'; push @code, '}'; join $", @code; } )); } else { $C->add_type_coercions($parent, sub { my $value = @_ ? $_[0] : $_; my @new; foreach my $item (@$value) { return $value unless $coercable_item->check($item); push @new, $param->coerce($item); } return \@new; } ); } return $C;},"compiled_type_constraint" => do{my $o},"constraint" => sub { package Types::Standard; no warnings; use strict; ref $_ eq 'ARRAY';},"constraint_generator" => sub { package Types::Standard::ArrayRef; no warnings; use strict; return &Types::Standard::ArrayRef() unless @_; Type::Tiny::check_parameter_count_for_parameterized_type('Types::Standard', 'ArrayRef', \@_, 3); my $param = shift(); Types::TypeTiny::is_TypeTiny($param) or _croak "Parameter to ArrayRef[`a] expected to be a type constraint; got $param"; my($min, $max) = (0, -1); $min = Types::Standard::assert_Int(shift()) if @_; $max = Types::Standard::assert_Int(shift()) if @_; my $param_compiled_check = $param->compiled_check; my $xsub; if ($min == 0 and $max == -1) { my $paramname = Type::Tiny::XS::is_known($param_compiled_check); $xsub = Type::Tiny::XS::get_coderef_for("ArrayRef[$paramname]") if $paramname; } elsif (&Type::Tiny::_USE_MOUSE() and $param->_has_xsub and $min == 0 and $max == -1) { require Mouse::Util::TypeConstraints; my $maker = 'Mouse::Util::TypeConstraints'->can('_parameterize_ArrayRef_for'); $xsub = &$maker($param) if $maker; } return sub { my $array = shift(); ($param->check($_) or return) foreach (@$array); return !0; } , $xsub if $min == 0 and $max == -1; return sub { my $array = shift(); return if @$array < $min; ($param->check($_) or return) foreach (@$array); return !0; } if $max == -1; return sub { my $array = shift(); return if @$array > $max; ($param->check($_) or return) foreach (@$array); return !0; } if $min == 0; return sub { my $array = shift(); return if @$array < $min; return if @$array > $max; ($param->check($_) or return) foreach (@$array); return !0; } ;},"deep_explanation" => sub { package Types::Standard::ArrayRef; no warnings; use strict; my($type, $value, $varname) = @_; my $param = $type->parameters->[0]; my($min, $max) = (0, -1); $min = $type->parameters->[1] if @{$type->parameters;} > 1; $max = $type->parameters->[2] if @{$type->parameters;} > 2; if ($min != 0 and @$value < $min) { return [sprintf('"%s" constrains array length at least %s', $type, $min), sprintf('@{%s} is %d', $varname, scalar @$value)]; } if ($max > 0 and @$value > $max) { return [sprintf('"%s" constrains array length at most %d', $type, $max), sprintf('@{%s} is %d', $varname, scalar @$value)]; } foreach my $i (0 .. $value->$#*) { my $item = $value->[$i]; next if $param->check($item); return [sprintf('"%s" constrains each value in the array with "%s"', $type, $param), @{$param->validate_explain($item, sprintf('%s->[%d]', $varname, $i));}]; } return;},"definition_context" => {"file" => "/usr/local/lib/perl5/site_perl/5.44.0/Types/Standard.pm","line" => 523,"package" => "Types::Standard"},"deprecated" => !!0,"display_name" => "ArrayRef","exception_class" => "Error::TypeTiny::Assertion","inline_generator" => sub { package Types::Standard::ArrayRef; no warnings; use strict; my $param = shift(); my($min, $max) = (0, -1); $min = shift() if @_; $max = shift() if @_; my $param_compiled_check = $param->compiled_check; my $xsubname; if ($min == 0 and $max == -1) { my $paramname = Type::Tiny::XS::is_known($param_compiled_check); $xsubname = Type::Tiny::XS::get_subname_for("ArrayRef[$paramname]"); } return unless $param->can_be_inlined; return sub { my $v = $_[1]; return "$xsubname($v)" if $xsubname and not $Type::Tiny::AvoidCallbacks; my $p = &Types::Standard::ArrayRef()->inline_check($v); if ($min != 0) { $p .= sprintf(' and @{%s} >= %d', $v, $min); } if ($max > 0) { $p .= sprintf(' and @{%s} <= %d', $v, $max); } my $param_check = $param->inline_check('$i'); return $p if $param->{'uniq'} eq &Types::Standard::Any()->{'uniq'}; "$p and do { " . 'my $ok = 1; ' . "for my \$i (\@{$v}) { " . "(\$ok = 0, last) unless $param_check " . '}; ' . '$ok ' . '}'; } ;},"inlined" => sub { package Types::Standard; no warnings; use strict; !$Type::Tiny::AvoidCallbacks ? "Ref::Util::XS::is_plain_arrayref($_[1])" : "ref($_[1]) eq 'ARRAY'";},"library" => "Types::Standard","name" => "ArrayRef","name_generator" => sub { package Type::Tiny; use warnings; use strict; defined $_ and s/[\x00-\x1F]//gms foreach (my($s, @a) = @_); sprintf '%s[%s]', $s, join(',', map((!defined($_) ? 'undef' : (!ref($_) && /\W/ ? B::perlstring($_) : $_)), @a));},"parent" => {},"type_default" => sub { package Types::Standard; no warnings; use strict; return [];},"type_default_generator" => sub { package Types::Standard; no warnings; use strict; return $Type::Tiny::parameterize_type->type_default if @_ < 2; return undef;},"uniq" => 21}, 'Type::Tiny' ),"type_default" => do{my $o},"uniq" => 44}, 'Type::Tiny' );$v->{"coercion"}{"type_constraint"} = $v;$v->{"compiled_type_constraint"} = $v->{"coercion"}{"_compiled_type_constraint_check"};$v->{"parameters"}[0]{"coercion"}{"type_constraint"} = $v->{"parameters"}[0];$v->{"parameters"}[0]{"compiled_type_constraint"} = $v->{"parameters"}[0]{"coercion"}{"_compiled_type_constraint_check"};$v->{"parameters"}[0]{"parent"}{"coercion"}{"type_constraint"} = $v->{"parameters"}[0]{"parent"};$v->{"parameters"}[0]{"parent"}{"compiled_type_constraint"} = $v->{"parameters"}[0]{"parent"}{"coercion"}{"_compiled_type_constraint_check"};$v->{"parameters"}[0]{"parent"}{"parent"}{"coercion"}{"type_constraint"} = $v->{"parameters"}[0]{"parent"}{"parent"};$v->{"parameters"}[0]{"parent"}{"parent"}{"compiled_type_constraint"} = $v->{"parameters"}[0]{"parent"}{"parent"}{"coercion"}{"_compiled_type_constraint_check"};$v->{"parameters"}[0]{"parent"}{"parent"}{"complementary_type"}{"coercion"}{"type_constraint"} = $v->{"parameters"}[0]{"parent"}{"parent"}{"complementary_type"};$v->{"parameters"}[0]{"parent"}{"parent"}{"complementary_type"}{"compiled_type_constraint"} = $v->{"parameters"}[0]{"parent"}{"parent"}{"complementary_type"}{"coercion"}{"_compiled_type_constraint_check"};$v->{"parameters"}[0]{"parent"}{"parent"}{"complementary_type"}{"complementary_type"} = $v->{"parameters"}[0]{"parent"}{"parent"};$v->{"parameters"}[0]{"parent"}{"parent"}{"complementary_type"}{"parent"}{"coercion"}{"type_constraint"} = $v->{"parameters"}[0]{"parent"}{"parent"}{"complementary_type"}{"parent"};$v->{"parameters"}[0]{"parent"}{"parent"}{"complementary_type"}{"parent"}{"compiled_type_constraint"} = $v->{"parameters"}[0]{"parent"}{"parent"}{"complementary_type"}{"parent"}{"coercion"}{"_compiled_type_constraint_check"};$v->{"parameters"}[0]{"parent"}{"parent"}{"complementary_type"}{"parent"}{"parent"}{"coercion"}{"_compiled_type_constraint_check"} = $v->{"parameters"}[0]{"parent"}{"parent"}{"complementary_type"}{"parent"}{"coercion"}{"_compiled_type_constraint_check"};$v->{"parameters"}[0]{"parent"}{"parent"}{"complementary_type"}{"parent"}{"parent"}{"coercion"}{"type_constraint"} = $v->{"parameters"}[0]{"parent"}{"parent"}{"complementary_type"}{"parent"}{"parent"};$v->{"parameters"}[0]{"parent"}{"parent"}{"complementary_type"}{"parent"}{"parent"}{"compiled_type_constraint"} = $v->{"parameters"}[0]{"parent"}{"parent"}{"complementary_type"}{"parent"}{"coercion"}{"_compiled_type_constraint_check"};$v->{"parameters"}[0]{"parent"}{"parent"}{"complementary_type"}{"parent"}{"parent"}{"constraint"} = $v->{"parameters"}[0]{"parent"}{"parent"}{"complementary_type"}{"parent"}{"constraint"};$v->{"parameters"}[0]{"parent"}{"parent"}{"parent"} = $v->{"parameters"}[0]{"parent"}{"parent"}{"complementary_type"}{"parent"};$v->{"parent"}{"coercion"}{"type_constraint"} = $v->{"parent"};$v->{"parent"}{"compiled_type_constraint"} = $v->{"parent"}{"coercion"}{"_compiled_type_constraint_check"};$v->{"parent"}{"parent"} = $v->{"parameters"}[0]{"parent"};$v->{"type_default"} = $v->{"parent"}{"type_default"}; \$v}->get_message($ast)) |
19 |
7 |
26 |
| Ref::Util::XS::is_plain_hashref($kind2class) or Function::Parameters::_croak('In method from_ast: parameter 2 ($kind2class): ' . ${my $v = bless( {"_is_core" => 1,"_overload_coderef" => sub { package Sub::Defer; use warnings; use strict; $undeferred ||= undefer_sub($deferred_info->[4]); goto \&$undeferred;},"_overload_coderef_no_rebuild" => 1,"_overrides_assert_return" => !!0,"coercion" => bless( {"_compiled_type_constraint_check" => sub ;,"display_name" => "to_HashRef","frozen" => 1,"name" => "__ANON__","type_coercion_map" => [],"type_constraint" => {}}, 'Type::Coercion' ),"coercion_generator" => sub { package Types::Standard::HashRef; no warnings; use strict; my($parent, $child, $param) = @_; return unless $param->has_coercion; my $coercable_item = $param->coercion->_source_type_union; my $C = 'Type::Coercion'->new('type_constraint', $child); if ($param->coercion->can_be_inlined and $coercable_item->can_be_inlined) { $C->add_type_coercions($parent, &Types::Standard::Stringable(sub { my @code; push @code, 'do { my ($orig, $return_orig, %new) = ($_, 0);'; push @code, 'for (keys %$orig) {'; push @code, sprintf('$return_orig++ && last unless (%s);', $coercable_item->inline_check('$orig->{$_}')); push @code, sprintf('$new{$_} = (%s);', $param->coercion->inline_coercion('$orig->{$_}')); push @code, '}'; push @code, '$return_orig ? $orig : \\%new'; push @code, '}'; join $", @code; } )); } else { $C->add_type_coercions($parent, sub { my $value = @_ ? $_[0] : $_; my %new; foreach my $k (keys %$value) { return $value unless $coercable_item->check($value->{$k}); $new{$k} = $param->coerce($value->{$k}); } return \%new; } ); } return $C;},"compiled_type_constraint" => do{my $o},"constraint" => sub { package Types::Standard; no warnings; use strict; ref $_ eq 'HASH';},"constraint_generator" => sub { package Types::Standard::HashRef; no warnings; use strict; return &Types::Standard::HashRef() unless @_; require Error::TypeTiny::WrongNumberOfParameters; Type::Tiny::check_parameter_count_for_parameterized_type('Types::Standard', 'HashRef', \@_, 1); my $param = shift(); Types::TypeTiny::is_TypeTiny($param) or _croak "Parameter to HashRef[`a] expected to be a type constraint; got $param"; my $param_compiled_check = $param->compiled_check; my $xsub; do { my $paramname = Type::Tiny::XS::is_known($param_compiled_check); $xsub = Type::Tiny::XS::get_coderef_for("HashRef[$paramname]") if $paramname }; return sub { my $hash = shift(); ($param->check($_) or return) foreach (values %$hash); return !0; } , $xsub;},"deep_explanation" => sub { package Types::Standard::HashRef; no warnings; use strict; require B; my($type, $value, $varname) = @_; my $param = $type->parameters->[0]; foreach my $k (sort keys %$value) { my $item = $value->{$k}; next if $param->check($item); return [sprintf('"%s" constrains each value in the hash with "%s"', $type, $param), @{$param->validate_explain($item, sprintf('%s->{%s}', $varname, B::perlstring($k)));}]; } return;},"definition_context" => {"file" => "/usr/local/lib/perl5/site_perl/5.44.0/Types/Standard.pm","line" => 544,"package" => "Types::Standard"},"deprecated" => !!0,"display_name" => "HashRef","exception_class" => "Error::TypeTiny::Assertion","inline_generator" => sub { package Types::Standard::HashRef; no warnings; use strict; my $param = shift(); my $compiled = $param->compiled_check; my $xsubname; unless ($Type::Tiny::AvoidCallbacks) { my $paramname = Type::Tiny::XS::is_known($compiled); $xsubname = Type::Tiny::XS::get_subname_for("HashRef[$paramname]"); } return unless $param->can_be_inlined; return sub { my $v = $_[1]; return "$xsubname($v)" if $xsubname and not $Type::Tiny::AvoidCallbacks; my $p = &Types::Standard::HashRef()->inline_check($v); my $param_check = $param->inline_check('$i'); "$p and do { " . 'my $ok = 1; ' . "for my \$i (values %{$v}) { " . "(\$ok = 0, last) unless $param_check " . '}; ' . '$ok ' . '}'; } ;},"inlined" => sub { package Types::Standard; no warnings; use strict; !$Type::Tiny::AvoidCallbacks ? "Ref::Util::XS::is_plain_hashref($_[1])" : "ref($_[1]) eq 'HASH'";},"library" => "Types::Standard","my_methods" => {"hashref_allows_key" => sub { package Types::Standard::HashRef; no warnings; use strict; my $self = shift(); Types::Standard::is_Str($_[0]);},"hashref_allows_value" => sub { package Types::Standard::HashRef; no warnings; use strict; my $self = shift(); my($key, $value) = @_; return !1 unless $self->my_hashref_allows_key($key); return !0 if $self == &Types::Standard::HashRef(); my $href = $self->find_parent(sub { $_->has_parent and $_->parent == &Types::Standard::HashRef(); } ); my $param = $href->type_parameter; Types::Standard::is_Str($key) and $param->check($value);}},"name" => "HashRef","name_generator" => sub { package Type::Tiny; use warnings; use strict; defined $_ and s/[\x00-\x1F]//gms foreach (my($s, @a) = @_); sprintf '%s[%s]', $s, join(',', map((!defined($_) ? 'undef' : (!ref($_) && /\W/ ? B::perlstring($_) : $_)), @a));},"parent" => bless( {"_is_core" => 1,"_overload_coderef" => sub { package Type::Tiny; BEGIN {${^WARNING_BITS} = "\x10\x01\x00\x00\x00\x50\x04\x00\x00\x00\x00\x00\x01\x40\x05\x45\x55\x15\x55\x55\x01\x00"} use strict; not ref $_[0] and _failed_check(16, 'Ref', $_[0], 'exception_class', 'Error::TypeTiny::Assertion'); $_[0];},"_overrides_assert_return" => !!0,"coercion" => bless( {"_compiled_type_constraint_check" => sub ;,"display_name" => "to_Ref","frozen" => 1,"name" => "__ANON__","type_coercion_map" => [],"type_constraint" => {}}, 'Type::Coercion' ),"compiled_type_constraint" => do{my $o},"constraint" => sub { package Types::Standard; no warnings; use strict; ref $_;},"constraint_generator" => sub { package Types::Standard; no warnings; use strict; return $meta->get_type('Ref') unless @_; Type::Tiny::check_parameter_count_for_parameterized_type('Types::Standard', 'Ref', \@_, 1); my $reftype = shift(); $reftype =~ /^(SCALAR|ARRAY|HASH|CODE|REF|GLOB|LVALUE|FORMAT|IO|VSTRING|REGEXP|Regexp)$/i or _croak "Parameter to Ref[`a] expected to be a Perl ref type; got $reftype"; $reftype = "$reftype"; return sub { ref $_[0] and builtin::reftype($_[0]) eq $reftype; } ;},"deep_explanation" => sub { package Types::Standard; no warnings; use strict; require B; my($type, $value, $varname) = @_; my $param = $type->parameters->[0]; return if $type->check($value); my $reftype = builtin::reftype($value); return [sprintf('"%s" constrains reftype(%s) to be equal to %s', $type, $varname, B::perlstring($param)), sprintf('reftype(%s) is %s', $varname, defined $reftype ? B::perlstring($reftype) : 'undef')];},"definition_context" => {"file" => "/usr/local/lib/perl5/site_perl/5.44.0/Types/Standard.pm","line" => 438,"package" => "Types::Standard"},"deprecated" => !!0,"display_name" => "Ref","exception_class" => "Error::TypeTiny::Assertion","inline_generator" => sub { package Types::Standard; no warnings; use strict; my $reftype = shift(); return sub { my $v = $_[1]; &$maybe_load_modules('Scalar::Util', "ref($v) and Scalar::Util::reftype($v) eq q($reftype)"); } ;},"inlined" => sub { package Types::Standard; no warnings; use strict; "!!ref($_[1])";},"library" => "Types::Standard","name" => "Ref","parent" => bless( {"_is_core" => 1,"_overload_coderef" => sub { package Type::Tiny; BEGIN {${^WARNING_BITS} = "\x10\x01\x00\x00\x00\x50\x04\x00\x00\x00\x00\x00\x01\x40\x05\x45\x55\x15\x55\x55\x01\x00"} use strict; defined $_[0] or _failed_check(7, 'Defined', $_[0], 'exception_class', 'Error::TypeTiny::Assertion'); $_[0];},"_overrides_assert_return" => !!0,"coercion" => bless( {"_compiled_type_constraint_check" => sub ;,"display_name" => "to_Defined","frozen" => 1,"name" => "__ANON__","type_coercion_map" => [],"type_constraint" => {}}, 'Type::Coercion' ),"compiled_type_constraint" => do{my $o},"complementary_type" => bless( {"_is_core" => 1,"_overload_coderef" => sub { package Type::Tiny; BEGIN {${^WARNING_BITS} = "\x10\x01\x00\x00\x00\x50\x04\x00\x00\x00\x00\x00\x01\x40\x05\x45\x55\x15\x55\x55\x01\x00"} use strict; defined $_[0] and _failed_check(6, 'Undef', $_[0], 'exception_class', 'Error::TypeTiny::Assertion'); $_[0];},"_overrides_assert_return" => !!0,"coercion" => bless( {"_compiled_type_constraint_check" => sub ;,"display_name" => "to_Undef","frozen" => 1,"name" => "__ANON__","type_coercion_map" => [],"type_constraint" => {}}, 'Type::Coercion' ),"compiled_type_constraint" => do{my $o},"complementary_type" => {},"constraint" => sub { package Types::Standard; no warnings; use strict; not defined $_;},"definition_context" => {"file" => "/usr/local/lib/perl5/site_perl/5.44.0/Types/Standard.pm","line" => 254,"package" => "Types::Standard"},"deprecated" => !!0,"display_name" => "Undef","exception_class" => "Error::TypeTiny::Assertion","inlined" => sub { package Types::Standard; no warnings; use strict; "!defined($_[1])";},"library" => "Types::Standard","name" => "Undef","parent" => bless( {"_is_core" => 1,"_overload_coderef" => sub { package Type::Tiny; BEGIN {${^WARNING_BITS} = "\x10\x01\x00\x00\x00\x50\x04\x00\x00\x00\x00\x00\x01\x40\x05\x45\x55\x15\x55\x55\x01\x00"} use strict; '???'; $_[0];},"_overrides_assert_return" => !!0,"coercion" => bless( {"_compiled_type_constraint_check" => sub ;,"display_name" => "to_Item","frozen" => 1,"name" => "__ANON__","type_coercion_map" => [],"type_constraint" => {}}, 'Type::Coercion' ),"compiled_type_constraint" => do{my $o},"constraint" => sub { package Type::Tiny; use warnings; use strict; !0;},"definition_context" => {"file" => "/usr/local/lib/perl5/site_perl/5.44.0/Types/Standard.pm","line" => 226,"package" => "Types::Standard"},"deprecated" => !!0,"display_name" => "Item","exception_class" => "Error::TypeTiny::Assertion","inlined" => sub { package Types::Standard; no warnings; use strict; '!!1';},"library" => "Types::Standard","name" => "Item","parent" => bless( {"_is_core" => 1,"_overload_coderef" => sub { package Sub::Defer; use warnings; use strict; $undeferred ||= undefer_sub($deferred_info->[4]); goto \&$undeferred;},"_overload_coderef_no_rebuild" => 1,"_overrides_assert_return" => !!0,"coercion" => bless( {"_compiled_type_constraint_check" => do{my $o},"display_name" => "to_Any","frozen" => 1,"name" => "__ANON__","type_coercion_map" => [],"type_constraint" => {}}, 'Type::Coercion' ),"compiled_type_constraint" => do{my $o},"complement_name" => "None","constraint" => do{my $o},"definition_context" => {"file" => "/usr/local/lib/perl5/site_perl/5.44.0/Types/Standard.pm","line" => 220,"package" => "Types::Standard"},"deprecated" => !!0,"display_name" => "Any","exception_class" => "Error::TypeTiny::Assertion","inlined" => sub { package Types::Standard; no warnings; use strict; '!!1';},"library" => "Types::Standard","name" => "Any","type_default" => sub { package Types::Standard; no warnings; use strict; return undef;},"uniq" => 1}, 'Type::Tiny' ),"uniq" => 2}, 'Type::Tiny' ),"type_default" => sub { package Types::Standard; no warnings; use strict; return undef;},"uniq" => 6}, 'Type::Tiny' ),"constraint" => sub { package Types::Standard; no warnings; use strict; defined $_;},"definition_context" => {"file" => "/usr/local/lib/perl5/site_perl/5.44.0/Types/Standard.pm","line" => 262,"package" => "Types::Standard"},"deprecated" => !!0,"display_name" => "Defined","exception_class" => "Error::TypeTiny::Assertion","inlined" => sub { package Types::Standard; no warnings; use strict; "defined($_[1])";},"library" => "Types::Standard","name" => "Defined","parent" => {},"uniq" => 7}, 'Type::Tiny' ),"uniq" => 16}, 'Type::Tiny' ),"type_default" => sub { package Types::Standard; no warnings; use strict; return {};},"type_default_generator" => sub { package Types::Standard; no warnings; use strict; return $Type::Tiny::parameterize_type->type_default if @_ < 2; return undef;},"uniq" => 22}, 'Type::Tiny' );$v->{"coercion"}{"type_constraint"} = $v;$v->{"compiled_type_constraint"} = $v->{"coercion"}{"_compiled_type_constraint_check"};$v->{"parent"}{"coercion"}{"type_constraint"} = $v->{"parent"};$v->{"parent"}{"compiled_type_constraint"} = $v->{"parent"}{"coercion"}{"_compiled_type_constraint_check"};$v->{"parent"}{"parent"}{"coercion"}{"type_constraint"} = $v->{"parent"}{"parent"};$v->{"parent"}{"parent"}{"compiled_type_constraint"} = $v->{"parent"}{"parent"}{"coercion"}{"_compiled_type_constraint_check"};$v->{"parent"}{"parent"}{"complementary_type"}{"coercion"}{"type_constraint"} = $v->{"parent"}{"parent"}{"complementary_type"};$v->{"parent"}{"parent"}{"complementary_type"}{"compiled_type_constraint"} = $v->{"parent"}{"parent"}{"complementary_type"}{"coercion"}{"_compiled_type_constraint_check"};$v->{"parent"}{"parent"}{"complementary_type"}{"complementary_type"} = $v->{"parent"}{"parent"};$v->{"parent"}{"parent"}{"complementary_type"}{"parent"}{"coercion"}{"type_constraint"} = $v->{"parent"}{"parent"}{"complementary_type"}{"parent"};$v->{"parent"}{"parent"}{"complementary_type"}{"parent"}{"compiled_type_constraint"} = $v->{"parent"}{"parent"}{"complementary_type"}{"parent"}{"coercion"}{"_compiled_type_constraint_check"};$v->{"parent"}{"parent"}{"complementary_type"}{"parent"}{"parent"}{"coercion"}{"_compiled_type_constraint_check"} = $v->{"parent"}{"parent"}{"complementary_type"}{"parent"}{"coercion"}{"_compiled_type_constraint_check"};$v->{"parent"}{"parent"}{"complementary_type"}{"parent"}{"parent"}{"coercion"}{"type_constraint"} = $v->{"parent"}{"parent"}{"complementary_type"}{"parent"}{"parent"};$v->{"parent"}{"parent"}{"complementary_type"}{"parent"}{"parent"}{"compiled_type_constraint"} = $v->{"parent"}{"parent"}{"complementary_type"}{"parent"}{"coercion"}{"_compiled_type_constraint_check"};$v->{"parent"}{"parent"}{"complementary_type"}{"parent"}{"parent"}{"constraint"} = $v->{"parent"}{"parent"}{"complementary_type"}{"parent"}{"constraint"};$v->{"parent"}{"parent"}{"parent"} = $v->{"parent"}{"parent"}{"complementary_type"}{"parent"}; \$v}->get_message($kind2class)) |
0 |
2 |
2 |
|
| 241 |
2 |
| DEBUG and _debug('Schema.from_ast', $ast); |
| 242 |
10 |
| my @type_nodes = grep $kind2class->{$_->{kind}}, @$ast; |
| 243 |
2 |
| my ($schema_node, $e) = grep $_->{kind} eq 'schema', @$ast; |
| 244 |
348 |
▶ | die "Must provide only one schema definition.\n" if $e; |
Branch: 1 branch
| Branch | True | False | Total |
| if $e |
0 |
2 |
2 |
|
| 245 |
348 |
| my %name2type = (map { $_->name => $_ } GraphQL::Plugin::Type->registered); |
| 246 |
348 |
| for (@type_nodes) { |
| 247 |
|
| die "Type '$_->{name}' was defined more than once.\n" |
| 248 |
348 |
▶ | if $name2type{$_->{name}}; |
Branch: 1 branch
| Branch | True | False | Total |
| if $name2type{$_->{"name"}} |
0 |
348 |
348 |
|
| 249 |
17 |
| require_module $kind2class->{$_->{kind}}; |
| 250 |
17 |
| $name2type{$_->{name}} = $kind2class->{$_->{kind}}->from_ast(\%name2type, $_); |
| 251 |
|
| } |
| 252 |
17 |
▶ | if (!$schema_node) { |
Branch: 1 branch
| Branch | True | False | Total |
| unless ($schema_node) |
0 |
348 |
348 |
|
| 253 |
|
| # infer one |
| 254 |
|
| $schema_node = +{ |
| 255 |
17 |
▶ | map { $name2type{ucfirst $_} ? ($_ => ucfirst $_) : () } @TYPE_ATTRS |
Branch: 1 branch
| Branch | True | False | Total |
| $name2type{ucfirst $_} ? : |
348 |
0 |
348 |
|
| 256 |
|
| }; |
| 257 |
|
| } |
| 258 |
|
| die "Must provide schema definition with query type or a type named Query.\n" |
| 259 |
17 |
▶ | unless $schema_node->{query}; |
Branch: 1 branch
| Branch | True | False | Total |
| unless $schema_node->{"query"} |
348 |
0 |
348 |
|
| 260 |
|
| my @directives = map GraphQL::Directive->from_ast(\%name2type, $_), |
| 261 |
17 |
| grep $_->{kind} eq 'directive', @$ast; |
| 262 |
|
| my $schema = $self->new( |
| 263 |
|
| (map { |
| 264 |
17 |
| $schema_node->{$_} |
| 265 |
17 |
| ? ($_ => $name2type{$schema_node->{$_}} |
| 266 |
|
| // die "Specified $_ type '$schema_node->{$_}' not found.\n") |
| 267 |
|
| : () |
| 268 |
|
| } @TYPE_ATTRS), |
| 269 |
|
| (@directives ? (directives => [ @GraphQL::Directive::SPECIFIED_DIRECTIVES, @directives ]) : ()), |
| 270 |
|
| types => [ values %name2type ], |
| 271 |
|
| ); |
| 272 |
17 |
| $schema->name2type; # walks all types, fields, args - finds undefined types |
| 273 |
17 |
| $schema; |
| 274 |
17 |
▶ | } |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
|
| 275 |
|
| |
| 276 |
|
| =head2 from_doc($doc[, \%kind2class]) |
| 277 |
|
| |
| 278 |
|
| Class method. Takes text that is a Schema Definition Language (SDL) (aka |
| 279 |
|
| Interface Definition Language) document and returns a schema object. Will |
| 280 |
|
| not be a complete schema since it will have only default resolvers. |
| 281 |
|
| |
| 282 |
|
| As of v0.32, this accepts both old-style "meaningful comments" and |
| 283 |
|
| new-style string values, as field or type descriptions. |
| 284 |
|
| |
| 285 |
|
| If C<\%kind2class> is given, it will override the default |
| 286 |
|
| mapping of SDL keywords to Perl classes. This is probably most |
| 287 |
|
| useful for L<GraphQL::Type::Object>. The default is available as |
| 288 |
|
| C<%GraphQL::Schema::KIND2CLASS>. |
| 289 |
|
| |
| 290 |
|
| =cut |
| 291 |
|
| |
| 292 |
56 |
▶ | method from_doc( |
|
Subroutine
from_doc: called CC=6 SCAR=17.9
Pod
documented
|
| 293 |
|
| Str $doc, |
| 294 |
|
| HashRef $kind2class = \%KIND2CLASS, |
| 295 |
17 |
| ) :ReturnType(InstanceOf[__PACKAGE__]) { |
| 296 |
17 |
| $self->from_ast(parse($doc), $kind2class); |
| 297 |
17 |
▶ | } |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
|
| 298 |
|
| |
| 299 |
|
| =head2 to_doc($doc) |
| 300 |
|
| |
| 301 |
|
| Returns Schema Definition Language (SDL) document that describes this |
| 302 |
|
| schema object. |
| 303 |
|
| |
| 304 |
|
| As of v0.32, this produces the new-style descriptions that are string |
| 305 |
|
| values, rather than old-style "meaningful comments". |
| 306 |
|
| |
| 307 |
|
| As of v0.33, will not return a description of types supplied with the |
| 308 |
|
| attribute L</types>. Obviously, by default this includes types returned |
| 309 |
|
| by L<GraphQL::Plugin::Type/registered>. |
| 310 |
|
| |
| 311 |
|
| =cut |
| 312 |
|
| |
| 313 |
|
| has to_doc => (is => 'lazy', isa => Str); |
| 314 |
|
| my %directive2builtin = map { ($_=>1) } @GraphQL::Directive::SPECIFIED_DIRECTIVES; |
| 315 |
26 |
▶ | sub _build_to_doc { |
|
Subroutine
_build_to_doc: called CC=2 SCAR=6.9
|
| 316 |
17 |
| my ($self) = @_; |
| 317 |
17 |
| my $schema_doc; |
| 318 |
51 |
| if (grep $self->$_->name ne ucfirst $_, grep $self->$_, @TYPE_ATTRS) { |
| 319 |
17 |
| $schema_doc = join('', map "$_\n", "schema {", |
| 320 |
17 |
| (map " $_: @{[$self->$_->name]}", grep $self->$_, @TYPE_ATTRS), |
| 321 |
|
| "}"); |
| 322 |
|
| } |
| 323 |
17 |
| my %supplied_type = (map {$_->name => 1} GraphQL::Plugin::Type->registered); |
| 324 |
|
| join "\n", grep defined, |
| 325 |
|
| $schema_doc, |
| 326 |
|
| (map $_->to_doc, |
| 327 |
|
| sort { $a->name cmp $b->name } |
| 328 |
|
| grep !$directive2builtin{$_}, |
| 329 |
|
| @{ $self->directives }), |
| 330 |
|
| (map $self->name2type->{$_}->to_doc, |
| 331 |
|
| grep !/^__/, |
| 332 |
|
| grep $CLASS2KIND{ref $self->name2type->{$_}}, |
| 333 |
|
| grep !$supplied_type{$_}, |
| 334 |
17 |
| sort keys %{$self->name2type}), |
| 335 |
|
| ; |
| 336 |
|
| } |
| 337 |
|
| |
| 338 |
|
| =head2 name2directive |
| 339 |
|
| |
| 340 |
|
| In this schema, returns a hash-ref mapping all directives' names to their |
| 341 |
|
| directive object. |
| 342 |
|
| |
| 343 |
|
| =cut |
| 344 |
|
| |
| 345 |
|
| has name2directive => (is => 'lazy', isa => Map[StrNameValid, InstanceOf['GraphQL::Directive']]); |
| 346 |
2 |
▶ | method _build_name2directive() { |
|
Subroutine
_build_name2directive: called CC=3 SCAR=11.0
|
| 347 |
|
| +{ map { ($_->name => $_) } @{ $self->directives } }; |
| 348 |
|
| } |
| 349 |
|
| |
| 350 |
|
| =head1 FUNCTIONS |
| 351 |
|
| |
| 352 |
|
| =head2 lookup_type($typedef, $name2type) |
| 353 |
|
| |
| 354 |
|
| Turns given AST fragment into a type. |
| 355 |
|
| |
| 356 |
|
| If the hash-ref's C<type> member is a string, will return a type of that name. |
| 357 |
|
| |
| 358 |
|
| If an array-ref, first element must be either C<list> or C<non_null>, |
| 359 |
|
| second will be a recursive AST fragment, which will be passed into a |
| 360 |
|
| recursive call. The result will then have the modifier method (C<list> |
| 361 |
|
| or C<non_null>) called, and that will be returned. |
| 362 |
|
| |
| 363 |
|
| =cut |
| 364 |
|
| |
| 365 |
348 |
▶ | fun lookup_type( |
|
Subroutine
lookup_type: called CC=15 SCAR=27.1
Pod
documented
|
| 366 |
|
| HashRef $typedef, |
| 367 |
|
| (Map[StrNameValid, InstanceOf['GraphQL::Type']]) $name2type, |
| 368 |
|
| ) :ReturnType(InstanceOf['GraphQL::Type']) { |
| 369 |
|
| my $type = $typedef->{type}; |
| 370 |
|
| die "Undefined type given\n" if !defined $type; |
| 371 |
|
| return $name2type->{$type} // die "Unknown type '$type'.\n" |
| 372 |
|
| if is_Str($type); |
| 373 |
|
| my ($wrapper_type, $wrapped) = @$type; |
| 374 |
|
| lookup_type($wrapped, $name2type)->$wrapper_type; |
| 375 |
17 |
▶ | } |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
|
| 376 |
|
| |
| 377 |
|
| __PACKAGE__->meta->make_immutable(); |
| 378 |
|
| |
| 379 |
|
| 1; |