blib/lib/DBIx/Class/Schema/GraphQL.pm

filter: Statementstmt 13.7% 43 / 312 Branchbran 5.8% 6 / 102 Conditioncond 6.2% 2 / 32 MC/DCmcdc 5.2% 1 / 19 Subroutinesub 32.4% 12 / 37 Podpod 100% 1 / 1 totaltotal 12.9% 65 / 503 CC 78 SCAR 41.6
CC
78
Cov
11%
_apply_pagination
240.0
_filter_to_dbic
156.0
__ANON__
56.0
CRAP 63.9
↑ Summary
1 package DBIx::Class::Schema::GraphQL;
2  
3 7 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 7 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 7 ▶use version;
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7 7 our $VERSION = qv('v0.0.2');
8 7 our $AUTHORITY = 'cpan:MANWAR';
9  
10 =head1 NAME
11  
12 DBIx::Class::Schema::GraphQL - Auto-generate a GraphQL schema from a DBIx::Class schema
13  
14 =head1 VERSION
15  
16 Version v0.0.2
17  
18 =cut
19  
20 7 ▶use MIME::Base64 qw(encode_base64 decode_base64);
Subroutine BEGIN: called CC=1 SCAR=0.0
21  
22 7 ▶use GraphQL::Schema;
Subroutine BEGIN: called CC=1 SCAR=0.0
23 7 ▶use GraphQL::Type::Object;
Subroutine BEGIN: called CC=1 SCAR=0.0
24 7 ▶use GraphQL::Type::InputObject;
Subroutine BEGIN: called CC=1 SCAR=0.0
25 7 ▶use GraphQL::Type::List;
Subroutine BEGIN: called CC=1 SCAR=0.0
26 7 ▶use GraphQL::Type::NonNull;
Subroutine BEGIN: called CC=1 SCAR=0.0
27 7 ▶use GraphQL::Type::Enum;
Subroutine BEGIN: called CC=1 SCAR=0.0
28 7 ▶use GraphQL::Type::Scalar qw($Int $String $Float $Boolean);
Subroutine BEGIN: called CC=1 SCAR=0.0
29  
30 =head1 SYNOPSIS
31  
32 use DBIx::Class::Schema::GraphQL;
33 use GraphQL::Execution qw(execute);
34  
35 my $db = My::Schema->connect(...);
36 my $result = DBIx::Class::Schema::GraphQL->to_graphql($db);
37  
38 # Simple plural query - always include at least one scalar field
39 # alongside nodes (e.g. total) - see KNOWN BEHAVIOUR below.
40 execute($result->{schema},
41 '{ allBooks { total nodes { title } } }',
42 undef, $result->{context});
43  
44 # Filtered + paginated + ordered
45 execute($result->{schema}, '
46 query {
47 allBooks(
48 filter: { title_like: "%Perl%" }
49 orderBy: { field: "title", direction: ASC }
50 page: { skip: 0, take: 5 }
51 ) {
52 total
53 hasNextPage
54 nodes { id title }
55 }
56 }', undef, $result->{context});
57  
58 # Cursor pagination
59 execute($result->{schema}, '
60 query($after: String) {
61 allBooks(cursor: { after: $after, first: 5 }) {
62 total
63 nextCursor
64 hasNextPage
65 nodes { id title }
66 }
67 }', undef, $result->{context}, { after => $cursor });
68  
69 # Mutation: Full update (all non-key columns)
70 execute($result->{schema},
71 'mutation { createBook(title: "Dune", author_id: 4) { id title } }',
72 undef, $result->{context});
73  
74 # Mutation: Sparse update (only supplied columns are changed)
75 execute($result->{schema},
76 'mutation { patchBook(id: 1, title: "Dune Messiah") { id title } }',
77 undef, $result->{context});
78  
79 =head1 DESCRIPTION
80  
81 Introspects every source registered with the supplied L<DBIx::Class::Schema>
82 and builds a complete, executable L<GraphQL::Schema> with:
83  
84 =over 4
85  
86 =item * One scalar field per column, typed as C<Int>, C<Float>, C<Boolean>,
87 or C<String> based on the column's declared C<data_type>.
88  
89 =item * One relationship field per DBIC relationship (C<has_many> resolves to
90 a List type; C<belongs_to> / C<might_have> resolve to a single object type).
91  
92 =item * A root C<Query> type with singular lookup and plural
93 C<allE<lt>SourceE<gt>s> queries supporting filtering, ordering, and both
94 offset and cursor pagination.
95  
96 =item * A root C<Mutation> type with C<createX>, C<updateX>, C<patchX>, and
97 C<deleteX> entry points for every source.
98  
99 =back
100  
101 Composite primary keys are fully supported throughout.
102  
103 =head1 METHODS
104  
105 =head2 to_graphql
106  
107 my $result = DBIx::Class::Schema::GraphQL->to_graphql($db);
108  
109 Class method. Accepts a connected L<DBIx::Class::Schema> instance.
110 Returns a hashref:
111  
112 {
113 schema => $graphql_schema, # GraphQL::Schema, pass to execute()
114 context => $db, # the original schema, for convenience
115 }
116  
117 =cut
118  
119 sub to_graphql {
120 0 ▶ my ($class, $db) = @_;
Subroutine to_graphql: not called CC=4 SCAR=30.0
Pod documented
121  
122 0 my $shared = _build_shared_types();
123  
124 # Phase 1: Shell types
125 0 my %gql_types;
126 0 for my $moniker ($db->sources) {
127 $gql_types{$moniker} = GraphQL::Type::Object->new(
128 name => $moniker,
129 description => "Auto-generated GraphQL type for DBIx::Class source '$moniker'",
130 0 ▶ fields => sub { {} },
Subroutine __ANON__: not called CC=1 SCAR=6.9
131 0 );
132 }
133  
134 # Phase 2: Real fields (safe because %gql_types is fully populated)
135 0 for my $moniker ($db->sources) {
136 0 my $source_obj = $db->source($moniker);
137 0 my $this_moniker = $moniker;
138 0 my %types_snapshot = %gql_types;
139  
140 $gql_types{$moniker}->{fields} = sub {
141 0 ▶ my %fields;
Subroutine __ANON__: not called CC=7 SCAR=40.3
142  
143 0 for my $col ($source_obj->columns) {
144 0 $fields{$col} = { type => _scalar_for_column($source_obj, $col) };
145 }
146  
147 0 for my $rel ($source_obj->relationships) {
148 0 my $rel_info = $source_obj->relationship_info($rel);
149 0 my $target_moniker = $rel_info->{source};
150 0 $target_moniker =~ s/^.*:://;
151  
152 0 ▶ my $target_type = $types_snapshot{$target_moniker} or next;
Branch: 1 branch
BranchTrueFalseTotal
my $target_type = $types_snapshot{$target_moniker} or next 0 0 0
153  
154 my $is_plural = (
155 $rel_info->{attrs}{accessor}
156 0 ▶ && $rel_info->{attrs}{accessor} eq 'multi'
Branch: 1 branch
BranchTrueFalseTotal
$rel_info->{'attrs'}{'accessor'} && $rel_info->{'attrs'}{'accessor'} eq 'multi' ? : 0 0 0
Condition0%0/3
$rel_info->{"attrs"}{"accessor"} and $rel_info->{"attrs"}{"accessor"} eq "multi"
!ll&&!rl&&r
000
MC/DC0%0/2
$rel_info->{"attrs"}{"accessor"} and $rel_info->{"attrs"}{"accessor"} eq "multi"
$rel_info->{"attrs"}{"accessor"} $rel_info->{"attrs"}{"accessor"} eq "multi"
Truth table0%0/3
A and B
A= $rel_info->{"attrs"}{"accessor"}B= $rel_info->{"attrs"}{"accessor"} eq "multi"
ABresult
0X0
100
111
157 ) ? 1 : 0;
158  
159 0 my ($captured_rel, $captured_moniker, $captured_plural)
160 = ($rel, $this_moniker, $is_plural);
161  
162 $fields{$rel} = {
163 type => $is_plural
164 ? GraphQL::Type::List->new(of => $target_type)
165 : $target_type,
166 resolve => sub {
167 0 ▶ my ($row, $args, $ctx) = @_;
Subroutine __ANON__: not called CC=5 SCAR=34.0
168 0 ▶ if (ref($row) eq 'HASH') {
Branch: 1 branch
BranchTrueFalseTotal
if (ref $row eq "HASH") 0 0 0
169 0 ▶ $row = _pk_find($ctx, $captured_moniker, $row) or return;
Branch: 1 branch
BranchTrueFalseTotal
$row = _pk_find($ctx, $captured_moniker, $row) or return 0 0 0
170 }
171 0 ▶ if ($captured_plural) {
Branch: 1 branch
BranchTrueFalseTotal
if ($captured_plural) { } 0 0 0
172 return [
173 0 map { { $_->get_columns } }
174 $row->$captured_rel->all
175 ];
176 }
177 else {
178 0 my $related = $row->$captured_rel;
179 0 ▶ return $related ? { $related->get_columns } : undef;
Branch: 1 branch
BranchTrueFalseTotal
$related ? : 0 0 0
180 }
181 },
182 0 ▶ };
Branch: 1 branch
BranchTrueFalseTotal
$is_plural ? : 0 0 0
183 }
184  
185 0 return \%fields;
186 0 };
187 }
188  
189 # Phase 3: Root Query + Mutation types
190 0 my (%query_fields, %mutation_fields);
191  
192 0 for my $moniker ($db->sources) {
193 0 my $graphql_type = $gql_types{$moniker};
194 0 my $source_obj = $db->source($moniker);
195 0 my $singular_args = _build_singular_args($source_obj);
196 0 my $filter_type = _build_filter_type($source_obj, $moniker);
197 0 my $connection_type = _build_connection_type($moniker, $graphql_type);
198  
199 # Singular query
200 $query_fields{ lcfirst($moniker) } = {
201 type => $graphql_type,
202 args => $singular_args,
203 resolve => sub {
204 0 ▶ my ($root, $args, $ctx) = @_;
Subroutine __ANON__: not called CC=3 SCAR=24.8
205 0 ▶ return unless grep { defined $args->{$_} } keys %$singular_args;
Branch: 1 branch
BranchTrueFalseTotal
unless grep {defined $args->{$_};} keys %$singular_args 0 0 0
206 0 my $row = $ctx->resultset($moniker)->find($args);
207 0 ▶ return $row ? { $row->get_columns } : undef;
Branch: 1 branch
BranchTrueFalseTotal
$row ? : 0 0 0
208 },
209 0 };
210  
211 # Plural query with filter + pagination + ordering
212 $query_fields{ 'all' . ucfirst($moniker) . 's' } = {
213 type => $connection_type,
214 description => "Fetch a filtered, paginated, ordered list of $moniker rows.",
215 args => {
216 filter => { type => $filter_type,
217 description => "Column filters with exact, comparison, and logical operators." },
218 page => { type => $shared->{page_input},
219 description => "Offset pagination: skip N rows, take M rows." },
220 cursor => { type => $shared->{cursor_input},
221 description => "Cursor pagination: fetch first N rows after a cursor." },
222 orderBy => { type => $shared->{order_by_input},
223 description => "Order results by a column, ASC or DESC." },
224 },
225 resolve => sub {
226 0 ▶ my ($root, $args, $ctx) = @_;
Subroutine __ANON__: not called CC=5 SCAR=34.0
227 0 ▶ $args //= {};
Condition0%0/2
$args //= {}
l!l
00
MC/DC0%0/1
$args //= {}
$args
Truth table0%0/2
A
A= $args
Aresult
11
00
228  
229 # Build the base filtered resultset
230 0 my $rs = $ctx->resultset($moniker);
231 0 ▶ if (my $filter = $args->{filter}) {
Branch: 1 branch
BranchTrueFalseTotal
if (my $filter = $args->{"filter"}) 0 0 0
232 0 my $cond = _filter_to_dbic($filter, $ctx->source($moniker));
233 0 ▶ $rs = $rs->search($cond) if $cond && %$cond;
Branch: 1 branch
BranchTrueFalseTotal
if $cond and %$cond 0 0 0
Condition0%0/3
$cond and %$cond
!ll&&!rl&&r
000
MC/DC0%0/2
$cond and %$cond
$cond %$cond
Truth table0%0/3
A and B
A= $condB= %$cond
ABresult
0X0
100
111
234 }
235  
236 # Clone the rs for counting so pagination does not
237 # affect the count query and vice-versa.
238 0 my $count_rs = $rs->search_rs({});
239 0 my $total = $count_rs->count;
240  
241 0 my ($nodes, $next_cursor, $has_next) =
242 _apply_pagination($rs, $args, $ctx->source($moniker));
243  
244 return {
245 0 nodes => $nodes,
246 total => $total,
247 nextCursor => $next_cursor,
248 hasNextPage => $has_next,
249 };
250 },
251 0 };
252  
253 # Mutations
254 0 %mutation_fields = (
255 %mutation_fields,
256 _build_mutation_fields($source_obj, $moniker, $graphql_type),
257 );
258 }
259  
260 0 my $query_type = GraphQL::Type::Object->new(
261 name => 'Query',
262 fields => \%query_fields,
263 );
264  
265 0 my $mutation_type = GraphQL::Type::Object->new(
266 name => 'Mutation',
267 description => 'Auto-generated create/update/patch/delete mutations',
268 fields => \%mutation_fields,
269 );
270  
271 0 my $schema = GraphQL::Schema->new(
272 query => $query_type,
273 mutation => $mutation_type,
274 );
275  
276 return {
277 0 schema => $schema,
278 context => $db,
279 };
280 }
281  
282 #
283 #
284 # INTERNAL METHODS
285  
286 # _scalar_for_column($source, $col_name)
287 #
288 # Maps a DBIC column to a GraphQL scalar. Resolution order matters:
289 # 1. Boolean: must come before Int because tinyint(1) is the MySQL idiom
290 # 2. Float : decimal/numeric before the int catch-all
291 # 3. Int : all integer family types
292 # 4. String : safe fallback for anything unrecognised
293 sub _scalar_for_column {
294 40 ▶ my ($source, $col) = @_;
Subroutine _scalar_for_column: called CC=5 SCAR=16.1
295 40 my $info = $source->column_info($col);
296 40 ▶ my $data_type = $info->{data_type} // '';
Condition100%2/2
$info->{"data_type"} // ""
l!l
391
MC/DC100%1/1
$info->{"data_type"} // ""
$info->{"data_type"}
Truth table100%2/2
A
A= $info->{"data_type"}
Aresult
11
00
297  
298 40 ▶ return $Boolean if $data_type =~ /(?:\b(?:bool(?:ean)?)|tinyint\(1\))(?=\s|\z)/i;
Branch: 1 branch
BranchTrueFalseTotal
if $data_type =~ /(?:\b(?:bool(?:ean)?)|tinyint\(1\))(?=\s|\z)/i 7 33 40
299 33 ▶ return $Float if $data_type =~ /\b(?:float|double(?:\s+precision)?|real|money|decimal|numeric)\b/i;
Branch: 1 branch
BranchTrueFalseTotal
if $data_type =~ /\b(?:float|double(?:\s+precision)?|real|money|decimal|numeric)\b/i 12 21 33
300 21 ▶ return $Int if $data_type =~ /\b(?:int(?:eger)?|bigint|smallint|tinyint|mediumint|serial)\b/i;
Branch: 1 branch
BranchTrueFalseTotal
if $data_type =~ /\b(?:int(?:eger)?|bigint|smallint|tinyint|mediumint|serial)\b/i 11 10 21
301 10 return $String;
302 }
303  
304 sub _col_is_required {
305 0 ▶ my ($source, $col) = @_;
Subroutine _col_is_required: not called CC=4 SCAR=30.0
306 0 my $info = $source->column_info($col);
307 0 ▶ return 0 if $info->{is_auto_increment};
Branch: 1 branch
BranchTrueFalseTotal
if $info->{"is_auto_increment"} 0 0 0
308 0 ▶ return 0 if defined $info->{default_value};
Branch: 1 branch
BranchTrueFalseTotal
if defined $info->{"default_value"} 0 0 0
309 0 ▶ return 0 if $info->{is_nullable};
Branch: 1 branch
BranchTrueFalseTotal
if $info->{"is_nullable"} 0 0 0
310 0 return 1;
311 }
312  
313 sub _pk_find {
314 0 ▶ my ($ctx, $moniker, $row_hash) = @_;
Subroutine _pk_find: not called CC=2 SCAR=17.9
315 0 my $source = $ctx->source($moniker);
316 0 my @pk_cols = $source->primary_columns;
317 0 my %pk_vals = map { $_ => $row_hash->{$_} } @pk_cols;
318 0 ▶ return unless grep { defined } values %pk_vals == @pk_cols;
Branch: 1 branch
BranchTrueFalseTotal
unless grep {defined $_;} values %pk_vals == @pk_cols 0 0 0
319 0 return $ctx->resultset($moniker)->find(\%pk_vals);
320 }
321  
322 sub _build_singular_args {
323 0 ▶ my ($source) = @_;
Subroutine _build_singular_args: not called CC=2 SCAR=17.9
324 0 my %args;
325 0 for my $pk_col ($source->primary_columns) {
326 0 $args{$pk_col} = { type => _scalar_for_column($source, $pk_col) };
327 }
328 0 return \%args;
329 }
330  
331 sub _build_lookup_args {
332 0 ▶ my ($source) = @_;
Subroutine _build_lookup_args: not called CC=6 SCAR=37.4
333 0 my %args;
334  
335 0 for my $col ($source->primary_columns) {
336 0 $args{$col} = { type => _scalar_for_column($source, $col) };
337 }
338  
339 0 my %unique = $source->unique_constraints;
340 0 for my $constraint_name (keys %unique) {
341 0 ▶ next if $constraint_name eq 'primary';
Branch: 1 branch
BranchTrueFalseTotal
if $constraint_name eq "primary" 0 0 0
342 0 for my $col (@{ $unique{$constraint_name} }) {
343 0 ▶ $args{$col} //= { type => _scalar_for_column($source, $col) };
Condition0%0/2
$args{$col} //= {"type", _scalar_for_column($source, $col)}
l!l
00
MC/DC0%0/1
$args{$col} //= {"type", _scalar_for_column($source, $col)}
$args{$col}
Truth table0%0/2
A
A= $args{$col}
Aresult
11
00
344 }
345 }
346  
347 0 return \%args;
348 }
349  
350 sub _resolve_row {
351 0 ▶ my ($ctx, $moniker, $args) = @_;
Subroutine _resolve_row: not called CC=6 SCAR=37.4
352 0 my $source = $ctx->source($moniker);
353 0 my $rs = $ctx->resultset($moniker);
354  
355 0 my @pk_cols = $source->primary_columns;
356 0 my @pk_vals = map { $args->{$_} } @pk_cols;
357 0 ▶ unless (grep { !defined } @pk_vals) {
Branch: 1 branch
BranchTrueFalseTotal
unless (grep {not defined $_;} @pk_vals) 0 0 0
358 0 my $row = $rs->find({ map { $pk_cols[$_] => $pk_vals[$_] }
359 0 .. $#pk_cols });
360 0 ▶ return $row if $row;
Branch: 1 branch
BranchTrueFalseTotal
if $row 0 0 0
361 }
362  
363 0 my %unique = $source->unique_constraints;
364 0 for my $constraint_name (sort grep { $_ ne 'primary' } keys %unique) {
365 0 my @cols = @{ $unique{$constraint_name} };
366 0 my @vals = map { $args->{$_} } @cols;
367 0 ▶ next if grep { !defined } @vals;
Branch: 1 branch
BranchTrueFalseTotal
if grep {not defined $_;} @vals 0 0 0
368 0 my $row = $rs->find({ map { $cols[$_] => $vals[$_] } 0 .. $#cols });
369 0 ▶ return $row if $row;
Branch: 1 branch
BranchTrueFalseTotal
if $row 0 0 0
370 }
371  
372 0 return undef;
373 }
374  
375 #
376 # Cursors are base64(val1:val2:...), stateless, no extra dependencies.
377 # Colons inside values are percent-encoded so the separator is unambiguous.
378  
379 sub _encode_cursor {
380 0 ▶ my (@vals) = @_;
Subroutine _encode_cursor: not called CC=1 SCAR=6.9
381 0 my $raw = join ':', map { (my $v = $_) =~ s/%/%25/g; $v =~ s/:/%3A/g; $v } @vals;
382 0 return encode_base64($raw, ''); # no newline
383 }
384  
385 sub _decode_cursor {
386 0 ▶ my ($cursor) = @_;
Subroutine _decode_cursor: not called CC=1 SCAR=6.9
387 0 my $raw = decode_base64($cursor);
388 0 my @vals = map { (my $v = $_) =~ s/%3A/:/gi; $v =~ s/%25/%/g; $v }
389 split /:/, $raw;
390 0 return @vals;
391 }
392  
393 # _build_shared_types()
394 #
395 # Builds the input/enum types that are shared across all plural queries:
396 #
397 # OrderDirection: enum ASC | DESC
398 # OrderByInput : input { field: String!, direction: OrderDirection }
399 # PageInput : input { skip: Int, take: Int }
400 # CursorInput : input { after: String, first: Int }
401 #
402 # Returns a hashref of type objects.
403 sub _build_shared_types {
404 0 ▶ my $order_direction = GraphQL::Type::Enum->new(
Subroutine _build_shared_types: not called CC=1 SCAR=6.9
405 name => 'OrderDirection',
406 values => {
407 ASC => { value => 'ASC' },
408 DESC => { value => 'DESC' },
409 },
410 );
411  
412 0 my $order_by_input = GraphQL::Type::InputObject->new(
413 name => 'OrderByInput',
414 fields => {
415 field => { type => GraphQL::Type::NonNull->new(of => $String) },
416 direction => { type => $order_direction },
417 },
418 );
419  
420 0 my $page_input = GraphQL::Type::InputObject->new(
421 name => 'PageInput',
422 fields => {
423 skip => { type => $Int },
424 take => { type => $Int },
425 },
426 );
427  
428 0 my $cursor_input = GraphQL::Type::InputObject->new(
429 name => 'CursorInput',
430 fields => {
431 after => { type => $String },
432 first => { type => $Int },
433 },
434 );
435  
436 return {
437 0 order_direction => $order_direction,
438 order_by_input => $order_by_input,
439 page_input => $page_input,
440 cursor_input => $cursor_input,
441 };
442 }
443  
444 # _build_filter_type($source, $moniker)
445 #
446 # Builds a per-source InputObject for filtering. For each column we emit:
447 # col : exact match
448 # col_not : inequality
449 # col_like: SQL LIKE (String columns only)
450 # col_gt / col_gte / col_lt / col_lte: comparisons (Int/Float columns)
451 #
452 # Plus recursive AND / OR combinators.
453 sub _build_filter_type {
454 0 ▶ my ($source, $moniker) = @_;
Subroutine _build_filter_type: not called CC=3 SCAR=24.8
455  
456 # We need a forward-declaration trick for the recursive AND/OR fields.
457 # Create the type object first with an empty fields sub, then fill it in.
458 my $filter_type = GraphQL::Type::InputObject->new(
459 name => "${moniker}Filter",
460 0 ▶ fields => sub { {} }, # placeholder
Subroutine __ANON__: not called CC=1 SCAR=6.9
461 0 );
462  
463 0 my %fields;
464  
465 0 for my $col ($source->columns) {
466 0 my $scalar = _scalar_for_column($source, $col);
467 0 my $name = $scalar->name;
468  
469 # exact match
470 0 $fields{$col} = { type => $scalar };
471  
472 # inequality
473 0 $fields{"${col}_not"} = { type => $scalar };
474  
475 0 ▶ if ($name eq 'String') {
Branch: 1 branch
BranchTrueFalseTotal
if ($name eq 'String') { } 0 0 0
476 # LIKE pattern match (String columns only)
477 0 $fields{"${col}_like"} = { type => $String };
478 }
479 else {
480 # Numeric / boolean comparisons
481 0 $fields{"${col}_gt"} = { type => $scalar };
482 0 $fields{"${col}_gte"} = { type => $scalar };
483 0 $fields{"${col}_lt"} = { type => $scalar };
484 0 $fields{"${col}_lte"} = { type => $scalar };
485 }
486 }
487  
488 # Recursive AND / OR — each takes a list of the same filter type
489 0 $fields{AND} = { type => GraphQL::Type::List->new(of => $filter_type) };
490 0 $fields{OR} = { type => GraphQL::Type::List->new(of => $filter_type) };
491  
492 # Now replace the placeholder
493 0 ▶ $filter_type->{fields} = sub { \%fields };
Subroutine __ANON__: not called CC=1 SCAR=6.9
494  
495 0 return $filter_type;
496 }
497  
498 # _build_connection_type($moniker, $gql_type)
499 #
500 # Builds the per-source connection wrapper returned by plural queries:
501 #
502 # type BookConnection {
503 # nodes: [Book]
504 # total: Int
505 # nextCursor: String
506 # hasNextPage: Boolean
507 # }
508 sub _build_connection_type {
509 0 ▶ my ($moniker, $gql_type) = @_;
Subroutine _build_connection_type: not called CC=1 SCAR=6.9
510  
511 0 return GraphQL::Type::Object->new(
512 name => "${moniker}Connection",
513 fields => {
514 nodes => { type => GraphQL::Type::List->new(of => $gql_type) },
515 total => { type => $Int },
516 nextCursor => { type => $String },
517 hasNextPage => { type => $Boolean },
518 },
519 );
520 }
521  
522 # _filter_to_dbic($filter, $source)
523 #
524 # Recursively converts a GraphQL filter hashref into a DBIC search condition.
525 #
526 # { title_like: "%Perl%" , OR: [{ id: 1 }, { id: 2 }] }
527 # => { title => { like => '%Perl%' }, -or => [ { id => 1 }, { id => 2 } ] }
528 sub _filter_to_dbic {
529 0 ▶ my ($filter, $source) = @_;
Subroutine _filter_to_dbic: not called CC=12 SCAR=50.5
530 0 ▶ return {} unless $filter && %$filter;
Branch: 1 branch
BranchTrueFalseTotal
unless $filter and %$filter 0 0 0
Condition0%0/3
$filter and %$filter
!ll&&!rl&&r
000
MC/DC0%0/2
$filter and %$filter
$filter %$filter
Truth table0%0/3
A and B
A= $filterB= %$filter
ABresult
0X0
100
111
531  
532 0 my %cond;
533 my @and_parts;
534  
535 # AND / OR combinators
536 0 ▶ if (my $and = $filter->{AND}) {
Branch: 1 branch
BranchTrueFalseTotal
if (my $and = $filter->{"AND"}) 0 0 0
537 0 push @and_parts, { -and => [ map { _filter_to_dbic($_, $source) } @$and ] };
538 }
539 0 ▶ if (my $or = $filter->{OR}) {
Branch: 1 branch
BranchTrueFalseTotal
if (my $or = $filter->{"OR"}) 0 0 0
540 0 push @and_parts, { -or => [ map { _filter_to_dbic($_, $source) } @$or ] };
541 }
542  
543 # Column conditions
544 0 for my $key (keys %$filter) {
545 0 ▶ next if $key eq 'AND' || $key eq 'OR';
Branch: 1 branch
BranchTrueFalseTotal
if $key eq "AND" or $key eq "OR" 0 0 0
Condition0%0/3
$key eq "AND" or $key eq "OR"
l!l&&r!l&&!r
000
MC/DC0%0/2
$key eq "AND" or $key eq "OR"
$key eq "AND" $key eq "OR"
Truth table0%0/3
A or B
A= $key eq "AND"B= $key eq "OR"
ABresult
1X1
011
000
546 0 ▶ next unless defined $filter->{$key};
Branch: 1 branch
BranchTrueFalseTotal
unless defined $filter->{$key} 0 0 0
547  
548 0 ▶ if ($key =~ /^(.+)_(not|like|gt|gte|lt|lte)$/) {
Branch: 1 branch
BranchTrueFalseTotal
if ($key =~ /^(.+)_(not|like|gt|gte|lt|lte)$/) { } 0 0 0
549 0 my ($col, $op) = ($1, $2);
550 my $dbic_op = { not => '!=' , like => 'like',
551 gt => '>' , gte => '>=',
552 0 lt => '<' , lte => '<=' }->{$op};
553 0 push @and_parts, { $col => { $dbic_op => $filter->{$key} } };
554 }
555 else {
556 # exact match
557 0 push @and_parts, { $key => $filter->{$key} };
558 }
559 }
560  
561 0 ▶ return @and_parts == 1 ? $and_parts[0]
Branch: 2 branches
BranchTrueFalseTotal
@and_parts == 1 ? : 0 0 0
@and_parts > 1 ? : 0 0 0
562 : @and_parts > 1 ? { -and => \@and_parts }
563 : {};
564 }
565  
566 # _apply_pagination($rs, $args, $source)
567 #
568 # Applies ordering, then either offset (page) or cursor (cursor) pagination.
569 # Returns ($paged_rs, $next_cursor, $has_next_page).
570 #
571 # Precedence: cursor pagination wins if both are supplied.
572 sub _apply_pagination {
573 0 ▶ my ($rs, $args, $source) = @_;
Subroutine _apply_pagination: not called CC=15 SCAR=54.8
574  
575 0 my @pk_cols = $source->primary_columns;
576  
577 # Ordering
578 0 my $order_by = $args->{orderBy};
579 0 ▶ if ($order_by && $order_by->{field}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($order_by and $order_by->{'field'}) { } 0 0 0
Condition0%0/3
$order_by and $order_by->{"field"}
!ll&&!rl&&r
000
MC/DC0%0/2
$order_by and $order_by->{"field"}
$order_by $order_by->{"field"}
Truth table0%0/3
A and B
A= $order_byB= $order_by->{"field"}
ABresult
0X0
100
111
580 0 ▶ my $dir = lc($order_by->{direction} // 'ASC');
Condition0%0/2
$order_by->{"direction"} // "ASC"
l!l
00
MC/DC0%0/1
$order_by->{"direction"} // "ASC"
$order_by->{"direction"}
Truth table0%0/2
A
A= $order_by->{"direction"}
Aresult
11
00
581 $rs = $rs->search(undef, {
582 order_by => { "-$dir" => $order_by->{field} }
583 0 });
584 }
585 else {
586 # Default: stable order by PK
587 0 $rs = $rs->search(undef, { order_by => [ map { { -asc => $_ } } @pk_cols ] });
588 }
589  
590 # Cursor pagination
591 0 ▶ if (my $cursor_args = $args->{cursor}) {
Branch: 1 branch
BranchTrueFalseTotal
if (my $cursor_args = $args->{"cursor"}) 0 0 0
592 0 ▶ my $first = $cursor_args->{first} // 10;
Condition0%0/2
$cursor_args->{"first"} // 10
l!l
00
MC/DC0%0/1
$cursor_args->{"first"} // 10
$cursor_args->{"first"}
Truth table0%0/2
A
A= $cursor_args->{"first"}
Aresult
11
00
593 0 my $after = $cursor_args->{after};
594  
595 0 ▶ if ($after) {
Branch: 1 branch
BranchTrueFalseTotal
if ($after) 0 0 0
596 0 my @decoded = _decode_cursor($after);
597 0 ▶ if (@pk_cols == 1) {
Branch: 1 branch
BranchTrueFalseTotal
if (@pk_cols == 1) { } 0 0 0
598 # Simple: WHERE pk > cursor_val (works for ordered-by-PK default)
599 0 $rs = $rs->search({ $pk_cols[0] => { '>' => $decoded[0] } });
600 }
601 else {
602 # Composite PK: fetch everything after decoded position
603 # by re-applying a compound condition
604 0 my %after_cond = map { $pk_cols[$_] => { '>' => $decoded[$_] } }
605 0 .. $#pk_cols;
606 0 $rs = $rs->search(\%after_cond);
607 }
608 }
609  
610 # Fetch one extra to detect hasNextPage
611 0 my @rows = $rs->search(undef, { rows => $first + 1 })->all;
612 0 my $has_next = @rows > $first;
613 0 ▶ @rows = @rows[0 .. $first - 1] if $has_next;
Branch: 1 branch
BranchTrueFalseTotal
if $has_next 0 0 0
614  
615 0 my $next_cursor;
616 0 ▶ if ($has_next && @rows) {
Branch: 1 branch
BranchTrueFalseTotal
if ($has_next and @rows) 0 0 0
Condition0%0/3
$has_next and @rows
!ll&&!rl&&r
000
MC/DC0%0/2
$has_next and @rows
$has_next @rows
Truth table0%0/3
A and B
A= $has_nextB= @rows
ABresult
0X0
100
111
617 0 my $last_row = $rows[-1];
618 0 $next_cursor = _encode_cursor(map { $last_row->get_column($_) } @pk_cols);
619 }
620  
621 return (
622 0 ▶ [ map { { $_->get_columns } } @rows ],
Branch: 1 branch
BranchTrueFalseTotal
$has_next ? : 0 0 0
623 $next_cursor,
624 $has_next ? 1 : 0,
625 );
626 }
627  
628 # Offset pagination
629 0 ▶ if (my $page_args = $args->{page}) {
Branch: 1 branch
BranchTrueFalseTotal
if (my $page_args = $args->{"page"}) 0 0 0
630 0 ▶ my $skip = $page_args->{skip} // 0;
Condition0%0/2
$page_args->{"skip"} // 0
l!l
00
MC/DC0%0/1
$page_args->{"skip"} // 0
$page_args->{"skip"}
Truth table0%0/2
A
A= $page_args->{"skip"}
Aresult
11
00
631 0 ▶ my $take = $page_args->{take} // 10;
Condition0%0/2
$page_args->{"take"} // 10
l!l
00
MC/DC0%0/1
$page_args->{"take"} // 10
$page_args->{"take"}
Truth table0%0/2
A
A= $page_args->{"take"}
Aresult
11
00
632 0 my @rows = $rs->search(undef, { rows => $take, offset => $skip })->all;
633 return (
634 0 [ map { { $_->get_columns } } @rows ],
635 undef, # no cursor for offset pagination
636 0,
637 );
638 }
639  
640 # No pagination: return everything
641 0 my @rows = $rs->all;
642 return (
643 0 [ map { { $_->get_columns } } @rows ],
644 undef,
645 0,
646 );
647 }
648  
649 sub _build_mutation_fields {
650 0 ▶ my ($source, $moniker, $gql_type) = @_;
Subroutine _build_mutation_fields: not called CC=3 SCAR=24.8
651 0 my %fields;
652  
653 0 my @pk_cols = $source->primary_columns;
654 0 my %is_pk = map { $_ => 1 } @pk_cols;
655 0 my @all_cols = $source->columns;
656 0 my @data_cols = grep { !$is_pk{$_} } @all_cols;
657  
658 # createX
659 0 my %create_args;
660 0 for my $col (@all_cols) {
661 0 my $scalar = _scalar_for_column($source, $col);
662 0 ▶ $create_args{$col} = {
Branch: 1 branch
BranchTrueFalseTotal
_col_is_required($source, $col) ? : 0 0 0
663 type => _col_is_required($source, $col)
664 ? GraphQL::Type::NonNull->new(of => $scalar)
665 : $scalar,
666 };
667 }
668  
669 $fields{ 'create' . ucfirst($moniker) } = {
670 type => $gql_type,
671 args => \%create_args,
672 description => "Insert a new $moniker row. Required columns are marked non-null.",
673 resolve => sub {
674 0 ▶ my ($root, $args, $ctx) = @_;
Subroutine __ANON__: not called CC=2 SCAR=17.9
675 0 my %data = map { $_ => $args->{$_} }
676 0 grep { defined $args->{$_} } keys %$args;
677 0 my $row = eval { $ctx->resultset($moniker)->create(\%data) };
678 0 ▶ die $@ if $@;
Branch: 1 branch
BranchTrueFalseTotal
if $@ 0 0 0
679 0 return { $row->get_columns };
680 },
681 0 };
682  
683 # updateX — full replacement; all non-key columns should be supplied.
684 0 my %update_lookup_args = %{ _build_lookup_args($source) };
685 my %update_data_args = map {
686 0 $_ => { type => _scalar_for_column($source, $_) }
687 } @data_cols;
688  
689 $fields{ 'update' . ucfirst($moniker) } = {
690 type => $gql_type,
691 args => { %update_lookup_args, %update_data_args },
692 description => "Full update of a $moniker row identified by its primary key "
693 . "or any unique constraint. All non-key columns should be "
694 . "supplied; omitted columns are left unchanged in the database "
695 . "but that is incidental — use patchX for intentional sparse updates.",
696 resolve => sub {
697 0 ▶ my ($root, $args, $ctx) = @_;
Subroutine __ANON__: not called CC=4 SCAR=30.0
698 0 my $row = _resolve_row($ctx, $moniker, $args);
699 0 ▶ die "No $moniker row found for the supplied key(s)\n" unless $row;
Branch: 1 branch
BranchTrueFalseTotal
unless $row 0 0 0
700 0 my %data = map { $_ => $args->{$_} }
701 0 ▶ grep { !$is_pk{$_} && defined $args->{$_} } keys %$args;
Branch: 1 branch
BranchTrueFalseTotal
not $is_pk{$_} and defined $args->{$_} 0 0 0
702 0 $row = eval { $row->update(\%data); $row->discard_changes; $row };
703 0 ▶ die $@ if $@;
Branch: 1 branch
BranchTrueFalseTotal
if $@ 0 0 0
704 0 return { $row->get_columns };
705 },
706 0 };
707  
708 # patchX — sparse update; only columns explicitly provided are changed.
709 # Identified by primary key or any unique constraint, same as updateX.
710 # Every non-key column is optional (nullable). Only defined arguments
711 # are sent to ->update(), so the caller can safely omit any column they
712 # do not wish to change.
713 $fields{ 'patch' . ucfirst($moniker) } = {
714 type => $gql_type,
715 args => { %update_lookup_args, %update_data_args },
716 description => "Sparse update of a $moniker row identified by its primary key "
717 . "or any unique constraint. Supply only the columns you want "
718 . "to change; all other columns are left untouched.",
719 resolve => sub {
720 0 ▶ my ($root, $args, $ctx) = @_;
Subroutine __ANON__: not called CC=5 SCAR=34.0
721 0 my $row = _resolve_row($ctx, $moniker, $args);
722 0 ▶ die "No $moniker row found for the supplied key(s)\n" unless $row;
Branch: 1 branch
BranchTrueFalseTotal
unless $row 0 0 0
723 # Only send columns the client explicitly provided.
724 # GraphQL omits absent args from the hash entirely, so a
725 # defined-check is sufficient to distinguish "not sent" from null.
726 0 my %data = map { $_ => $args->{$_} }
727 0 ▶ grep { !$is_pk{$_} && defined $args->{$_} } keys %$args;
Branch: 1 branch
BranchTrueFalseTotal
not $is_pk{$_} and defined $args->{$_} 0 0 0
728 0 ▶ die "patchX: no non-key columns supplied — nothing to update\n"
Branch: 1 branch
BranchTrueFalseTotal
unless %data 0 0 0
729 unless %data;
730 0 $row = eval { $row->update(\%data); $row->discard_changes; $row };
731 0 ▶ die $@ if $@;
Branch: 1 branch
BranchTrueFalseTotal
if $@ 0 0 0
732 0 return { $row->get_columns };
733 },
734 0 };
735  
736 # deleteX
737 $fields{ 'delete' . ucfirst($moniker) } = {
738 type => $Boolean,
739 args => _build_lookup_args($source),
740 description => "Delete a $moniker row identified by its primary key "
741 . "or any unique constraint. Returns true on success.",
742 resolve => sub {
743 0 ▶ my ($root, $args, $ctx) = @_;
Subroutine __ANON__: not called CC=3 SCAR=24.8
744 0 my $row = _resolve_row($ctx, $moniker, $args);
745 0 ▶ return 0 unless $row;
Branch: 1 branch
BranchTrueFalseTotal
unless $row 0 0 0
746 0 eval { $row->delete };
747 0 ▶ return $@ ? 0 : 1;
Branch: 1 branch
BranchTrueFalseTotal
$@ ? : 0 0 0
748 },
749 0 };
750  
751 0 return %fields;
752 }
753  
754 =head1 SCALAR TYPE MAPPING
755  
756 SQL column types are mapped to GraphQL scalars in the following priority order:
757  
758 Boolean: bool, boolean, tinyint(1)
759 Float : float, double, double precision, real, money, decimal, numeric
760 Int : int, integer, bigint, smallint, tinyint, mediumint, serial
761 String : everything else (safe fallback)
762  
763 =head1 PLURAL QUERIES
764  
765 Every source C<X> gets an C<allXs> query returning an C<XConnection>:
766  
767 type XConnection {
768 nodes: [X]
769 total: Int # total rows matching filter, before pagination
770 nextCursor: String # opaque cursor; set only during cursor pagination
771 hasNextPage: Boolean # true when more pages follow
772 }
773  
774 Always request C<total> or another scalar field alongside C<nodes> in your
775 selection set - see L</KNOWN BEHAVIOUR>.
776  
777 =head2 Filtering
778  
779 allBooks(filter: { title_like: "%Perl%", author_id: 3 }) {
780 total nodes { title }
781 }
782  
783 Per-column operators:
784  
785 col exact match
786 col_not inequality (!=)
787 col_like LIKE pattern (String columns only)
788 col_gt greater than
789 col_gte greater than or equal
790 col_lt less than
791 col_lte less than or equal
792  
793 Logical combinators (nest recursively and combine freely):
794  
795 allBooks(filter: {
796 AND: [
797 { author_id: 1 }
798 { OR: [{ title_like: "%Hobbit%" }, { title_like: "%Ring%" }] }
799 ]
800 }) { total nodes { title } }
801  
802 =head2 Ordering
803  
804 allBooks(orderBy: { field: "title", direction: ASC }) {
805 total nodes { title }
806 }
807  
808 C<direction> is the C<OrderDirection> enum: C<ASC> or C<DESC>. When omitted,
809 results are ordered by primary key ascending.
810  
811 =head2 Offset pagination
812  
813 allBooks(page: { skip: 10, take: 5 }) { total nodes { title } }
814  
815 C<skip> defaults to 0, C<take> defaults to 10.
816  
817 =head2 Cursor pagination
818  
819 # First page
820 allBooks(cursor: { first: 5 }) {
821 total nextCursor hasNextPage nodes { title }
822 }
823  
824 # Subsequent pages - pass nextCursor from the previous response
825 allBooks(cursor: { after: "...", first: 5 }) {
826 total nextCursor hasNextPage nodes { title }
827 }
828  
829 C<first> defaults to 10. Cursor pagination takes precedence over offset
830 pagination if both are supplied in the same query. Cursors are opaque
831 base64-encoded strings derived from the row's primary key and should be
832 treated as implementation details subject to change.
833  
834 =head1 MUTATIONS
835  
836 For every source C<X>, four mutations are generated:
837  
838 =head2 createX
839  
840 mutation { createBook(title: "Dune", author_id: 4) { id title } }
841  
842 Accepts all column values as arguments. Columns that are non-nullable,
843 have no declared default, and are not auto-increment are wrapped in
844 C<NonNull> and must be supplied. On failure, C<die>s - the error appears
845 in the top-level C<errors> array of the response.
846  
847 =head2 updateX
848  
849 mutation { updateBook(id: 1, title: "Dune Messiah", author_id: 4) { id title } }
850  
851 Full update. Identifies the target row by its primary key B<or> by a
852 complete set of columns from any unique constraint declared on the source.
853 All non-key columns should be supplied. C<die>s if the row cannot be found
854 or the update fails.
855  
856 Use C<patchX> when you only want to change a subset of columns.
857  
858 =head2 patchX
859  
860 mutation { patchBook(id: 1, title: "Dune Messiah") { id title } }
861  
862 Sparse (partial) update. Identifies the target row the same way as
863 C<updateX> (primary key or unique constraint), but only the non-key columns
864 you explicitly supply are written to the database. Any column you omit is
865 left exactly as it is.
866  
867 # Change only the title - author_id is untouched
868 mutation { patchBook(id: 1, title: "Dune Messiah") { id title author { name } } }
869  
870 # Change only the foreign key - title is untouched
871 mutation { patchBook(id: 1, author_id: 2) { id title author { name } } }
872  
873 C<die>s if the row cannot be found, the update fails, or no non-key
874 columns are supplied at all.
875  
876 =head2 deleteX
877  
878 mutation { deleteBook(id: 1) }
879  
880 Identifies the target row by primary key or unique constraint. Returns
881 C<true> (C<Boolean>) on success, C<false> if the row is not found.
882  
883 =head1 ERROR HANDLING
884  
885 C<createX> and C<updateX> resolver failures C<die>. GraphQL catches the
886 exception and surfaces it in the top-level C<errors> array; the C<data>
887 field for the failed mutation will be C<null>. C<deleteX> returns C<false>
888 rather than dying when a row is not found.
889  
890 =head1 LIMITATIONS
891  
892 =over 4
893  
894 =item * B<Relationship fields are unfiltered.> Relationship fields within a
895 query (e.g. C<author { books { title } }>) return all related rows. They do
896 not accept C<filter>, C<orderBy>, or pagination arguments.
897  
898 =item * B<No nested input for mutations.> C<createX> and C<updateX> accept
899 only scalar column values. Related rows must be created or linked separately
900 using their own mutations and raw foreign-key values.
901  
902 =item * B<updateX is a full update.> All non-primary-key columns should be
903 supplied; use C<patchX> for intentional sparse / partial updates.
904  
905 =item * B<Cursor pagination assumes primary-key order.> The C<after> cursor
906 encodes the primary key of the last returned row and applies a
907 C<pk E<gt> value> condition. If you supply a custom C<orderBy> using a
908 non-primary-key column, the cursor will not advance correctly. Use offset
909 pagination (C<page>) when ordering by non-PK columns.
910  
911 =item * B<No custom scalars.> Column types such as C<date>, C<datetime>,
912 C<json>, and C<uuid> all map to C<String>. Custom GraphQL scalars are not
913 generated.
914  
915 =item * B<No subscriptions.> Only C<Query> and C<Mutation> operation types
916 are generated.
917  
918 =item * B<C<col_like> case sensitivity is database-dependent.> SQLite
919 C<LIKE> is case-insensitive for ASCII characters but case-sensitive for
920 Unicode. PostgreSQL C<LIKE> is always case-sensitive. Use C<col_like>
921 accordingly.
922  
923 =back
924  
925 =head1 KNOWN BEHAVIOUR
926  
927 When querying a plural C<allXs> field, always include at least one scalar
928 field (C<total>, C<hasNextPage>, or C<nextCursor>) alongside C<nodes> in
929 your selection set:
930  
931 # Correct
932 { allBooks { total nodes { title } } }
933  
934 # May silently return empty nodes in some GraphQL executor versions
935 { allBooks { nodes { title } } }
936  
937 This is a quirk of how C<GraphQL::Execution> resolves connection object
938 types when the selection set contains only a list field.
939  
940 =head1 DEPENDENCIES
941  
942 L<DBIx::Class>, L<GraphQL::Schema>, L<GraphQL::Type::Object>,
943 L<GraphQL::Type::InputObject>, L<GraphQL::Type::List>,
944 L<GraphQL::Type::NonNull>, L<GraphQL::Type::Enum>,
945 L<GraphQL::Type::Scalar>, L<MIME::Base64> (core).
946  
947 =head1 SEE ALSO
948  
949 L<GraphQL::Plugin::Convert::DBIC>, L<DBIx::Class::Schema>, L<GraphQL::Schema>
950  
951 =head1 AUTHOR
952  
953 Mohammad Sajid Anwar, C<< <mohammad.anwar at yahoo.com> >>
954  
955 =head1 REPOSITORY
956  
957 L<https://github.com/manwar/DBIx-Class-Schema-GraphQL>
958  
959 =head1 BUGS
960  
961 Please report any bugs or feature requests through the web interface at L<https://github.com/manwar/DBIx-Class-Schema-GraphQL/issues>.
962 I will be notified and then you'll automatically be notified of progress on your
963 bug as I make changes.
964  
965 =head1 SUPPORT
966  
967 You can find documentation for this module with the perldoc command.
968  
969 perldoc DBix::Class::Schema::GraphQL
970  
971 You can also look for information at:
972  
973 =over 4
974  
975 =item * BUG Report
976  
977 L<https://github.com/manwar/DBIx-Class-Schema-GraphQL/issues>
978  
979 =item * CPAN Ratings
980  
981 L<http://cpanratings.perl.org/d/DBIx-Class-Schema-GraphQL>
982  
983 =item * Search MetaCPAN
984  
985 L<https://metacpan.org/dist/DBIx-Class-Schema-GraphQL>
986  
987 =back
988  
989 =head1 LICENSE AND COPYRIGHT
990  
991 Copyright (C) 2026 Mohammad Sajid Anwar.
992  
993 This program is free software; you can redistribute it and / or modify it under
994 the terms of the the Artistic License (2.0). You may obtain a copy of the full
995 license at:
996  
997 L<http://www.perlfoundation.org/artistic_license_2_0>
998  
999 Any use, modification, and distribution of the Standard or Modified Versions is
1000 governed by this Artistic License.By using, modifying or distributing the Package,
1001 you accept this license. Do not use, modify, or distribute the Package, if you do
1002 not accept this license.
1003  
1004 If your Modified Version has been derived from a Modified Version made by someone
1005 other than you,you are nevertheless required to ensure that your Modified Version
1006 complies with the requirements of this license.
1007  
1008 This license does not grant you the right to use any trademark, service mark,
1009 tradename, or logo of the Copyright Holder.
1010  
1011 This license includes the non-exclusive, worldwide, free-of-charge patent license
1012 to make, have made, use, offer to sell, sell, import and otherwise transfer the
1013 Package with respect to any patent claims licensable by the Copyright Holder that
1014 are necessarily infringed by the Package. If you institute patent litigation
1015 (including a cross-claim or counterclaim) against any party alleging that the
1016 Package constitutes direct or contributory patent infringement,then this Artistic
1017 License to you shall terminate on the date that such litigation is filed.
1018  
1019 Disclaimer of Warranty: THE PACKAGE IS PROVIDED BY THE COPYRIGHT HOLDER AND
1020 CONTRIBUTORS "AS IS' AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES. THE IMPLIED
1021 WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR
1022 NON-INFRINGEMENT ARE DISCLAIMED TO THE EXTENT PERMITTED BY YOUR LOCAL LAW. UNLESS
1023 REQUIRED BY LAW, NO COPYRIGHT HOLDER OR CONTRIBUTOR WILL BE LIABLE FOR ANY DIRECT,
1024 INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING IN ANY WAY OUT OF THE USE
1025 OF THE PACKAGE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
1026  
1027 =cut
1028  
1029 7 1; # End of DBIx::Class::Schema::GraphQL
↑ Summary