Bug 18137: Migrate from Swagger2 to Mojolicious::Plugin::OpenAPI
commite2fc5247012a99b4242370248a061681d84174f2
authorLari Taskula <lari.taskula@jns.fi>
Fri, 17 Feb 2017 12:36:36 +0000 (17 14:36 +0200)
committerJonathan Druart <jonathan.druart@bugs.koha-community.org>
Thu, 21 Sep 2017 14:27:04 +0000 (21 11:27 -0300)
tree489f8ad26eb10f650eb7a03c58c23e9e2ac3947b
parentea6c6f3026adce1f0eecf58752f7ae01494d60ed
Bug 18137: Migrate from Swagger2 to Mojolicious::Plugin::OpenAPI

This patch migrates from Swagger2 to Mojolicious::Plugin::OpenAPI as Swagger2 is
no longer actively maintained.

This migration involves some minor changes to our Swagger specification documents
and to controllers. Each operation is migrated in following patches separately.
Please see Mojolicious::Plugin::OpenAPI and its tutorial for more documentation.

The patch also refactors some API authentication -related code by taking advantage
of Koha::Exceptions. Authentication is now handled via Mojolicious's "under->to"
functionality. The actual authentication & authorization checks are moved to
Koha::REST::V1::Auth. Added a HTTP 503 response for when database update is
required, instead of returning an authentication failure as before.

To test:
1. prove t/db_dependent/api/v1/auth.t

Signed-off-by: Olli-Antti Kivilahti <olli-antti.kivilahti@jns.fi>
Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Koha/REST/V1.pm
Koha/REST/V1/Auth.pm [copied from Koha/REST/V1.pm with 66% similarity]
t/db_dependent/api/v1/auth.t [new file with mode: 0644]