-
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
Make deviceDisplayName
optional in DeviceRegistration
#487
Make deviceDisplayName
optional in DeviceRegistration
#487
Conversation
Seems like you figured most of it out! 👍 Just scrolled through it; no proper review yet. To respond to your comments:
Minor comments:
Lastly, I need to double-check what I used to do before. It seems a bit annoying all of the JSON request test resources already need to be added now. Any further changes within this release will then need to update those. But, likely that's how I did it before as well... |
Yes, and yes, order of object properties should not be a thing. but since we are targeting JavaScript, and apparently Most Browsers iterate object properties as: String keys, in insertion order (ES2015 guarantees this and all browsers comply), and enforced this even more later on. This will be a rare usecase for us, but send request, and get element by index from the respond would work in JavaScript...
Yes, it would be useful everytime a field is removed. However, if we update the test and the order of JSON become irrelavent, this helper function is no longer needed. |
Interesting! I wasn't aware about that. However, for the purpose of this discussion, I think that should be irrelevant. Our interface across systems is JSON, and not "JSON as processed by JavaScript". If we allow fields to be arranged in any order there is no point in testing that they are in the right order. Furthermore, at a glance, However, long story short, I think the JSON standard correctly states ordering doesn't matter, so our upgraders shouldn't care. :) |
I looked into the unit testing and we are comparing |
205d34f
to
83825ae
Compare
...ommonMain/kotlin/dk/cachet/carp/common/infrastructure/versioning/Major1Minor1To3Migration.kt
Outdated
Show resolved
Hide resolved
83825ae
to
53363f8
Compare
Sorry. I overlooked the update to this PR. Will try to see soon whether it can be merged! |
53363f8
to
708248e
Compare
I made things a bit more concise by adding a helper function which is likely to be useful in future upgraders: 5ce4f58 |
708248e
to
4872b10
Compare
deviceDisplayName
field is no longer required inDeviceRegistration
CustomDeviceRegistration
,deviceDisplayName
is default tonull
ApiVersion
inDeploymentServiceRequest
bumped to 1.3Json file under
deployment/src/commonTest/recourses
were copied frombuild
folder, butDeploymentServiceRequest
underrpc
was updated manually.Two things to notice
JsonObject
inkotlinx.serailization
is aMap
, but the added field will by default append to the end. I added a helper function sorting the respond json with a hard-coded string list. Other approach will be appreciated.DeploymentServiceRequest.GetDeviceDeploymentFor
Connected
here is theroleName
, but it's used as key, which is a bit odd here as most of the keys are reserved keywords. Maybe it could be combined withconnectedDevices
or have its own array withroleName
as a field. I'm unsure but we might also be using non-keyword keys in other request/respond, for example inSetParticipantData
.