| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package Whelk::Wrapper::WithStatus; |
|
2
|
|
|
|
|
|
|
$Whelk::Wrapper::WithStatus::VERSION = '1.04'; |
|
3
|
4
|
|
|
4
|
|
2298
|
use Kelp::Base 'Whelk::Wrapper'; |
|
|
4
|
|
|
|
|
9
|
|
|
|
4
|
|
|
|
|
22
|
|
|
4
|
|
|
|
|
|
|
|
|
5
|
4
|
|
|
4
|
|
839
|
use Whelk::Schema; |
|
|
4
|
|
|
|
|
7
|
|
|
|
4
|
|
|
|
|
1376
|
|
|
6
|
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
sub wrap_server_error |
|
8
|
|
|
|
|
|
|
{ |
|
9
|
3
|
|
|
3
|
0
|
112
|
my ($self, $data) = @_; |
|
10
|
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
return { |
|
12
|
3
|
|
|
|
|
20
|
success => 0, |
|
13
|
|
|
|
|
|
|
error => $data, |
|
14
|
|
|
|
|
|
|
}; |
|
15
|
|
|
|
|
|
|
} |
|
16
|
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
sub wrap_success |
|
18
|
|
|
|
|
|
|
{ |
|
19
|
6
|
|
|
6
|
0
|
14
|
my ($self, $data) = @_; |
|
20
|
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
return { |
|
22
|
6
|
|
|
|
|
23
|
success => 1, |
|
23
|
|
|
|
|
|
|
data => $data, |
|
24
|
|
|
|
|
|
|
}; |
|
25
|
|
|
|
|
|
|
} |
|
26
|
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
sub build_response_schemas |
|
28
|
|
|
|
|
|
|
{ |
|
29
|
33
|
|
|
33
|
1
|
52
|
my ($self, $endpoint) = @_; |
|
30
|
33
|
|
|
|
|
71
|
my $schema = $endpoint->response; |
|
31
|
33
|
|
|
|
|
156
|
my $schemas = $endpoint->response_schemas; |
|
32
|
|
|
|
|
|
|
|
|
33
|
33
|
100
|
|
|
|
92
|
if ($schema->empty) { |
|
|
|
50
|
|
|
|
|
|
|
34
|
13
|
|
|
|
|
29
|
$schemas->{$endpoint->response_code} = $schema; |
|
35
|
|
|
|
|
|
|
} |
|
36
|
|
|
|
|
|
|
elsif ($schema) { |
|
37
|
20
|
|
|
|
|
172
|
$schemas->{$endpoint->response_code} = Whelk::Schema->build( |
|
38
|
|
|
|
|
|
|
{ |
|
39
|
|
|
|
|
|
|
type => 'object', |
|
40
|
|
|
|
|
|
|
properties => { |
|
41
|
|
|
|
|
|
|
success => { |
|
42
|
|
|
|
|
|
|
type => 'boolean', |
|
43
|
|
|
|
|
|
|
default => !!1, |
|
44
|
|
|
|
|
|
|
}, |
|
45
|
|
|
|
|
|
|
data => [$schema, required => !!1], |
|
46
|
|
|
|
|
|
|
}, |
|
47
|
|
|
|
|
|
|
} |
|
48
|
|
|
|
|
|
|
); |
|
49
|
|
|
|
|
|
|
} |
|
50
|
|
|
|
|
|
|
|
|
51
|
33
|
|
|
|
|
421
|
$schemas->{'5XX'} = $schemas->{'4XX'} = Whelk::Schema->get_or_build( |
|
52
|
|
|
|
|
|
|
api_error_with_status => { |
|
53
|
|
|
|
|
|
|
type => 'object', |
|
54
|
|
|
|
|
|
|
properties => { |
|
55
|
|
|
|
|
|
|
success => { |
|
56
|
|
|
|
|
|
|
type => 'boolean', |
|
57
|
|
|
|
|
|
|
default => !!0, |
|
58
|
|
|
|
|
|
|
}, |
|
59
|
|
|
|
|
|
|
error => { |
|
60
|
|
|
|
|
|
|
type => 'string', |
|
61
|
|
|
|
|
|
|
}, |
|
62
|
|
|
|
|
|
|
}, |
|
63
|
|
|
|
|
|
|
} |
|
64
|
|
|
|
|
|
|
); |
|
65
|
|
|
|
|
|
|
} |
|
66
|
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
1; |
|
68
|
|
|
|
|
|
|
|