- Reduced validation to simply checking that a description attribute is present.
  This is the bare minimum for the Task(const std::string&) contructor.
This commit is contained in:
Paul Beckingham 2014-10-18 17:23:39 -04:00
parent 21bbedbfc5
commit 8d75d0c7f3

View file

@ -415,7 +415,6 @@ bool Hooks::isJSON (const std::string& input) const
{
// The absolute minimum a task needs is:
bool foundDescription = false;
bool foundStatus = false;
// Parse the whole thing.
json::value* root = json::parse (input);
@ -431,24 +430,17 @@ bool Hooks::isJSON (const std::string& input) const
{
// If the attribute is a recognized column.
std::string type = Task::attributes[i->first];
if (type != "")
{
if (i->first == "description" && type == "string")
if (type == "string" && i->first == "description")
foundDescription = true;
if (i->first == "status" && type == "string")
foundStatus = true;
}
}
}
else
throw std::string ("Object expected.");
// It's JSON, but is it a task?
if (! foundDescription)
throw std::string ("Missing 'description' attribute, of type 'string'.");
if (! foundStatus)
throw std::string ("Missing 'status' attribute, of type 'string'.");
// Yep, looks like a JSON task.
return true;
}