diff --git a/src/realm/object-store/c_api/schema.cpp b/src/realm/object-store/c_api/schema.cpp index efa4fbfca72..6c80dc5fca5 100644 --- a/src/realm/object-store/c_api/schema.cpp +++ b/src/realm/object-store/c_api/schema.cpp @@ -58,7 +58,7 @@ RLM_API uint64_t realm_get_schema_version(const realm_t* realm) RLM_API bool realm_schema_validate(const realm_schema_t* schema, uint64_t validation_mode) { return wrap_err([&]() { - schema->ptr->validate(validation_mode); + schema->ptr->validate(static_cast(validation_mode)); return true; }); } diff --git a/src/realm/object-store/object_schema.cpp b/src/realm/object-store/object_schema.cpp index 850f6cc3af5..512f47eb521 100644 --- a/src/realm/object-store/object_schema.cpp +++ b/src/realm/object-store/object_schema.cpp @@ -329,7 +329,7 @@ static void validate_property(Schema const& schema, ObjectSchema const& parent_o } void ObjectSchema::validate(Schema const& schema, std::vector& exceptions, - uint64_t validation_mode) const + SchemaValidationMode validation_mode) const { std::vector public_property_names; std::vector internal_property_names; diff --git a/src/realm/object-store/object_schema.hpp b/src/realm/object-store/object_schema.hpp index 2e22aa413e4..e0a6861cc7c 100644 --- a/src/realm/object-store/object_schema.hpp +++ b/src/realm/object-store/object_schema.hpp @@ -32,6 +32,7 @@ class Table; enum class PropertyType : unsigned short; struct ObjectSchemaValidationException; struct Property; +enum SchemaValidationMode : uint64_t; class ObjectSchema { public: @@ -80,7 +81,7 @@ class ObjectSchema { bool property_is_computed(Property const& property) const noexcept; void validate(Schema const& schema, std::vector& exceptions, - uint64_t validation_mode) const; + SchemaValidationMode validation_mode) const; friend bool operator==(ObjectSchema const& a, ObjectSchema const& b) noexcept; diff --git a/src/realm/object-store/schema.cpp b/src/realm/object-store/schema.cpp index 88477e8274c..eff678472d6 100644 --- a/src/realm/object-store/schema.cpp +++ b/src/realm/object-store/schema.cpp @@ -190,7 +190,7 @@ std::unordered_set get_embedded_object_orphans(const Schema& schema } // end anonymous namespace -void Schema::validate(uint64_t validation_mode) const +void Schema::validate(SchemaValidationMode validation_mode) const { std::vector exceptions; diff --git a/src/realm/object-store/schema.hpp b/src/realm/object-store/schema.hpp index c86a8b2fff2..44522882eeb 100644 --- a/src/realm/object-store/schema.hpp +++ b/src/realm/object-store/schema.hpp @@ -147,7 +147,7 @@ class Schema : private std::vector { // Verify that this schema is internally consistent (i.e. all properties are // valid, links link to types that actually exist, etc.) - void validate(uint64_t validation_mode = SchemaValidationMode::Basic) const; + void validate(SchemaValidationMode validation_mode = SchemaValidationMode::Basic) const; // Get the changes which must be applied to this schema to produce the passed-in schema std::vector compare(Schema const&, SchemaMode = SchemaMode::Automatic, diff --git a/src/realm/object-store/shared_realm.cpp b/src/realm/object-store/shared_realm.cpp index 29699dd48ff..274e9cd9cd7 100644 --- a/src/realm/object-store/shared_realm.cpp +++ b/src/realm/object-store/shared_realm.cpp @@ -393,7 +393,7 @@ void Realm::update_schema(Schema schema, uint64_t version, MigrationFunction mig validation_mode |= SchemaValidationMode::RejectEmbeddedOrphans; } - schema.validate(validation_mode); + schema.validate(static_cast(validation_mode)); bool was_in_read_transaction = is_in_read_transaction(); Schema actual_schema = get_full_schema();