From 0a30a614bd1567d413883a82c476d6c654f8bc76 Mon Sep 17 00:00:00 2001
From: jroyan <jerome.royan@b-com.com>
Date: Tue, 17 Sep 2024 15:38:07 +0200
Subject: [PATCH] update code generation from the last version of OpenAPIs

---
 EtsiServerGen/patches/WorldAnalysisYaml.patch | 16 ++++++++++++++++
 EtsiServerGen/patches/applyPatches.sh         |  3 ++-
 EtsiServerGen/patches/applyYamlPatch.sh       |  2 ++
 EtsiServerGen/patches/fixCppPoseApi.patch     | 12 ++++++------
 arf005                                        |  2 +-
 package.json                                  |  2 +-
 6 files changed, 28 insertions(+), 9 deletions(-)
 create mode 100644 EtsiServerGen/patches/WorldAnalysisYaml.patch
 create mode 100755 EtsiServerGen/patches/applyYamlPatch.sh

diff --git a/EtsiServerGen/patches/WorldAnalysisYaml.patch b/EtsiServerGen/patches/WorldAnalysisYaml.patch
new file mode 100644
index 0000000..e2010f7
--- /dev/null
+++ b/EtsiServerGen/patches/WorldAnalysisYaml.patch
@@ -0,0 +1,16 @@
+diff --git a/API/worldanalysis/worldanalysisopenapi.yaml b/API/worldanalysis/worldanalysisopenapi.yaml
+index 436b258..e141fc1 100644
+--- a/API/worldanalysis/worldanalysisopenapi.yaml
++++ b/API/worldanalysis/worldanalysisopenapi.yaml
+@@ -140,7 +140,10 @@ paths:
+         description: Mode representing the context of the Relocalization information (AR device to WorldAnchor/Trackable or WorldAnchor/Trackable to AR device)
+         required: true
+         schema:
+-          $ref: '../common/commonopenapi.yaml#/components/schemas/Mode_WorldAnalysis'
++          description: Mode representing the context of the relocalization information (AR device to WorldAnchor/Trackable or WorldAnchor/Trackable to AR device)
++          type: string
++          enum: [TRACKABLES_TO_DEVICE, DEVICE_TO_TRACKABLES]
++          example: TRACKABLES_TO_DEVICE
+       responses: 
+         '200':
+           description: Successful operation.
diff --git a/EtsiServerGen/patches/applyPatches.sh b/EtsiServerGen/patches/applyPatches.sh
index f46e3ff..6843d6c 100755
--- a/EtsiServerGen/patches/applyPatches.sh
+++ b/EtsiServerGen/patches/applyPatches.sh
@@ -1,4 +1,5 @@
 #!/bin/bash
 patch -u ../api/DefaultApi.h -i fixHeaderDefaultApi.patch
 patch -u ../api/DefaultApi.cpp -i fixCppDefaultApi.patch
-patch -u ../api/PoseApi.cpp -i fixCppPoseApi.patch
\ No newline at end of file
+patch -u ../api/PoseApi.cpp -i fixCppPoseApi.patch
+#patch -u ../api/PoseApi.h -i fixHeaderPoseApi.patch
\ No newline at end of file
diff --git a/EtsiServerGen/patches/applyYamlPatch.sh b/EtsiServerGen/patches/applyYamlPatch.sh
new file mode 100755
index 0000000..fe8412c
--- /dev/null
+++ b/EtsiServerGen/patches/applyYamlPatch.sh
@@ -0,0 +1,2 @@
+#!/bin/bash
+cp ../arf005/API/worldanalysis/worldanalysisopenapi.yaml ../arf005/API/worldanalysis/worldanalysisopenapiPatched.yaml && patch -u ../arf005/API/worldanalysis/worldanalysisopenapiPatched.yaml -i ./patches/WorldAnalysisYaml.patch
\ No newline at end of file
diff --git a/EtsiServerGen/patches/fixCppPoseApi.patch b/EtsiServerGen/patches/fixCppPoseApi.patch
index 9c06932..b308545 100644
--- a/EtsiServerGen/patches/fixCppPoseApi.patch
+++ b/EtsiServerGen/patches/fixCppPoseApi.patch
@@ -1,11 +1,11 @@
---- PoseApi.cpp	2024-08-29 17:22:20.037445629 +0200
-+++ PoseApi_corrected.cpp	2024-08-29 16:56:57.582073400 +0200
-@@ -453,7 +453,7 @@
-     std::vector<GetPoses_uuid_parameter_inner> uuid;
+--- PoseApi.cpp	2024-09-17 15:11:41.869045502 +0200
++++ PoseApi_corrected.cpp	2024-09-17 15:12:57.909058480 +0200
+@@ -468,7 +468,7 @@
+     std::vector<UuidAndMode> uuid;
      std::vector<std::string> uuid_temp;
      boost::split(uuid_temp, uuid_raw, boost::is_any_of(","));
--    std::transform(uuid_temp.begin(), uuid_temp.end(), std::back_inserter(uuid), [](const auto& i){ GetPoses_uuid_parameter_inner ret; ret.fromString(i); return ret;});
-+    std::transform(uuid_temp.begin(), uuid_temp.end(), std::back_inserter(uuid), [](const auto& i){ GetPoses_uuid_parameter_inner ret; ret.setUuid(i); return ret;});
+-    std::transform(uuid_temp.begin(), uuid_temp.end(), std::back_inserter(uuid), [](const auto& i){ UuidAndMode ret; ret.fromString(i); return ret;});
++    std::transform(uuid_temp.begin(), uuid_temp.end(), std::back_inserter(uuid), [](const auto& i){ UuidAndMode ret; ret.fromJsonString(i); return ret;});
      // Getting the headers
      std::string token = request->get_header("token", "");
      std::string sessionID = request->get_header("sessionID", "");
diff --git a/arf005 b/arf005
index 11d0dac..0430c59 160000
--- a/arf005
+++ b/arf005
@@ -1 +1 @@
-Subproject commit 11d0dac99c94ccf7efcda826bf5bfdb56fde30cb
+Subproject commit 0430c599248eecaf5a0cb7ea41ff88b87efaec4c
diff --git a/package.json b/package.json
index bf8a8f5..005301c 100644
--- a/package.json
+++ b/package.json
@@ -18,7 +18,7 @@
   "description": "ISG ARF World Analysis Cpp Server",
   "main": "index.js",
   "scripts": {
-    "generate": "cd EtsiServerGen && java -jar /usr/local/lib/node_modules/@openapitools/openapi-generator-cli/versions/7.5.0.jar generate -i ../arf005/API/worldanalysis/worldanalysisopenapi.yaml --skip-validate-spec --type-mappings=set=std::vector -g cpp-restbed-server -o . && cd patches && ./applyPatches.sh",
+    "generate": "cd EtsiServerGen && ./patches/applyYamlPatch.sh && java -jar /usr/local/lib/node_modules/@openapitools/openapi-generator-cli/versions/7.5.0.jar generate -i ../arf005/API/worldanalysis/worldanalysisopenapiPatched.yaml --skip-validate-spec --type-mappings=set=std::vector -g cpp-restbed-server -o . && cd patches && ./applyPatches.sh",
     "build": "cd EtsiServerGen && conan install . --build=missing && cd build && cmake .. --preset conan-release && cd Release && cmake --build . && sudo make install"    
   },
   "devDependencies": {
-- 
GitLab