From 188307b2b0eeef451c6edc46a171233e54a3de26 Mon Sep 17 00:00:00 2001
From: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Date: Wed, 1 May 2024 09:16:21 +0100
Subject: [PATCH] Bug 36546: (follow-up) Add fallback to unbundled spec

Some developers are running without ktd still and as such may not want
to install the node modules required to bundle the specification.

This patch adds a fallback to the unbundled yaml files when the
bundle.json file isn't found.

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
---
 Koha/REST/V1.pm | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/Koha/REST/V1.pm b/Koha/REST/V1.pm
index 66bae63d730..52bd15697ec 100644
--- a/Koha/REST/V1.pm
+++ b/Koha/REST/V1.pm
@@ -76,6 +76,9 @@ sub startup {
     }
 
     my $spec_file = $self->home->rel_file("api/v1/swagger/swagger_bundle.json");
+    if (!-f $spec_file) {
+        $spec_file = $self->home->rel_file("api/v1/swagger/swagger.yaml");
+    }
 
     push @{$self->routes->namespaces}, 'Koha::Plugin';
 
-- 
2.44.0