Fix incorrect validator for strings

fixes #8907
This commit is contained in:
Gunnar Beutner 2015-03-30 14:55:41 +02:00
parent 10441e9cd7
commit 8f1ba7f84c
1 changed files with 2 additions and 9 deletions

View File

@ -721,7 +721,7 @@ void ClassCompiler::CodeGenValidator(const std::string& name, const std::string&
if (fieldType.GetRealType() == "Value") {
if (rule.Type == "String")
m_Impl << "\t\t" << "if (value.IsScalar())" << std::endl
m_Impl << "\t\t" << "if (value.IsEmpty() || value.IsScalar())" << std::endl
<< "\t\t\t" << "return;" << std::endl;
else if (rule.Type == "Number") {
m_Impl << "\t\t" << "try {" << std::endl
@ -829,14 +829,7 @@ void ClassCompiler::CodeGenValidator(const std::string& name, const std::string&
<< "\t\t" << "BOOST_THROW_EXCEPTION(ValidationError(dynamic_pointer_cast<DynamicObject>(object), location, \"Invalid attribute: \" + key));" << std::endl
<< "\t" << "else" << std::endl;
m_Impl << (!static_known_attribute ? "\t" : "") << "\t" << "BOOST_THROW_EXCEPTION(ValidationError(dynamic_pointer_cast<DynamicObject>(object), boost::assign::list_of(";
if (validatorType == ValidatorField)
m_Impl << "\"" << field << "\"";
else
m_Impl << "key";
m_Impl << "), \"Invalid type.\"));" << std::endl;
m_Impl << (!static_known_attribute ? "\t" : "") << "\t" << "BOOST_THROW_EXCEPTION(ValidationError(dynamic_pointer_cast<DynamicObject>(object), location, \"Invalid type.\"));" << std::endl;
}
m_Impl << "}" << std::endl << std::endl;