Branch Coverage

blib/lib/Mojolicious/Plugin/Swagger2.pm
Criterion Covered Total %
branch 78 90 86.6


line true false branch
20 0 5 unless $_[1]{'op'} and $_[1]{'id'} and ref $_[1]{'params'} eq 'HASH'
27 1 4 unless my $defaults = $self->{'route_defaults'}{$data->{'op'}}
30 0 4 if $e = _find_action($c, $defaults)
32 2 2 unless $defaults->{'swagger_operation_spec'}{'parameters'}
36 1 1 unless @e
40 1 3 if @errors
56 2 1 unless @errors
66 35 80 if %$err
67 75 5 ref $data ? :
78 41 0 unless $app->renderer->helpers->{'pod_to_html'}
80 41 0 if ($config->{'validate'} // 1)
82 0 41 if @errors
85 0 41 if ($app->plugins->has_subscribers('swagger_route_added')) { }
94 0 41 if $config->{'coerce'}
97 41 0 unless $app->renderer->get_helper('dispatch_to_swagger')
99 41 0 unless $app->renderer->get_helper('render_swagger')
104 0 41 if ($r and not $r->pattern->unparsed)
108 40 1 unless ($r)
112 1 40 if (my $ws = $config->{'ws'})
128 24 59 unless $op_spec->{'parameters'}
137 2 81 if not $op_spec->{'x-mojo-around-action'} and $around_action
139 2 81 if not $op_spec->{'x-mojo-controller'} and $controller
146 41 0 if (my $spec_path = $config->{'spec_path'} // '/')
151 2 39 if ($config->{'ensure_swagger_response'})
168 8 8 unless my $template = $args->{'template'}
169 5 3 unless my $msg = $responses->{$template}
170 1 2 unless $c->req->url->path->to_string =~ /$base_path/
185 2 114 if $e = _find_action($c, $defaults)
190 19 95 if @errors
204 80 14 unless @errors
211 24 59 unless $op_spec->{'parameters'}
212 1 62 if $p->{'in'} eq 'path' and defined $p->{'default'}
215 3 80 if (my $around_action = $op_spec->{'x-mojo-around-action'})
236 79 4 $controller ? :
253 1 3 if ($format eq 'text') { }
1 2 elsif ($format eq 'html') { }
273 54 77 if $_[1]{'controller'}
275 0 77 unless my $op = $defaults->{'swagger_operation_spec'}{'operationId'}
278 66 10 $defaults->{'controller'}->can($defaults->{'action'}) ? :
285 61 16 if $defaults->{'controller'}
289 10 6 if $defaults->{'controller'}
296 5 1 if $defaults->{'controller'}
312 18 81 unless $controller
315 62 19 if ($controller =~ /::/) { }
331 76 7 if $controller->can('new')