Cannot get nil value from BackingStore with delta query when a property value was changed to nil (empty)
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 35/100
Research direction
Start with User.GetFieldDeserializers and InMemoryBackingStore, then reproduce the delta response where givenName and surname are null. Trace how the deserializer and backing store handle those values; done means the API lets callers distinguish properties changed to nil, with the behavior checked against the sample delta response.
Written by the indexing model from the issue text.
Description
I am trying to implement the delta query to track user changes.
For example, I changed First name and Last name to empty on https://entra.microsoft.com/ .
I got the below response. You can see givenName and surname are detected as null values.
{
"@odata.context": "https://graph.microsoft.com/v1.0/$metadata#users",
"@odata.deltaLink": "https://graph.microsoft.com/v1.0/users/delta()?$deltatoken=dqOf4D0FeifmTE8LZ08sKG_0pMPP7gZ...",
"value": [
{
"givenName": null,
"surname": null,
"id": "a8d67d70-f83b-453d-9666-1f280a609bf6"
}
]
}
But, I cannot know whether the givenName and surname were changed to null since the Enumerate() or EnumerateKeysForValuesChangedToNil() methods don't return the values (nil).
var user models.Userable
...
b := user.GetBackingStore()
fmt.Println(b.GetInitializationCompleted())
fmt.Println(b.GetReturnOnlyChangedValues())
for i, v := range b.EnumerateKeysForValuesChangedToNil() {
fmt.Printf(" - %v, %+v\n", i, v)
}
for k, v := range b.Enumerate() {
fmt.Printf(" - %s, %+v\n", k, v)
}
- additionalData, map[]
- odataType, 0x140005803b0
- id, 0x14000580320
Another sample code to confirm the user data.
json, _ := serialization.SerializeToJson(user)
fmt.Println(string(json))
Also, the user data doesn't have both givenName and surname properties.
{"id":"a8d67d70-f83b-453d-9666-1f280a609bf6","@odata.type":"#microsoft.graph.user"}
In my debugging, InMemoryBackingStore doesn't handle a nil value in User.GetFieldDeserializers() method.
res["surname"] = func(n i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) error {
val, err := n.GetStringValue()
if err != nil {
return err
}
if val != nil {
m.SetSurname(val)
}
return nil
}
func (m *User) SetSurname(value *string) {
err := m.GetBackingStore().Set("surname", value)
if err != nil {
panic(err)
}
}
Could you tell me how do I check both givenName and surname properties were changed to nil via msgraph-sdk-go API?
Reference
- Dominant language
- Go
- Stars
- 335
- Forks
- 43
- Avg merge
- 12h 7m
- Merged PRs (30d)
- 2
Getting set up
- No Dockerfile or Docker Compose file
- Has a pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from microsoftgraph/msgraph-sdk-go
-
ItemItemsItemPermanentDeleteRequestBuilderInternal.Post missing content body/content-type headersOpenstatus:waiting-for-triage type:bug
Difficulty 3/5 1-2 days Newbie friendliness 48/100
microsoftgraph/msgraph-sdk-go#980 ·
Maintainers usually reply within 1 day
-
status:waiting-for-triage type:bug
Difficulty 4/5 3-5 days Newbie friendliness 35/100
microsoftgraph/msgraph-sdk-go#972 ·
Maintainers usually reply within 1 day
-
status:waiting-for-triage type:bug
Difficulty 3/5 1-2 days Newbie friendliness 45/100
microsoftgraph/msgraph-sdk-go#969 · 1 comment ·
Maintainers usually reply within 1 day
-
status:waiting-for-triage type:feature
Difficulty 3/5 1-2 days Newbie friendliness 45/100
microsoftgraph/msgraph-sdk-go#964 ·
Maintainers usually reply within 1 day
-
status:waiting-for-triage type:feature
Difficulty 5/5 Over a week Newbie friendliness 20/100
microsoftgraph/msgraph-sdk-go#940 · 1 comment ·
Maintainers usually reply within 1 day
All issues in microsoftgraph/msgraph-sdk-go
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Maintainers usually reply within 1 day
-
duplication
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
openvibely/openvibely#1443 ·
Maintainers usually reply within 2 days
-
Difficulty 2/5 1-3 hours Newbie friendliness 80/100
keyxmakerx/Chronicle#1179 ·
Maintainers usually reply within 1 day
-
raised-by:worker
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
medici-finance/assay#2486 ·
Maintainers usually reply within 1 day
-
area/testing kind/bug triage/needs-triage
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
cozystack/cozystack#4841 · 1 reaction ·
Maintainers usually reply within 2 days