You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
On update of provider, we use merge of existing value in DB and new updated value, to autofill the empty values and take the latest provider value.
If we have a provider record in DB with Provider.Config.Appeal.AllowPermanentAccess value as true already, and we update this field to false in new the updated provider record - because of the bug in the version of mergo that we use, the field will always remain true in DB.
I see that this is not just for this bool field, but also for other fields.
Labels(map[string]string) are also merged instead of simple update and both AllowPermanentAccess and AllowActiveAccessExtensionIn are taken from existing provider values rather than the incoming update.
Is this desired? If not, we should relook at how we use the merge library to autofill the missing values, and create our own provider struct manually for all fields taking in the new fields and with default empty values for missing fields.
IMO, I don't think we should merge at all, we should be taking in the latest values always.
If it is PUT API I think the expectation should be: it should update the entire record with the one passed in the API so the latest value will be stored. If we desire to change partial fields in the record, that should be with PATCH API.
Description
On update of provider, we use merge of existing value in DB and new updated value, to autofill the empty values and take the latest provider value.
If we have a provider record in DB with
Provider.Config.Appeal.AllowPermanentAccess
value astrue
already, and we update this field tofalse
in new the updated provider record - because of the bug in the version of mergo that we use, the field will always remaintrue
in DB.mergo issue: darccio/mergo#166
To Reproduce
Provider.Config.Appeal.AllowPermanentAccess
value astrue
Provider.Config.Appeal.AllowPermanentAccess
value asfalse
true
instead offalse
Expected behavior
The field should be updated to whatever's the value in the latest provider record.
Additional context
latest
mainThe text was updated successfully, but these errors were encountered: