summaryrefslogtreecommitdiff
path: root/redfish-core/include
diff options
context:
space:
mode:
authorEd Tanous <edtanous@google.com>2022-06-28 00:25:40 +0300
committerEd Tanous <ed@tanous.net>2023-06-13 22:41:41 +0300
commit95b3ad73215c7073fd18ff9344a8b793c6f96162 (patch)
tree1fef967634bccb9ed3e6a098751e5bdc85a963e5 /redfish-core/include
parent14fbced62e8e6e7e2d9c948f287fbde30721489a (diff)
downloadbmcweb-95b3ad73215c7073fd18ff9344a8b793c6f96162.tar.xz
Make redfish::messages rely on typesafe structures
The previous patches modified these fields one at a time, for the cases where we had code calling these in odd ways. This commit goes and effects the same change on the rest of the message handlers where it makes sense. Any input to a message function that mentions a "value" replaces the value with a nlohmann::json object, to make calling this code easier. The one exception is StringValueTooLong, which by definition, requires the input value to be a string, so that is left as string_view intentionally. Tested: Dead unused code. Code compiles. Signed-off-by: Ed Tanous <edtanous@google.com> Change-Id: I00b9804b2aadf5584032be91a0ee53b9a94a7430
Diffstat (limited to 'redfish-core/include')
-rw-r--r--redfish-core/include/error_messages.hpp36
1 files changed, 20 insertions, 16 deletions
diff --git a/redfish-core/include/error_messages.hpp b/redfish-core/include/error_messages.hpp
index c49ac3319e..6f1e4e8911 100644
--- a/redfish-core/include/error_messages.hpp
+++ b/redfish-core/include/error_messages.hpp
@@ -85,11 +85,12 @@ void resourceMissingAtURI(crow::Response& res, boost::urls::url_view arg1);
* @param[in] arg3 Parameter of message that will replace %3 in its body.
*
* @returns Message ActionParameterValueFormatError formatted to JSON */
-nlohmann::json actionParameterValueFormatError(std::string_view arg1,
+nlohmann::json actionParameterValueFormatError(const nlohmann::json& arg1,
std::string_view arg2,
std::string_view arg3);
-void actionParameterValueFormatError(crow::Response& res, std::string_view arg1,
+void actionParameterValueFormatError(crow::Response& res,
+ const nlohmann::json& arg1,
std::string_view arg2,
std::string_view arg3);
@@ -277,10 +278,10 @@ void propertyValueNotInList(crow::Response& res, const nlohmann::json& arg1,
* @param[in] arg2 Parameter of message that will replace %2 in its body.
*
* @returns Message PropertyValueExternalConflict formatted to JSON */
-nlohmann::json propertyValueOutOfRange(std::string_view arg1,
+nlohmann::json propertyValueOutOfRange(const nlohmann::json& arg1,
std::string_view arg2);
-void propertyValueOutOfRange(crow::Response& res, std::string_view arg1,
+void propertyValueOutOfRange(crow::Response& res, const nlohmann::json& arg1,
std::string_view arg2);
/**
@@ -457,11 +458,11 @@ void propertyValueConflict(crow::Response& res, std::string_view arg1,
*
* @returns Message PropertyValueResourceConflict to JSON */
nlohmann::json propertyValueResourceConflict(std::string_view arg1,
- std::string_view arg2,
+ const nlohmann::json& arg2,
boost::urls::url_view arg3);
void propertyValueResourceConflict(crow::Response& res, std::string_view arg1,
- std::string_view arg2,
+ const nlohmann::json& arg2,
boost::urls::url_view arg3);
/**
@@ -475,10 +476,10 @@ void propertyValueResourceConflict(crow::Response& res, std::string_view arg1,
*
* @returns Message PropertyValueExternalConflict formatted to JSON */
nlohmann::json propertyValueExternalConflict(std::string_view arg1,
- std::string_view arg2);
+ const nlohmann::json& arg2);
void propertyValueExternalConflict(crow::Response& res, std::string_view arg1,
- std::string_view arg2);
+ const nlohmann::json& arg2);
/**
* @brief Formats PropertyValueIncorrect message into JSON
@@ -625,10 +626,11 @@ void propertyNotWritable(crow::Response& res, std::string_view arg1);
* @param[in] arg2 Parameter of message that will replace %2 in its body.
*
* @returns Message QueryParameterValueTypeError formatted to JSON */
-nlohmann::json queryParameterValueTypeError(std::string_view arg1,
+nlohmann::json queryParameterValueTypeError(const nlohmann::json& arg1,
std::string_view arg2);
-void queryParameterValueTypeError(crow::Response& res, std::string_view arg1,
+void queryParameterValueTypeError(crow::Response& res,
+ const nlohmann::json& arg1,
std::string_view arg2);
/**
@@ -839,11 +841,12 @@ void resourceInStandby(crow::Response& res);
* @param[in] arg3 Parameter of message that will replace %3 in its body.
*
* @returns Message ActionParameterValueTypeError formatted to JSON */
-nlohmann::json actionParameterValueTypeError(std::string_view arg1,
+nlohmann::json actionParameterValueTypeError(const nlohmann::json& arg1,
std::string_view arg2,
std::string_view arg3);
-void actionParameterValueTypeError(crow::Response& res, std::string_view arg1,
+void actionParameterValueTypeError(crow::Response& res,
+ const nlohmann::json& arg1,
std::string_view arg2,
std::string_view arg3);
@@ -944,10 +947,10 @@ void insufficientPrivilege(crow::Response& res);
*
* @returns Message PropertyValueModified formatted to JSON */
nlohmann::json propertyValueModified(std::string_view arg1,
- std::string_view arg2);
+ const nlohmann::json& arg2);
void propertyValueModified(crow::Response& res, std::string_view arg1,
- std::string_view arg2);
+ const nlohmann::json& arg2);
/**
* @brief Formats AccountNotModified message into JSON
@@ -969,10 +972,11 @@ void accountNotModified(crow::Response& res);
*
* @returns Message QueryParameterValueFormatError formatted to JSON */
-nlohmann::json queryParameterValueFormatError(std::string_view arg1,
+nlohmann::json queryParameterValueFormatError(const nlohmann::json& arg1,
std::string_view arg2);
-void queryParameterValueFormatError(crow::Response& res, std::string_view arg1,
+void queryParameterValueFormatError(crow::Response& res,
+ const nlohmann::json& arg1,
std::string_view arg2);
/**