Bug 36546: Add a bundled version of the API spec
authorTomas Cohen Arazi <tomascohen@theke.io>
Tue, 23 Apr 2024 14:52:37 +0000 (11:52 -0300)
committerKatrin Fischer <katrin.fischer@bsz-bw.de>
Tue, 30 Apr 2024 12:32:09 +0000 (14:32 +0200)
commit3939830cdc067a2c9e176cf9aeeb94b81d0945ec
tree7b6eb44994edf5cc871c78202f6f1114e2dd5f94
parentb45c0e8999e5970fe5f23df18c6992c188aae9a3
Bug 36546: Add a bundled version of the API spec

This patch makes the Koha::REST::V1 class use a bundled version of the
API spec.

For that to happen, this patch also adds:

* a `yarn api:bundle` task for generating the `swagger_bundle.yaml`
  file
* the bundle file to `.gitignore`
* @redocly/cli to the packages.json dependencies (yarn add @redocly/cli)
* `api:bundle` is added to the `yarn build` general command

NOTE: A new workflow is introduced by this patch as developers will need
to call the `yarn api:bundle` command on each API spec change they make.

To test:
1. Have KTD running
2. Verify the API works as usual
=> SUCCESS: The API just works
3. Apply this patch
4. Run:
   $ ktd --shell
  k$ yarn api:bundle
5. Restart plack:
  k$ koha-plack --restart kohadev ; tail -f /var/log/koha/kohadev/*.log
=> SUCCESS: The API loads correctly
6. Repeat 2
=> SUCCESS: Nothing changed
7. Sign off :-D

Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
Signed-off-by: David Cook <dcook@prosentient.com.au>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
.gitignore
Koha/REST/V1.pm
package.json
yarn.lock