Schema validation failed due to the following errors: - Embedded object 'Cart_Item' is unreachable by any link path from top level objects

I’m following this link to have embedded objects in my models: https://docs.mongodb.com/realm/sdk/dotnet/data-types/embedded-objects/

While testing my code, I got this exception:

Schema validation failed due to the following errors: - Embedded object 'Cart_Item' is unreachable by any link path from top level objects.

If my understanding is right, the EmbeddedObject Cart_Item is not embedded to neither any RealmObject nor another EmbeddedObject.

But is this nescessary an exception? Can we just simply ignore the un-used EmbeddedObject as we always do with un-used variables?

Hi @lvdinh,

Your assumption is correct. EmbeddedObject is a sub type of RealmObject with a very specific set of features. They are embedded into one and only one other RealmObject.
We do check if embedded objects are orphaned (not embedded anywhere else) or do even have more than one parent and throw an exception if this is not fulfilled.

Having an EmbeddedObject not being linked to any other RealmObject would not make sense because you cannot create a standalone EmbeddedObject.

If you like to ignore this feature / exception you can always just set the model class to be a ‘normal’ RealmObject instead.

1 Like

Having an EmbeddedObject not being linked to any other RealmObject would not make sense in development phase. You can define EmbeddedObject first and then use it later.