Branch Coverage

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


line true false branch
18 0 5 unless $_[1]{'op'} and $_[1]{'id'} and ref $_[1]{'params'} eq 'HASH'
25 1 4 unless my $defaults = $self->{'route_defaults'}{$data->{'op'}}
28 0 4 if $e = _find_action($c, $defaults)
30 2 2 unless $defaults->{'swagger_operation_spec'}{'parameters'}
34 1 1 unless @e
38 1 3 if @errors
54 2 1 unless @errors
64 35 79 if %$err
65 74 5 ref $data ? :
76 40 0 unless $app->renderer->helpers->{'pod_to_html'}
78 40 0 if ($config->{'validate'} // 1)
80 0 40 if @errors
83 0 40 if ($app->plugins->has_subscribers('swagger_route_added')) { }
92 0 40 if $config->{'coerce'}
95 40 0 unless $app->renderer->get_helper('dispatch_to_swagger')
97 40 0 unless $app->renderer->get_helper('render_swagger')
102 0 40 if ($r and not $r->pattern->unparsed)
106 39 1 unless ($r)
110 1 39 if (my $ws = $config->{'ws'})
126 23 57 unless $op_spec->{'parameters'}
135 2 78 if not $op_spec->{'x-mojo-around-action'} and $around_action
137 2 78 if not $op_spec->{'x-mojo-controller'} and $controller
144 40 0 if (my $spec_path = $config->{'spec_path'} // '/')
149 2 38 if ($config->{'ensure_swagger_response'})
166 8 8 unless my $template = $args->{'template'}
167 5 3 unless my $msg = $responses->{$template}
168 1 2 unless $c->req->url->path->to_string =~ /$base_path/
183 2 113 if $e = _find_action($c, $defaults)
188 19 94 if @errors
202 79 14 unless @errors
209 23 57 unless $op_spec->{'parameters'}
210 1 60 if $p->{'in'} eq 'path' and defined $p->{'default'}
213 3 77 if (my $around_action = $op_spec->{'x-mojo-around-action'})
234 76 4 $controller ? :
251 1 3 if ($format eq 'text') { }
1 2 elsif ($format eq 'html') { }
271 54 76 if $_[1]{'controller'}
273 0 76 unless my $op = $defaults->{'swagger_operation_spec'}{'operationId'}
276 65 10 $defaults->{'controller'}->can($defaults->{'action'}) ? :
283 60 16 if $defaults->{'controller'}
287 10 6 if $defaults->{'controller'}
294 5 1 if $defaults->{'controller'}
310 18 80 unless $controller
313 61 19 if ($controller =~ /::/) { }
329 75 7 if $controller->can('new')