-
Notifications
You must be signed in to change notification settings - Fork 61
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
DynamicObjects can now access fields by public name. #1571
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This doesn't look right. How can we know the @PersistedName
mapping when there is not necessarily a schema definition?
Then it won't provide access to a public name because there won't be any. Right now this behavior is a by-product of building the dynamic realm out of a typed realm config. It has a schema definition, and thus has public names available. I don't think this should be an issue as it only affects an internal function, and even if it was public we would allow users to access data using a public name if required. |
I don't think it is the right way to go. This indeed looks like a public change and we have tried not to leverage the typed schema information even if we could. But maybe it is as broader discussion on what the full dynamic API should support. Lets discuss in todays meeting. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great. One minor comment.
assertFailsWithMessage<IllegalArgumentException>("Schema for type 'AlternativePersistedNameSample' doesn't contain a property named 'publicNameStringField'") { | ||
dynamicSample.getValue("publicNameStringField") | ||
} | ||
assertEquals("Realm", dynamicSample.getValue("publicNameStringField")) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would probably be appropriate with a comment here explaining that this is only due to the nature of asDynamicRealm
that the public name is available here.
Fixes CI