From 58bd97e934fc8efd828d56068deaad65e00dcc6d Mon Sep 17 00:00:00 2001
From: Martin Weise <martin.weise@tuwien.ac.at>
Date: Wed, 5 Feb 2025 21:16:10 +0100
Subject: [PATCH] Check openAPI version

Signed-off-by: Martin Weise <martin.weise@tuwien.ac.at>
---
 .docs/.openapi/api.base.yaml | 2 +-
 .gitlab-ci.yml               | 8 ++++++--
 2 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/.docs/.openapi/api.base.yaml b/.docs/.openapi/api.base.yaml
index ee32aad2ff..9fffb242ef 100644
--- a/.docs/.openapi/api.base.yaml
+++ b/.docs/.openapi/api.base.yaml
@@ -24,7 +24,7 @@ info:
     name: Apache 2.0
     url: https://www.apache.org/licenses/LICENSE-2.0
   title: DBRepo REST API
-  version: 1.6.2
+  version: 1.6.3
 openapi: 3.1.0
 servers:
   - description: Test Instance
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 85e5d640bb..9484ac0ebd 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -124,11 +124,15 @@ lint-open-api-version:
     VERSION: 4.45.1
     BINARY: yq_linux_amd64
   before_script:
+    - echo "${DOC_VERSION}" > ./doc-version.txt
+    - echo "${APP_VERSION}" > ./app-version.txt
     - 'apk --no-cache add bash wget'
     - 'wget https://github.com/mikefarah/yq/releases/download/v${VERSION}/${BINARY} -O /usr/bin/yq && chmod +x /usr/bin/yq'
   script:
-    - yq '.externalDocs.url' ./.docs/.openapi/api.base.yaml | grep "${DOC_VERSION}"
-    - yq '.info.version' ./.docs/.openapi/api.base.yaml | grep "${DOC_VERSION}"
+    - yq '.externalDocs.url' ./.docs/.openapi/api.base.yaml | grep "${DOC_VERSION}" > ./openapi-doc-version.txt
+    - diff ./openapi-doc-version.txt ./doc-version.txt
+    - yq '.info.version' ./.docs/.openapi/api.base.yaml | grep "${APP_VERSION}" > ./openapi-app-version.txt
+    - diff ./openapi-app-version.txt ./app-version.txt
 
 build-metadata-service:
   image: maven:3-openjdk-${JAVA_VERSION}
-- 
GitLab