Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Flexible sync of RealmObject with EmbeddedRealmObject field #945

Closed
klamborowski opened this issue Jul 29, 2022 · 4 comments
Closed

Flexible sync of RealmObject with EmbeddedRealmObject field #945

klamborowski opened this issue Jul 29, 2022 · 4 comments
Assignees

Comments

@klamborowski
Copy link

klamborowski commented Jul 29, 2022

Hi 👋

I'm trying to use kotlin realm sdk for Flexible Sync.

For standard Realm object like this it's work perfect:

open class SomeClass(
    @PrimaryKey var _id: String = "",
    var _partition: String = "",
    var card: String? = null,
) : RealmObject 

But for embedded object

open class SomeClass(
    @PrimaryKey var _id: String = "",
    var _partition: String = "",
    var card: Card? = null,
) : RealmObject 

open class Card(
    var cardNumber: String? = null,
    var isPrivateCard: Boolean? = null,
    var uuid: String? = null
) : EmbeddedRealmObject

I can't pass Card:class to SyncConfiguration like bellow, cause schema argument only takes set of RealmObject, not BaseRealmObject.

SyncConfiguration.Builder(
        user = getCurrentUser(),
        schema = setOf(SomeClass::class, Card::class)
    )

But if I add only SomeClass:class

SyncConfiguration.Builder(
        user = getCurrentUser(),
        schema = setOf(SomeClass::class)
    )

I will receive the following error and app crash:

     Caused by: io.realm.kotlin.internal.interop.RealmCoreLogicException: [18]: Schema validation failed due to the following errors:
2022-07-29 17:07:53.490 11177-11177/my.app.dev E/AndroidRuntime: - Property 'SomeClass.card' of type 'object' has unknown object type 'Card'

Looking forward for your help 😀

@cmelchior
Copy link
Contributor

Hi @klamborowski Thank you for reporting this. This is an unfortunate bug in our SyncConfiguration that wasn't caught for some reason. We should have a patch ready in a day or two. Sorry for the inconvenience.

@cmelchior
Copy link
Contributor

A fix should be ready in 1.0.2-SNAPSHOT. We will make a proper release shortly.

@klamborowski
Copy link
Author

Great news! Thanks for a quick fix 😊

@cmelchior
Copy link
Contributor

A proper 1.0.2 release is now out.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 18, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants