|
Lines 21-27
use Mojo::Base 'Mojolicious::Plugin';
Link Here
|
| 21 |
|
21 |
|
| 22 |
use Koha::Exceptions::Plugin; |
22 |
use Koha::Exceptions::Plugin; |
| 23 |
use Koha::Plugins; |
23 |
use Koha::Plugins; |
| 24 |
use Koha::Logger; |
|
|
| 25 |
|
24 |
|
| 26 |
use Clone qw( clone ); |
25 |
use Clone qw( clone ); |
| 27 |
use JSON::Validator::Schema::OpenAPIv2; |
26 |
use JSON::Validator::Schema::OpenAPIv2; |
|
Lines 57-63
sub register {
Link Here
|
| 57 |
); |
56 |
); |
| 58 |
|
57 |
|
| 59 |
foreach my $plugin ( @plugins ) { |
58 |
foreach my $plugin ( @plugins ) { |
| 60 |
$spec = $self->inject_routes( $spec, $plugin, $validate ); |
59 |
$spec = $self->inject_routes( $spec, $plugin, $validate, $app->log ); |
| 61 |
} |
60 |
} |
| 62 |
|
61 |
|
| 63 |
} |
62 |
} |
|
Lines 70-76
sub register {
Link Here
|
| 70 |
=cut |
69 |
=cut |
| 71 |
|
70 |
|
| 72 |
sub inject_routes { |
71 |
sub inject_routes { |
| 73 |
my ( $self, $spec, $plugin, $validate ) = @_; |
72 |
my ( $self, $spec, $plugin, $validate, $logger ) = @_; |
| 74 |
|
73 |
|
| 75 |
return merge_spec( $spec, $plugin ) unless $validate; |
74 |
return merge_spec( $spec, $plugin ) unless $validate; |
| 76 |
|
75 |
|
|
Lines 91-98
sub inject_routes {
Link Here
|
| 91 |
catch { |
90 |
catch { |
| 92 |
my $error = $_; |
91 |
my $error = $_; |
| 93 |
my $class = ref $plugin; |
92 |
my $class = ref $plugin; |
| 94 |
my $logger = Koha::Logger->get({ interface => 'api' }); |
93 |
$logger->error( "Plugin $class route injection failed: $error" ); |
| 95 |
$logger->error("Plugin $class route injection failed: $error"); |
|
|
| 96 |
return $spec; |
94 |
return $spec; |
| 97 |
}; |
95 |
}; |
| 98 |
} |
96 |
} |
| 99 |
- |
|
|