summaryrefslogtreecommitdiff
path: root/redfish-core/include
diff options
context:
space:
mode:
Diffstat (limited to 'redfish-core/include')
-rw-r--r--redfish-core/include/error_messages.hpp4
-rw-r--r--redfish-core/include/utils/json_utils.hpp24
2 files changed, 6 insertions, 22 deletions
diff --git a/redfish-core/include/error_messages.hpp b/redfish-core/include/error_messages.hpp
index 99e9ae8f37..77aa8958f8 100644
--- a/redfish-core/include/error_messages.hpp
+++ b/redfish-core/include/error_messages.hpp
@@ -571,10 +571,10 @@ void operationTimeout(crow::Response& res);
* @param[in] arg2 Parameter of message that will replace %2 in its body.
*
* @returns Message PropertyValueTypeError formatted to JSON */
-nlohmann::json propertyValueTypeError(std::string_view arg1,
+nlohmann::json propertyValueTypeError(const nlohmann::json& arg1,
std::string_view arg2);
-void propertyValueTypeError(crow::Response& res, std::string_view arg1,
+void propertyValueTypeError(crow::Response& res, const nlohmann::json& arg1,
std::string_view arg2);
/**
diff --git a/redfish-core/include/utils/json_utils.hpp b/redfish-core/include/utils/json_utils.hpp
index 7c701428af..6e18157fc0 100644
--- a/redfish-core/include/utils/json_utils.hpp
+++ b/redfish-core/include/utils/json_utils.hpp
@@ -219,20 +219,12 @@ bool unpackValue(nlohmann::json& jsonValue, std::string_view key,
{
if (!jsonValue.is_array())
{
- messages::propertyValueTypeError(
- res,
- res.jsonValue.dump(2, ' ', true,
- nlohmann::json::error_handler_t::replace),
- key);
+ messages::propertyValueTypeError(res, res.jsonValue, key);
return false;
}
if (jsonValue.size() != value.size())
{
- messages::propertyValueTypeError(
- res,
- res.jsonValue.dump(2, ' ', true,
- nlohmann::json::error_handler_t::replace),
- key);
+ messages::propertyValueTypeError(res, res.jsonValue, key);
return false;
}
size_t index = 0;
@@ -247,11 +239,7 @@ bool unpackValue(nlohmann::json& jsonValue, std::string_view key,
{
if (!jsonValue.is_array())
{
- messages::propertyValueTypeError(
- res,
- res.jsonValue.dump(2, ' ', true,
- nlohmann::json::error_handler_t::replace),
- key);
+ messages::propertyValueTypeError(res, res.jsonValue, key);
return false;
}
@@ -270,11 +258,7 @@ bool unpackValue(nlohmann::json& jsonValue, std::string_view key,
{
if (ec == UnpackErrorCode::invalidType)
{
- messages::propertyValueTypeError(
- res,
- jsonValue.dump(2, ' ', true,
- nlohmann::json::error_handler_t::replace),
- key);
+ messages::propertyValueTypeError(res, jsonValue, key);
}
else if (ec == UnpackErrorCode::outOfRange)
{