Make registries return an object_t
All the registry helper functions should return an object_t, given that
they're guaranteed to return an object. nlohmann::json as a type can
technically be string/int/bool/null/object/array, so it causes some
peculiarities in parsing.
Change-Id: If296477cb8d066d7f44ef0d12f17d94a5301e450
Signed-off-by: Ed Tanous <ed@tanous.net>
diff --git a/redfish-core/include/resource_messages.hpp b/redfish-core/include/resource_messages.hpp
index 0c5fc6a..98290ee 100644
--- a/redfish-core/include/resource_messages.hpp
+++ b/redfish-core/include/resource_messages.hpp
@@ -27,70 +27,73 @@
namespace messages
{
-nlohmann::json resourceCreated();
+nlohmann::json::object_t resourceCreated();
-nlohmann::json resourceRemoved();
+nlohmann::json::object_t resourceRemoved();
-nlohmann::json resourceErrorsDetected(std::string_view arg1,
- std::string_view arg2);
-
-nlohmann::json resourceErrorsCorrected(std::string_view arg1,
- std::string_view arg2);
-
-nlohmann::json resourceErrorThresholdExceeded(std::string_view arg1,
- std::string_view arg2);
-
-nlohmann::json resourceErrorThresholdCleared(std::string_view arg1,
- std::string_view arg2);
-
-nlohmann::json resourceWarningThresholdExceeded(std::string_view arg1,
+nlohmann::json::object_t resourceErrorsDetected(std::string_view arg1,
std::string_view arg2);
-nlohmann::json resourceWarningThresholdCleared(std::string_view arg1,
- std::string_view arg2);
+nlohmann::json::object_t resourceErrorsCorrected(std::string_view arg1,
+ std::string_view arg2);
-nlohmann::json resourceStatusChangedOK(std::string_view arg1,
- std::string_view arg2);
+nlohmann::json::object_t resourceErrorThresholdExceeded(std::string_view arg1,
+ std::string_view arg2);
-nlohmann::json resourceStatusChangedWarning(std::string_view arg1,
- std::string_view arg2);
+nlohmann::json::object_t resourceErrorThresholdCleared(std::string_view arg1,
+ std::string_view arg2);
-nlohmann::json resourceStatusChangedCritical(std::string_view arg1,
- std::string_view arg2);
+nlohmann::json::object_t resourceWarningThresholdExceeded(
+ std::string_view arg1, std::string_view arg2);
-nlohmann::json resourceStateChanged(std::string_view arg1,
- std::string_view arg2);
+nlohmann::json::object_t resourceWarningThresholdCleared(std::string_view arg1,
+ std::string_view arg2);
-nlohmann::json resourcePoweredOn(std::string_view arg1);
+nlohmann::json::object_t resourceStatusChangedOK(std::string_view arg1,
+ std::string_view arg2);
-nlohmann::json resourcePoweringOn(std::string_view arg1);
+nlohmann::json::object_t resourceStatusChangedWarning(std::string_view arg1,
+ std::string_view arg2);
-nlohmann::json resourcePoweredOff(std::string_view arg1);
+nlohmann::json::object_t resourceStatusChangedCritical(std::string_view arg1,
+ std::string_view arg2);
-nlohmann::json resourcePoweringOff(std::string_view arg1);
+nlohmann::json::object_t resourceStateChanged(std::string_view arg1,
+ std::string_view arg2);
-nlohmann::json resourcePaused(std::string_view arg1);
+nlohmann::json::object_t resourcePoweredOn(std::string_view arg1);
-nlohmann::json uRIForResourceChanged();
+nlohmann::json::object_t resourcePoweringOn(std::string_view arg1);
-nlohmann::json resourceChanged();
+nlohmann::json::object_t resourcePoweredOff(std::string_view arg1);
-nlohmann::json resourceVersionIncompatible(std::string_view arg1);
+nlohmann::json::object_t resourcePoweringOff(std::string_view arg1);
-nlohmann::json resourceSelfTestFailed(std::string_view arg1);
+nlohmann::json::object_t resourcePaused(std::string_view arg1);
-nlohmann::json resourceSelfTestCompleted();
+nlohmann::json::object_t uRIForResourceChanged();
-nlohmann::json testMessage();
+nlohmann::json::object_t resourceChanged();
-nlohmann::json aggregationSourceDiscovered(std::string_view arg1,
- std::string_view arg2);
+nlohmann::json::object_t resourceVersionIncompatible(std::string_view arg1);
-nlohmann::json licenseExpired(std::string_view arg1, std::string_view arg2);
+nlohmann::json::object_t resourceSelfTestFailed(std::string_view arg1);
-nlohmann::json licenseChanged(std::string_view arg1, std::string_view arg2);
+nlohmann::json::object_t resourceSelfTestCompleted();
-nlohmann::json licenseAdded(std::string_view arg1, std::string_view arg2);
+nlohmann::json::object_t testMessage();
+
+nlohmann::json::object_t aggregationSourceDiscovered(std::string_view arg1,
+ std::string_view arg2);
+
+nlohmann::json::object_t licenseExpired(std::string_view arg1,
+ std::string_view arg2);
+
+nlohmann::json::object_t licenseChanged(std::string_view arg1,
+ std::string_view arg2);
+
+nlohmann::json::object_t licenseAdded(std::string_view arg1,
+ std::string_view arg2);
} // namespace messages
} // namespace redfish