line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
|
2
|
|
|
|
|
|
|
use 5.014; |
3
|
6
|
|
|
6
|
|
184141
|
use strict; |
|
6
|
|
|
|
|
39
|
|
4
|
6
|
|
|
6
|
|
48
|
use warnings; |
|
6
|
|
|
|
|
11
|
|
|
6
|
|
|
|
|
131
|
|
5
|
6
|
|
|
6
|
|
28
|
use Moo; |
|
6
|
|
|
|
|
9
|
|
|
6
|
|
|
|
|
152
|
|
6
|
6
|
|
|
6
|
|
1023
|
use Types::Standard -all; |
|
6
|
|
|
|
|
19029
|
|
|
6
|
|
|
|
|
35
|
|
7
|
6
|
|
|
6
|
|
4939
|
use GraphQL::MaybeTypeCheck; |
|
6
|
|
|
|
|
130681
|
|
|
6
|
|
|
|
|
69
|
|
8
|
6
|
|
|
6
|
|
243775
|
extends qw(GraphQL::Type); |
|
6
|
|
|
|
|
15
|
|
|
6
|
|
|
|
|
47
|
|
9
|
|
|
|
|
|
|
with qw( |
10
|
|
|
|
|
|
|
GraphQL::Role::Output |
11
|
|
|
|
|
|
|
GraphQL::Role::Composite |
12
|
|
|
|
|
|
|
GraphQL::Role::Abstract |
13
|
|
|
|
|
|
|
GraphQL::Role::Nullable |
14
|
|
|
|
|
|
|
GraphQL::Role::Named |
15
|
|
|
|
|
|
|
GraphQL::Role::FieldsOutput |
16
|
|
|
|
|
|
|
GraphQL::Role::FieldsEither |
17
|
|
|
|
|
|
|
); |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
our $VERSION = '0.02'; |
20
|
|
|
|
|
|
|
use constant DEBUG => $ENV{GRAPHQL_DEBUG}; |
21
|
6
|
|
|
6
|
|
5247
|
|
|
6
|
|
|
|
|
10
|
|
|
6
|
|
|
|
|
560
|
|
22
|
|
|
|
|
|
|
=head1 NAME |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
GraphQL::Type::Interface - GraphQL interface type |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
=head1 SYNOPSIS |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
use GraphQL::Type::Interface; |
29
|
|
|
|
|
|
|
my $ImplementingType; |
30
|
|
|
|
|
|
|
my $InterfaceType = GraphQL::Type::Interface->new( |
31
|
|
|
|
|
|
|
name => 'Interface', |
32
|
|
|
|
|
|
|
fields => { field_name => { type => $scalar_type } }, |
33
|
|
|
|
|
|
|
resolve_type => sub { |
34
|
|
|
|
|
|
|
return $ImplementingType; |
35
|
|
|
|
|
|
|
}, |
36
|
|
|
|
|
|
|
); |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
=head1 ATTRIBUTES |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
Has C<name>, C<description> from L<GraphQL::Role::Named>. |
41
|
|
|
|
|
|
|
Has C<fields> from L<GraphQL::Role::FieldsOutput>. |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
=head2 resolve_type |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
Optional code-ref to resolve types. |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
=cut |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
has resolve_type => (is => 'ro', isa => CodeRef); |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
method from_ast( |
52
|
|
|
|
|
|
|
HashRef $name2type, |
53
|
|
|
|
|
|
|
HashRef $ast_node, |
54
|
|
|
|
|
|
|
) :ReturnType(InstanceOf[__PACKAGE__]) { |
55
|
4
|
50
|
|
4
|
1
|
19
|
$self->new( |
|
4
|
50
|
|
|
|
398
|
|
|
4
|
50
|
|
|
|
11
|
|
|
4
|
50
|
|
|
|
8
|
|
|
4
|
|
|
|
|
19
|
|
|
4
|
|
|
|
|
85
|
|
|
4
|
|
|
|
|
29
|
|
56
|
4
|
|
|
|
|
17
|
$self->_from_ast_named($ast_node), |
57
|
|
|
|
|
|
|
$self->_from_ast_fields($name2type, $ast_node, 'fields'), |
58
|
|
|
|
|
|
|
); |
59
|
|
|
|
|
|
|
} |
60
|
6
|
|
|
6
|
|
1450
|
|
|
6
|
|
|
|
|
17
|
|
|
6
|
|
|
|
|
41
|
|
61
|
|
|
|
|
|
|
has to_doc => (is => 'lazy', isa => Str); |
62
|
|
|
|
|
|
|
my ($self) = @_; |
63
|
|
|
|
|
|
|
DEBUG and _debug('Interface.to_doc', $self); |
64
|
4
|
|
|
4
|
|
278
|
my @fieldlines = map { |
65
|
4
|
|
|
|
|
8
|
my ($main, @description) = @$_; |
66
|
|
|
|
|
|
|
( |
67
|
4
|
|
|
|
|
66
|
@description, |
|
4
|
|
|
|
|
15
|
|
68
|
|
|
|
|
|
|
$main, |
69
|
4
|
|
|
|
|
12
|
) |
70
|
|
|
|
|
|
|
} $self->_make_fieldtuples($self->fields); |
71
|
|
|
|
|
|
|
join '', map "$_\n", |
72
|
|
|
|
|
|
|
$self->_description_doc_lines($self->description), |
73
|
4
|
50
|
|
|
|
20
|
"interface @{[$self->name]} {", |
74
|
|
|
|
|
|
|
(map length() ? " $_" : "", @fieldlines), |
75
|
4
|
|
|
|
|
105
|
"}"; |
76
|
|
|
|
|
|
|
} |
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
__PACKAGE__->meta->make_immutable(); |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
1; |