[Bug 21116] New: Add API routes through plugins
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=21116 Bug ID: 21116 Summary: Add API routes through plugins Change sponsored?: --- Product: Koha Version: master Hardware: All OS: All Status: NEW Severity: new feature Priority: P5 - low Component: REST api Assignee: koha-bugs@lists.koha-community.org Reporter: tomascohen@gmail.com We should have a way to add routes using specially crafted plugins. The plugins should provide the following methods to be considered valid API-generating plugins: - 'api_routes': returning the 'path' component of the OpenAPI specification corresponding to the routes served by the plugin - 'api_namespace': it should return a namespace to be used for grouping the endpoints provided by the plugin Plugin-generated routes will be placed inside /contrib/<namespace>, where <namespace> is what the 'api_namespace' returns. -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=21116 Tomás Cohen Arazi <tomascohen@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Assignee|koha-bugs@lists.koha-commun |tomascohen@gmail.com |ity.org | CC| |kyle@bywatersolutions.com, | |larit@live.fi, | |martin.renvoize@ptfs-europe | |.com -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=21116 --- Comment #1 from Tomás Cohen Arazi <tomascohen@gmail.com> --- Created attachment 77274 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=77274&action=edit Bug 21116: Add API routes through plugins This patch adds plugins the capability of injecting new routes on the API. The plugins should provide the following methods to be considered valid API-generating plugins: - 'api_routes': returning the 'path' component of the OpenAPI specification corresponding to the routes served by the plugin - 'api_namespace': it should return a namespace to be used for grouping the endpoints provided by the plugin otherwise, they will be just skipped. All plugin-generated routes will be added the 'contrib' namespace, and will end up placed inside /contrib/<namespace>, where <namespace> is what the 'api_namespace' returns. A sample endpoint will be added to the Kitchen Sink plugin, and tests are being written. To test, wait a bit more for those samples :-D -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=21116 Tomás Cohen Arazi <tomascohen@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |ASSIGNED -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=21116 Tomás Cohen Arazi <tomascohen@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |benjamin.rokseth@deichman.n | |o -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=21116 Tomás Cohen Arazi <tomascohen@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|ASSIGNED |Needs Signoff -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=21116 --- Comment #2 from Tomás Cohen Arazi <tomascohen@gmail.com> --- The KitchenSink plugin [1] already implements a sample contrib endpoint using this :-D YAY! [1] https://github.com/bywatersolutions/koha-plugin-kitchen-sink/commit/e7da3c40... -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=21116 --- Comment #3 from Kyle M Hall <kyle@bywatersolutions.com> --- Download link for the kpz file: https://github.com/bywatersolutions/koha-plugin-kitchen-sink/releases/downlo... -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=21116 Benjamin Rokseth <benjamin.rokseth@deichman.no> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #77274|0 |1 is obsolete| | --- Comment #4 from Benjamin Rokseth <benjamin.rokseth@deichman.no> --- Created attachment 77601 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=77601&action=edit Bug 21116: Add API routes through plugins This patch adds plugins the capability of injecting new routes on the API. The plugins should provide the following methods to be considered valid API-generating plugins: - 'api_routes': returning the 'path' component of the OpenAPI specification corresponding to the routes served by the plugin - 'api_namespace': it should return a namespace to be used for grouping the endpoints provided by the plugin otherwise, they will be just skipped. All plugin-generated routes will be added the 'contrib' namespace, and will end up placed inside /contrib/<namespace>, where <namespace> is what the 'api_namespace' returns. A sample endpoint will be added to the Kitchen Sink plugin, and tests are being written. To test, wait a bit more for those samples :-D Signed-off-by: Benjamin Rokseth <benjamin.rokseth@deichman.no> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=21116 Benjamin Rokseth <benjamin.rokseth@deichman.no> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Needs Signoff |Signed Off --- Comment #5 from Benjamin Rokseth <benjamin.rokseth@deichman.no> --- Tested according to plan: patched, added kitchen sink plugin, verified swagger schema and new 'contrib' endpoint : PUT /api/v1/contrib/kitchensink/patrons/{patron_id}/bother gave expected result: {"bothered":true} A very interesting and non-obtrusive approach to a common problem (feature creep)! -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=21116 --- Comment #6 from Tomás Cohen Arazi <tomascohen@gmail.com> --- Created attachment 78194 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=78194&action=edit Bug 21116: Unit tests This path implements unit tests for the route-from-plugin development. It adds the required methods to the Koha::Plugin::Test plugin distributed along with the tests. A second plugin implementing invalid OpenAPI specs is added (Koha::Plugin::BadAPIRoute). Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=21116 Tomás Cohen Arazi <tomascohen@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #77601|0 |1 is obsolete| | --- Comment #7 from Tomás Cohen Arazi <tomascohen@gmail.com> --- Created attachment 78195 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=78195&action=edit Bug 21116: Add API routes through plugins This patch adds plugins the capability of injecting new routes on the API. The plugins should provide the following methods to be considered valid API-generating plugins: - 'api_routes': returning the 'path' component of the OpenAPI specification corresponding to the routes served by the plugin - 'api_namespace': it should return a namespace to be used for grouping the endpoints provided by the plugin otherwise, they will be just skipped. All plugin-generated routes will be added the 'contrib' namespace, and will end up placed inside /contrib/<namespace>, where <namespace> is what the 'api_namespace' returns. A sample endpoint will be added to the Kitchen Sink plugin, and tests are being written. To test: - Apply this patches - Run: $ kshell k$ prove t/db_dependent/Koha/REST/Plugin/PluginRoutes.t => SUCCESS: Tests pass! - Install the (latest) KitchenSink plugin - Point your browser to the API like this: http://koha-intra.myDNSname.org:8081/api/v1/.html => SUCCESS: The /contrib/kitchensink/patrons/:patron_id/bother endpoint implemented by the plugin has been merged! - Sign off! :-D Signed-off-by: Benjamin Rokseth <benjamin.rokseth@deichman.no> Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=21116 Alex Arnaud <alex.arnaud@biblibre.com> changed: What |Removed |Added ---------------------------------------------------------------------------- QA Contact| |alex.arnaud@biblibre.com CC| |alex.arnaud@biblibre.com -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=21116 Alex Arnaud <alex.arnaud@biblibre.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #78194|0 |1 is obsolete| | --- Comment #8 from Alex Arnaud <alex.arnaud@biblibre.com> --- Created attachment 78322 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=78322&action=edit Bug 21116: Unit tests This path implements unit tests for the route-from-plugin development. It adds the required methods to the Koha::Plugin::Test plugin distributed along with the tests. A second plugin implementing invalid OpenAPI specs is added (Koha::Plugin::BadAPIRoute). Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> Signed-off-by: Alex Arnaud <alex.arnaud@biblibre.com> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=21116 Alex Arnaud <alex.arnaud@biblibre.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #78195|0 |1 is obsolete| | --- Comment #9 from Alex Arnaud <alex.arnaud@biblibre.com> --- Created attachment 78323 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=78323&action=edit Bug 21116: Add API routes through plugins This patch adds plugins the capability of injecting new routes on the API. The plugins should provide the following methods to be considered valid API-generating plugins: - 'api_routes': returning the 'path' component of the OpenAPI specification corresponding to the routes served by the plugin - 'api_namespace': it should return a namespace to be used for grouping the endpoints provided by the plugin otherwise, they will be just skipped. All plugin-generated routes will be added the 'contrib' namespace, and will end up placed inside /contrib/<namespace>, where <namespace> is what the 'api_namespace' returns. A sample endpoint will be added to the Kitchen Sink plugin, and tests are being written. To test: - Apply this patches - Run: $ kshell k$ prove t/db_dependent/Koha/REST/Plugin/PluginRoutes.t => SUCCESS: Tests pass! - Install the (latest) KitchenSink plugin - Point your browser to the API like this: http://koha-intra.myDNSname.org:8081/api/v1/.html => SUCCESS: The /contrib/kitchensink/patrons/:patron_id/bother endpoint implemented by the plugin has been merged! - Sign off! :-D Signed-off-by: Benjamin Rokseth <benjamin.rokseth@deichman.no> Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> Signed-off-by: Alex Arnaud <alex.arnaud@biblibre.com> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=21116 Alex Arnaud <alex.arnaud@biblibre.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Signed Off |Passed QA -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=21116 Tomás Cohen Arazi <tomascohen@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #78322|0 |1 is obsolete| | --- Comment #10 from Tomás Cohen Arazi <tomascohen@gmail.com> --- Created attachment 78542 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=78542&action=edit Bug 21116: Unit tests This path implements unit tests for the route-from-plugin development. It adds the required methods to the Koha::Plugin::Test plugin distributed along with the tests. A second plugin implementing invalid OpenAPI specs is added (Koha::Plugin::BadAPIRoute). Edit: I made terminology changes to make it less rude. Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> Signed-off-by: Alex Arnaud <alex.arnaud@biblibre.com> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=21116 Tomás Cohen Arazi <tomascohen@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #78323|0 |1 is obsolete| | --- Comment #11 from Tomás Cohen Arazi <tomascohen@gmail.com> --- Created attachment 78543 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=78543&action=edit Bug 21116: Add API routes through plugins This patch adds plugins the capability of injecting new routes on the API. The plugins should provide the following methods to be considered valid API-generating plugins: - 'api_routes': returning the 'path' component of the OpenAPI specification corresponding to the routes served by the plugin - 'api_namespace': it should return a namespace to be used for grouping the endpoints provided by the plugin otherwise, they will be just skipped. All plugin-generated routes will be added the 'contrib' namespace, and will end up placed inside /contrib/<namespace>, where <namespace> is what the 'api_namespace' returns. A sample endpoint will be added to the Kitchen Sink plugin, and tests are being written. To test: - Apply this patches - Run: $ kshell k$ prove t/db_dependent/Koha/REST/Plugin/PluginRoutes.t => SUCCESS: Tests pass! - Install the (latest) KitchenSink plugin - Point your browser to the API like this: http://koha-intra.myDNSname.org:8081/api/v1/.html => SUCCESS: The /contrib/kitchensink/patrons/:patron_id/bother endpoint implemented by the plugin has been merged! - Sign off! :-D Signed-off-by: Benjamin Rokseth <benjamin.rokseth@deichman.no> Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> Signed-off-by: Alex Arnaud <alex.arnaud@biblibre.com> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=21116 Ere Maijala <ere.maijala@helsinki.fi> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |ere.maijala@helsinki.fi -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=21116 Tomás Cohen Arazi <tomascohen@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- See Also| |https://bugs.koha-community | |.org/bugzilla3/show_bug.cgi | |?id=21334 -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=21116 Nick Clemens <nick@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Passed QA |Pushed to Master CC| |nick@bywatersolutions.com --- Comment #12 from Nick Clemens <nick@bywatersolutions.com> --- Awesome work all! Pushed to master for 18.11 -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=21116 Martin Renvoize <martin.renvoize@ptfs-europe.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Pushed to Master |Pushed to Stable --- Comment #13 from Martin Renvoize <martin.renvoize@ptfs-europe.com> --- Pushed to 18.05.x for 18.05.04. After deliberating on this one for a while, I've decided to backport it for similar reasons to bug 20942. It is not immediately user facing and as such will not be a surprise to end users. It does, however, encourage plugin developers to develop and test against a stable koha earlier and open up the option for a wider supported koha version range in plugins. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=21116 Fridolin SOMERS <fridolin.somers@biblibre.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |fridolin.somers@biblibre.co | |m Resolution|--- |FIXED Status|Pushed to Stable |RESOLVED --- Comment #14 from Fridolin SOMERS <fridolin.somers@biblibre.com> --- New feature not pushed to 17.11.x to encourage upgrade ;) -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=21116 Martin Renvoize <martin.renvoize@ptfs-europe.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Keywords| |release-notes-needed -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=21116 David Cook <dcook@prosentient.com.au> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |dcook@prosentient.com.au -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=21116 Nick Clemens <nick@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Text to go in the| |Allows the extension of the release notes| |Koha API via plugins. This | |can allow for custom vendor | |integrations and | |prototyping of new routes. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=21116 --- Comment #15 from Fridolin SOMERS <fridolin.somers@biblibre.com> --- (In reply to Fridolin SOMERS from comment #14)
New feature not pushed to 17.11.x to encourage upgrade ;)
I changed my mind, plugins are great, it does no harm to have this in 17.11.x I haded a followup to remove use of Koha::Exceptions::Exception that needs Bug 20590. Pushed to 17.11.x for 17.11.13 -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=21116 Martin Renvoize <martin.renvoize@ptfs-europe.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Keywords|release-notes-needed | -- You are receiving this mail because: You are watching all bug changes.
participants (1)
-
bugzilla-daemon@bugs.koha-community.org