Add OpenAPI to documentation

Change-Id: I49a372d346bdea68dfae3e169bd62822a0259218
diff --git a/Changes b/Changes
index 8cbeafa..025c619 100644
--- a/Changes
+++ b/Changes
@@ -1,4 +1,5 @@
 0.53 2024-03-15
+        - Add openapi url to documentation. (hebasta)
         - Solve a potential timing issue in VC rendering. (diewald)
         - Update DeReKo link in corpus specific localization. (hebasta)
         - News and announcements are now displayed in Safari (fixes #208). (hebasta) 
diff --git a/t/doc.t b/t/doc.t
index af5c2b0..4d5cd70 100644
--- a/t/doc.t
+++ b/t/doc.t
@@ -127,6 +127,13 @@
   ->status_is(200)
   ->text_is('#api-service-uri', 'https://korap.ids-mannheim.de/test/api/v1.0/');
 
+# Set openapi path
+$app->config('Kalamar')->{openapi} = '/api/v1.0/openapi/';
+
+# Check openapi endpoint
+$t->get_ok('/doc/api' => { 'X-Forwarded-Host' => 'korap.ids-mannheim.de' })
+  ->status_is(200)
+  ->element_exists('#openapi > a[href="https://korap.ids-mannheim.de/api/v1.0/openapi/"]');
 
 # Languages of dev pages
 $t->get_ok('/doc/development/kalamar')
diff --git a/templates/doc/api.html.ep b/templates/doc/api.html.ep
index 54174e7..3836981 100644
--- a/templates/doc/api.html.ep
+++ b/templates/doc/api.html.ep
@@ -6,8 +6,17 @@
   The specification for KoralQuery is available on <%= ext_link_to 'GitHub', "http://korap.github.io/Koral" %>.
   All API endpoints either use KoralQuery or are (more or lest) REST-ful web APIs.</p>
 
-<p>All publicly available API endpoints including their requests and responses are described in the <%= ext_link_to 'GitHub Wiki', "https://github.com/KorAP/Kustvakt/wiki" %> of <%= embedded_link_to 'doc', 'Kustvakt', 'korap', 'kustvakt' %>.</p>
+<p>All publicly available API endpoints (partially experimental) including their requests and responses are described in the <%= ext_link_to 'GitHub Wiki', "https://github.com/KorAP/Kustvakt/wiki" %> of <%= embedded_link_to 'doc', 'Kustvakt', 'korap', 'kustvakt' %>.</p>
 
 % my $api_url = $c->url_for('proxy' => (apiv => $Kalamar::API_VERSION))->to_abs->scheme('https');
 % $api_url->path->trailing_slash(1);
+
+%if ($c->app->config('Kalamar')->{openapi}) { 
+<p id="openapi">
+% my $openapi= $api_url->to_abs;
+% $openapi->path->merge($c->app->config('Kalamar')->{openapi})->trailing_slash(1); 
+The OpenAPI documentation is described <%= ext_link_to 'here',  $openapi  %>.
+</p>
+% } 
+
 <p>The root service can be found at <code id="api-service-uri"><%=  $api_url %></code>.</p>