Allow more nullable property types when supported
This commit is contained in:
parent
d7fd525dc2
commit
76d62bbc57
|
@ -198,6 +198,11 @@ std::vector<ObjectSchemaValidationException> ObjectStore::verify_object_schema(O
|
|||
}
|
||||
|
||||
// check nullablity
|
||||
#if REALM_NULL_STRINGS == 1
|
||||
if (current_prop.type == PropertyTypeArray && current_prop.is_nullable) {
|
||||
exceptions.emplace_back(InvalidNullabilityException(table_schema.name, current_prop));
|
||||
}
|
||||
#else
|
||||
if (current_prop.type == PropertyTypeObject) {
|
||||
if (!current_prop.is_nullable) {
|
||||
exceptions.emplace_back(InvalidNullabilityException(table_schema.name, current_prop));
|
||||
|
@ -208,6 +213,7 @@ std::vector<ObjectSchemaValidationException> ObjectStore::verify_object_schema(O
|
|||
exceptions.emplace_back(InvalidNullabilityException(table_schema.name, current_prop));
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
// check primary keys
|
||||
if (current_prop.is_primary) {
|
||||
|
@ -516,6 +522,9 @@ MissingPropertyException::MissingPropertyException(std::string object_type, Prop
|
|||
InvalidNullabilityException::InvalidNullabilityException(std::string object_type, Property const& property) :
|
||||
ObjectSchemaPropertyException(object_type, property)
|
||||
{
|
||||
#if REALM_NULL_STRINGS == 1
|
||||
m_what = "'Array' property '" + property.name + "' cannot be nullable";
|
||||
#else
|
||||
if (property.type == PropertyTypeObject) {
|
||||
if (!property.is_nullable) {
|
||||
m_what = "'Object' property '" + property.name + "' must be nullable.";
|
||||
|
@ -526,6 +535,7 @@ InvalidNullabilityException::InvalidNullabilityException(std::string object_type
|
|||
m_what = "Only 'Object' property types are nullable";
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
MissingObjectTypeException::MissingObjectTypeException(std::string object_type, Property const& property) :
|
||||
|
|
Loading…
Reference in New Issue