Bug 24700: Avoid validating REST API spec multiple times
authorEre Maijala <ere.maijala@helsinki.fi>
Thu, 20 Feb 2020 14:17:58 +0000 (16:17 +0200)
committerMartin Renvoize <martin.renvoize@ptfs-europe.com>
Fri, 27 Mar 2020 11:53:44 +0000 (11:53 +0000)
commit70109d4f94ecdd8f9fca49de180d0a5165afb93b
treec7e67a60d5f53fba12d69675f08d31089431c2f9
parenta44ce976f61299f893b415dc27a1864e1a028445
Bug 24700: Avoid validating REST API spec multiple times

This patch changes the spec loading so that it is fully loaded and merged with any plugin routes before validation. The individual parts are separately validated only if the resulting complete spec is invalid. Note: the OpenAPI plugin validates the spec given to it, so normally no manual validation is necessary.

Test plan:
1. prove -v t/db_dependent/Koha/REST/*
2. prove -v t/db_dependent/api/v1/*

Sponsored-by: The National Library of Finland
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Koha/REST/Plugin/PluginRoutes.pm
Koha/REST/V1.pm