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 79 if %$err
67 74 5 ref $data ? :
78 40 0 unless $app->renderer->helpers->{'pod_to_html'}
80 40 0 if ($config->{'validate'} // 1)
82 0 40 if @errors
85 0 40 if ($app->plugins->has_subscribers('swagger_route_added')) { }
94 0 40 if $config->{'coerce'}
97 40 0 unless $app->renderer->get_helper('dispatch_to_swagger')
99 40 0 unless $app->renderer->get_helper('render_swagger')
104 0 40 if ($r and not $r->pattern->unparsed)
108 39 1 unless ($r)
112 1 39 if (my $ws = $config->{'ws'})
128 23 57 unless $op_spec->{'parameters'}
137 2 78 if not $op_spec->{'x-mojo-around-action'} and $around_action
139 2 78 if not $op_spec->{'x-mojo-controller'} and $controller
146 40 0 if (my $spec_path = $config->{'spec_path'} // '/')
151 2 38 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 113 if $e = _find_action($c, $defaults)
190 19 94 if @errors
204 79 14 unless @errors
211 23 57 unless $op_spec->{'parameters'}
212 1 60 if $p->{'in'} eq 'path' and defined $p->{'default'}
215 3 77 if (my $around_action = $op_spec->{'x-mojo-around-action'})
236 76 4 $controller ? :
253 1 3 if ($format eq 'text') { }
1 2 elsif ($format eq 'html') { }
273 54 76 if $_[1]{'controller'}
275 0 76 unless my $op = $defaults->{'swagger_operation_spec'}{'operationId'}
278 65 10 $defaults->{'controller'}->can($defaults->{'action'}) ? :
285 60 16 if $defaults->{'controller'}
289 10 6 if $defaults->{'controller'}
296 5 1 if $defaults->{'controller'}
312 18 80 unless $controller
315 61 19 if ($controller =~ /::/) { }
331 75 7 if $controller->can('new')