xref: /openbmc/bmcweb/features/redfish/include/error_message_utils.hpp (revision 5d92fffcbd59ade1fb0a24f65d0e15ce4e414927)
1*5d92fffcSrohitpai #pragma once
26c038f26SEd Tanous #include <nlohmann/json.hpp>
36c038f26SEd Tanous 
46c038f26SEd Tanous #include <string_view>
56c038f26SEd Tanous 
66c038f26SEd Tanous namespace redfish
76c038f26SEd Tanous {
86c038f26SEd Tanous 
96c038f26SEd Tanous namespace messages
106c038f26SEd Tanous {
116c038f26SEd Tanous 
126c038f26SEd Tanous constexpr const char* messageVersionPrefix = "Base.1.19.0.";
136c038f26SEd Tanous constexpr const char* messageAnnotation = "@Message.ExtendedInfo";
146c038f26SEd Tanous 
156c038f26SEd Tanous void moveErrorsToErrorJson(nlohmann::json& target, nlohmann::json& source);
166c038f26SEd Tanous void addMessageToJsonRoot(nlohmann::json& target,
176c038f26SEd Tanous                           const nlohmann::json& message);
186c038f26SEd Tanous 
196c038f26SEd Tanous void addMessageToJson(nlohmann::json& target, const nlohmann::json& message,
206c038f26SEd Tanous                       std::string_view fieldPath);
216c038f26SEd Tanous 
226c038f26SEd Tanous void addMessageToErrorJson(nlohmann::json& target,
236c038f26SEd Tanous                            const nlohmann::json& message);
246c038f26SEd Tanous } // namespace messages
256c038f26SEd Tanous } // namespace redfish
26