Commit 2879534b authored by Hugo Kreber's avatar Hugo Kreber
Browse files

Patches for keyvalueTags/payload and json issues

parent 83774513
Loading
Loading
Loading
Loading
+8 −4
Original line number Diff line number Diff line
@@ -2,10 +2,14 @@
patch -u ../api/DefaultApi.h -i fixHeaderModelIssue.patch
patch -u ../api/DefaultApi.cpp -i fixCppModelIssue.patch
patch -u ../api/TrackablesApi.cpp -i fixCppTrackable.patch
patch -u ../api/WorldAnchorsApi.cpp -i fixCppWorldAnchor.patch
patch -u ../api/WorldLinksApi.cpp -i fixCppWorldLink.patch
patch -u ../api/WorldAnchorsApi.cpp -i fixCppWorldAnchors.patch
patch -u ../api/WorldLinksApi.cpp -i fixCppWorldLinks.patch
patch -u ../api/RelocalizationInformationApi.cpp -i fixCppRelocalizationInformation.patch
patch -u ../model/WorldLink.cpp -i fixCppWorldLinkModel.patch
patch -u ../model/WorldLink.cpp -i fixCppWorldLinksModel.patch
patch -u ../model/WorldAnchor.cpp -i fixCppWorldAnchorModel.patch
patch -u ../model/Trackable.cpp -i fixCppTrackableModel.patch
patch -u ../model/helpers.h -i fixHelperHeader.patch
patch -u ../model/RelocalizationInformation.cpp -i fixCppRelocalizationInformationModel.patch
patch -u ../model/RelocalizationInformationParam.cpp -i fixCppRelocalizationInformationParamModel.patch
patch -u ../model/GetRelocalizationInformation_200_response.cpp -i fixCppGetRelocResponse.patch
patch -u ../model/Capability.cpp -i fixCppCapabilityModel.patch
+20 −0
Original line number Diff line number Diff line
diff --git a/EtsiServerGen/model/Capability.cpp b/../../world-storage-cpp-server/EtsiServerGen/model/Capability.cpp
index 8df709d..442bc9d 100644
--- a/EtsiServerGen/model/Capability.cpp
+++ b/../../world-storage-cpp-server/EtsiServerGen/model/Capability.cpp
@@ -63,6 +63,7 @@ ptree Capability::toPropertyTree() const
 {
 	ptree pt;
 	ptree tmp_node;
+    pt.put("trackableType", m_TrackableType.getEnumValue());
 	pt.add_child("encodingInformation", m_EncodingInformation.toPropertyTree());
 	pt.put("framerate", m_Framerate);
 	pt.put("latency", m_Latency);
@@ -73,6 +74,7 @@ ptree Capability::toPropertyTree() const
 void Capability::fromPropertyTree(ptree const &pt)
 {
 	ptree tmp_node;
+    m_TrackableType.setEnumValue(pt.get("trackableType",""));
 	if (pt.get_child_optional("encodingInformation")) {
         m_EncodingInformation = fromPt<EncodingInformationStructure>(pt.get_child("encodingInformation"));
 	}
+14 −0
Original line number Diff line number Diff line
diff --git a/EtsiServerGen/model/GetRelocalizationInformation_200_response.cpp b/../../world-storage-cpp-server/EtsiServerGen/model/GetRelocalizationInformation_200_response.cpp
index d6f90df..ce6079e 100644
--- a/EtsiServerGen/model/GetRelocalizationInformation_200_response.cpp
+++ b/../../world-storage-cpp-server/EtsiServerGen/model/GetRelocalizationInformation_200_response.cpp
@@ -47,6 +47,9 @@ std::string GetRelocalizationInformation_200_response::toJsonString(bool prettyJ
     // workaround inspired by: https://stackoverflow.com/a/56395440
     std::regex reg("\\\"([0-9]+\\.{0,1}[0-9]*)\\\"");
     std::string result = std::regex_replace(ss.str(), reg, "$1");
+
+    result.erase(std::remove(result.begin(), result.end(), '|'), result.end());
+
     return result;
 }
 
+18 −8
Original line number Diff line number Diff line
--- RelocalizationInformationApi_origin.cpp	2024-05-17 22:17:55.668925905 +0200
+++ RelocalizationInformationApi.cpp	2024-05-17 22:19:17.209012284 +0200
diff --git a/EtsiServerGen/api/RelocalizationInformationApi.cpp b/../../world-storage-cpp-server/EtsiServerGen/api/RelocalizationInformationApi.cpp
index f332ad2..6ba51b8 100644
--- a/EtsiServerGen/api/RelocalizationInformationApi.cpp
+++ b/../../world-storage-cpp-server/EtsiServerGen/api/RelocalizationInformationApi.cpp
@@ -22,7 +22,7 @@
 #include <boost/algorithm/string.hpp>
 
@@ -9,11 +11,10 @@
 namespace org {
 namespace openapitools {
 namespace server {
@@ -155,21 +155,29 @@
@@ -155,21 +155,28 @@ void RelocalizationInformationResource::defaultSessionClose(const std::shared_pt
 
 void RelocalizationInformationResource::handler_GET_internal(const std::shared_ptr<restbed::Session> session)
 {
+    std::cout << "start handler_GET_internal\n" ;
+
     const auto request = session->get_request();
     // Getting the query params
@@ -48,7 +49,15 @@
     int status_code = 500;
     GetRelocalizationInformation_200_response resultObject = GetRelocalizationInformation_200_response{};
     std::string result = "";
@@ -209,7 +217,7 @@
@@ -202,22 +209,22 @@ void RelocalizationInformationResource::handler_GET_internal(const std::shared_p
         }
     
         result = resultObject.toJsonString();
-        returnResponse(session, 200, result.empty() ? "{}" : result, responseHeaders);
+        returnResponse(session, 200, result.empty() ? "empty" : result, responseHeaders);
         return;
     }
     if (status_code == 400) {
         responseHeaders.insert(std::make_pair("Content-Type", "text/plain"));
         result = "Invalid UUID supplied.";
     
@@ -57,12 +66,13 @@
         returnResponse(session, 400, result.empty() ? "{}" : result, responseHeaders);
         return;
     }
@@ -217,7 +225,7 @@
     if (status_code == 404) {
         responseHeaders.insert(std::make_pair("Content-Type", "text/plain"));
         result = "Not found, could not find UUID in database.";
-        result = "Not found, could not find UUID in database.";
+        result = "Not found, could not find UUID or Supported content in database.";
     
-        result = resultObject;
+        result = resultObject.toJsonString();
+  
         returnResponse(session, 404, result.empty() ? "{}" : result, responseHeaders);
         return;
     }
+21 −0
Original line number Diff line number Diff line
diff --git a/EtsiServerGen/model/RelocalizationInformation.cpp b/../../world-storage-cpp-server/EtsiServerGen/model/RelocalizationInformation.cpp
index 46fd7ec..8a020e9 100644
--- a/EtsiServerGen/model/RelocalizationInformation.cpp
+++ b/../../world-storage-cpp-server/EtsiServerGen/model/RelocalizationInformation.cpp
@@ -64,6 +64,7 @@ ptree RelocalizationInformation::toPropertyTree() const
 	ptree pt;
 	ptree tmp_node;
 	pt.put("requestUUID", m_RequestUUID);
+    pt.put("requestType", m_RequestType.getEnumValue());
 	// generate tree for RelocObjects
     tmp_node.clear();
 	if (!m_RelocObjects.empty()) {
@@ -78,6 +79,8 @@ void RelocalizationInformation::fromPropertyTree(ptree const &pt)
 {
 	ptree tmp_node;
 	m_RequestUUID = pt.get("requestUUID", "");
+    m_RequestType.setEnumValue(pt.get("requestType",""));
+
 	// push all items of RelocObjects into member
 	if (pt.get_child_optional("relocObjects")) {
         m_RelocObjects = fromPt<std::vector<RelocalizationInformation_relocObjects_inner>>(pt.get_child("relocObjects"));
Loading