Remove the last instances of json pattern
In the past, we've tried to erradicate the use of
nlohmann::json(initiatlizer_list<...>) because it bloats binary sizes,
as every type is given a new nlohmann constructor.
This commit hunts down the last few places where we call this. There is
still 2 remaining in openbmc_dbus_rest after this, but those are variant
accesses that are difficult to triage, and considering it's a less used
api, they're left as is.
Tested: WIP
Change-Id: Iaac24584bb78bb238da69010b511c1d598bd38bc
Signed-off-by: Ed Tanous <ed@tanous.net>
diff --git a/redfish-core/lib/log_services.hpp b/redfish-core/lib/log_services.hpp
index 2524502..34a3aff 100644
--- a/redfish-core/lib/log_services.hpp
+++ b/redfish-core/lib/log_services.hpp
@@ -1420,12 +1420,11 @@
asyncResp->res.jsonValue["Entries"]["@odata.id"] =
std::format("/redfish/v1/Systems/{}/LogServices/EventLog/Entries",
BMCWEB_REDFISH_SYSTEM_URI_NAME);
- asyncResp->res.jsonValue["Actions"]["#LogService.ClearLog"] = {
+ asyncResp->res.jsonValue["Actions"]["#LogService.ClearLog"]["target"]
- {"target",
- std::format(
- "/redfish/v1/Systems/{}/LogServices/EventLog/Actions/LogService.ClearLog",
- BMCWEB_REDFISH_SYSTEM_URI_NAME)}};
+ = std::format(
+ "/redfish/v1/Systems/{}/LogServices/EventLog/Actions/LogService.ClearLog",
+ BMCWEB_REDFISH_SYSTEM_URI_NAME);
});
}
@@ -3989,11 +3988,10 @@
asyncResp->res.jsonValue["DateTimeLocalOffset"] =
redfishDateTimeOffset.second;
- asyncResp->res.jsonValue["Actions"]["#LogService.ClearLog"] = {
- {"target",
- std::format(
- "/redfish/v1/Systems/{}/LogServices/PostCodes/Actions/LogService.ClearLog",
- BMCWEB_REDFISH_SYSTEM_URI_NAME)}};
+ asyncResp->res.jsonValue["Actions"]["#LogService.ClearLog"]
+ ["target"] = std::format(
+ "/redfish/v1/Systems/{}/LogServices/PostCodes/Actions/LogService.ClearLog",
+ BMCWEB_REDFISH_SYSTEM_URI_NAME);
});
}