Remove adl_serializer uses for json
Several pieces of code seems to be using the adl_serializer from
nlohmann. This unfortunately has very undesirable behavior in some
cases, and makes a lot of things really difficult to track back to the
function that did the serialization, which has caused several bugs in
the past with incorrect types.
This patchset removes them, and opts for the inline version of the
nlohmann json serialization.
Tested:
Booted bmcweb, and logged in.
cat bmcweb_persistent_data.json showed persistent data written properly.
Logged into bmc through webui-vue
systemctl restart bmcweb
Then refreshed webui-vue, and didn't get logged out.
Change-Id: I92868629c54d08b37dd1d956f7c2e2a954f9b670
diff --git a/redfish-core/lib/task.hpp b/redfish-core/lib/task.hpp
index 8083566..19973d9 100644
--- a/redfish-core/lib/task.hpp
+++ b/redfish-core/lib/task.hpp
@@ -80,14 +80,6 @@
nlohmann::json jsonBody;
};
-inline void to_json(nlohmann::json& j, const Payload& p)
-{
- j = {{"TargetUri", p.targetUri},
- {"HttpOperation", p.httpOperation},
- {"HttpHeaders", p.httpHeaders},
- {"JsonBody", p.jsonBody.dump()}};
-}
-
struct TaskData : std::enable_shared_from_this<TaskData>
{
private:
@@ -448,7 +440,12 @@
}
if (ptr->payload)
{
- asyncResp->res.jsonValue["Payload"] = *(ptr->payload);
+ const task::Payload& p = *(ptr->payload);
+ asyncResp->res.jsonValue["Payload"] = {
+ {"TargetUri", p.targetUri},
+ {"HttpOperation", p.httpOperation},
+ {"HttpHeaders", p.httpHeaders},
+ {"JsonBody", p.jsonBody.dump()}};
}
}
};