-
Notifications
You must be signed in to change notification settings - Fork 3
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
Add additionalSpecifications field to DeviceRegistration #484
Conversation
a9db9bd
to
7f1572f
Compare
For |
0b57685
to
4c78321
Compare
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.
See comments; I already fixed those (you can resolve them after reading them).
In addition, I squashed three of the commits into one. Each commit ideally should pass all tests/be a cohesive whole. The last commit was a correct separate commit. 👍 I hope/presume you didn't have other changes on this branch, so I force pushed. Apologies if you did (as that can cause conflicts). Make sure to use git pull --rebase
.
But, I see two other concerns before this can be merged:
- I don't recall 100% whether or not we need
@Required
on the field. I vaguely remember it may be needed for some scenario, maybe "unknown polymorphic serialization". I need to dig up some old issues/documentation. - You didn't test whether
additionalSpecification
actually gets serialized as a JSON object (instead as a string with escaped\"
chars, etc.). I put a breakpoint and apparently it doesn't. I suspect that is because the serializer used for that field is not "inherited" as you would expect it. I need to dig in to kotlinx serialization documentation to refresh my memory.
...mmonTest/kotlin/dk/cachet/carp/common/infrastructure/serialization/DeviceRegistrationTest.kt
Outdated
Show resolved
Hide resolved
...mmonTest/kotlin/dk/cachet/carp/common/infrastructure/serialization/DeviceRegistrationTest.kt
Outdated
Show resolved
Hide resolved
...mmonTest/kotlin/dk/cachet/carp/common/infrastructure/serialization/DeviceRegistrationTest.kt
Outdated
Show resolved
Hide resolved
rpc/src/main/kotlin/dk/cachet/carp/rpc/GenerateExampleRequests.kt
Outdated
Show resolved
Hide resolved
Regarding
That makes sense for fields like Now I'm actually wondering whether And, regarding the
For this to work as expected, you would have to apply
This gives That would be a bit unfortunate if there is no way around this. It would be worthwhile checking the kotlinx serialization documentation to see whether they have any (new) features which can avoid the need for doing this. |
Got it, I was expecting a 'squash and merge' when this branch is done, but saw a TODO warning when pushing. I didn't give much thought if those changes should be applied here after having fun reading that serialization issue
You mentioned in this PR Regarding removing
This actually makes sense, as how kotlinx.serialization works with generic type parameters/abstract class, a serializer is required for each type/subclass. Note we also have One work around I can think of is creating a new datatype/class to handle |
Good idea! I think I considered it in the past. Maybe I didn't pursue it since without inheritance there was no clear benefit. I shortly looked for past considerations, but couldn't find any, only the PR where it was introduced. So, definitely worthwhile giving this a go! You may want to do that as a separate PR preceding this one. But, also fine as separate commit within this one. Whichever you prefer. :) I won't force push anymore without checking in with you; the branch is yours. |
I ran some tests and it is the case:
|
That can easily be resolved with a version migration, so only a minor version bump is needed. But, definitely out of scope here. 👍 |
4c78321
to
1de2e41
Compare
As discussed in #431, adding a
additionalSpecifications
field toDeviceRegistration
. This allows to keep additional specification data when register device and access them later on inStudyDeploymentStatus.deviceStatusList