Merging create and initiate messages. (#54)

This commit is contained in:
Savinda Senevirathne
2021-08-23 15:09:35 +05:30
committed by GitHub
parent 69bcad18c2
commit 596ff4a3bc
5 changed files with 310 additions and 265 deletions

View File

@@ -138,22 +138,23 @@ namespace msg::json
*/
int extract_initiate_message(initiate_msg &msg, const jsoncons::json &d)
{
if (extract_type(msg.type, d) == -1)
return -1;
// Commented out when merging create and initiate messages.
// if (extract_type(msg.type, d) == -1)
// return -1;
if (!d.contains(msg::FLD_CONTAINER_NAME))
{
LOG_ERROR << "Field container_name is missing.";
return -1;
}
// if (!d.contains(msg::FLD_CONTAINER_NAME))
// {
// LOG_ERROR << "Field container_name is missing.";
// return -1;
// }
if (!d[msg::FLD_CONTAINER_NAME].is<std::string>())
{
LOG_ERROR << "Invalid container_name value.";
return -1;
}
// if (!d[msg::FLD_CONTAINER_NAME].is<std::string>())
// {
// LOG_ERROR << "Invalid container_name value.";
// return -1;
// }
msg.container_name = d[msg::FLD_CONTAINER_NAME].as<std::string>();
// msg.container_name = d[msg::FLD_CONTAINER_NAME].as<std::string>();
if (!d.contains(msg::FLD_CONFIG))
{
LOG_ERROR << "Field config is missing.";