Fix regression in ComputerSystem
Despite the pseudo non-plural name "Links.Chassis", the Redfish schema
states that Chassis is an array of chassis, not a singular chassis.
While odd, we should obey the specification.
This resolves the regression introduced by 1476687de
Tested: Code compiles, code inspection looks correct.
Signed-off-by: Ed Tanous <edtanous@google.com>
Change-Id: I4d6d0554865e412137c44562d173a6efe3f88f4a
diff --git a/redfish-core/lib/systems.hpp b/redfish-core/lib/systems.hpp
index e136aea..58bab2d 100644
--- a/redfish-core/lib/systems.hpp
+++ b/redfish-core/lib/systems.hpp
@@ -2965,8 +2965,11 @@
getMainChassisId(
asyncResp, [](const std::string& chassisId,
const std::shared_ptr<bmcweb::AsyncResp>& aRsp) {
- aRsp->res.jsonValue["Links"]["Chassis"]["@odata.id"] =
- "/redfish/v1/Chassis/" + chassisId;
+ nlohmann::json::array_t chassisArray;
+ nlohmann::json& chassis = chassisArray.emplace_back();
+ chassis["@odata.id"] = "/redfish/v1/Chassis/" + chassisId;
+ aRsp->res.jsonValue["Links"]["Chassis"] =
+ std::move(chassisArray);
});
getLocationIndicatorActive(asyncResp);