Branch Coverage

blib/lib/Mojolicious/Plugin/OpenAPI.pm
Criterion Covered Total %
branch 81 104 77.8


line true false branch
20 1 60 if defined $config->{'coerce'}
22 61 0 if (my $class = $config->{'version_from_class'} // ref $app)
23 5 56 if $class->VERSION
26 1 60 $config->{'skip_validating_specification'} ? :
27 2 59 if @$errors
29 51 8 unless ($app->defaults->{'openapi.base_paths'})
44 59 0 unless $config->{'plugins'}
45 177 0 if $plugin =~ s/^\+//u
46 0 177 unless eval "require $plugin;1"
50 59 0 unless $config->{'default_response'}
54 58 1 if @{$default_response{'status'};}
72 1 127 if $op_spec->{'operationId'} and $uniq{'o'}{$op_spec->{'operationId'}}++
73 1 126 if $name and $uniq{'r'}{$name}++
75 108 18 if (not $op_spec->{'x-mojo-to'} and $name)
78 100 8 if $r
80 26 100 unless ($r)
86 12 14 if $name
101 4 377 unless _self($c)
105 150 227 if $handler eq "openapi" and exists $c->stash->{'openapi'} or exists $args->{'openapi'}
108 214 13 unless exists $args->{'handler'}
112 9 0 if ($handler eq "openapi" and $status eq '404' || $status eq '500')
131 0 59 if $route and not $route->pattern->unparsed
132 56 3 unless $route
140 4 55 if (my $spec_route_name = $config->{'spec_route_name'} || $validator->get('/x-mojo-name'))
154 1 36 if ref $path or $path =~ m[^/]u or not length $path
158 2 34 unless $stash
161 31 3 if $path ne "for_path"
167 0 0 ref $_[0] ? :
174 0 0 if (UNIVERSAL::isa($output, "Mojo::Asset"))
176 0 0 if (not $h->content_type and $output->isa("Mojo::Asset::File"))
178 0 0 $output->path =~ /\.(\w+)$/u ? :
184 0 0 if $status
190 6 172 if $c->res->code
191 141 31 unless my(@errors) = _helper_validate($c)
223 12 0 $op_to ? :
0 12 ref $op_to eq 'HASH' ? :
112 12 ref $op_to eq 'ARRAY' ? :
226 13 111 if @args and $args[0] =~ /#/u
229 0 124 if $config->{'format'}
231 1 6 if (ref $arg eq 'ARRAY') { }
1 5 elsif (ref $arg eq 'HASH') { }
5 0 elsif (not ref $arg and @args) { }
236 2 122 if @to
242 0 159 unless exists $stash->{'openapi'}
243 0 159 unless my $self = _self($c)
255 137 22 if ($op_spec) { }
20 2 elsif (ref $stash->{'openapi'} eq 'HASH' and ref $stash->{'openapi'}{'errors'} eq 'ARRAY') { }
260 1 6 $errors[0]->path eq '/header/Accept' ? :
7 130 if @errors
271 29 130 if @errors
274 29 130 @errors ? :
294 777 15 if $self