Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

Allow late arriving child records to be related to correct parent #234

Closed
wants to merge 1 commit into
from

Conversation

Projects
None yet
3 participants

When a parent record of a to-one or to-many relationship arrives before it's child, an empty child object is created. When the child record arrives, another new object is created with no way to relate it to it's parent. By adding the primary key value when creating missing child objets they can then be found and updated when the child record arrives.

Looks like Issue #223 was opened for this.

Member

blackgold9 commented Sep 23, 2012

Hoping to get a unit test for this one. I just pushed a commit that should make writing tests easier (tests will now compile)

OK, cool! Got stuck doing planning all last week, but hopefully will have a chance to take another look this week. Took a quick look late that night we talked, and it may just be the way the JSON I'm getting is formatted. I'll let you know though. Thanks!

OK, so this ended up being an issue with the JSON. It was a to-one relationship, but in the JSON it only contained a single number for the ID of the child. From Saul's post on CIMGF I noticed that it seemed to only work that way if the value was an array of IDs, and it was a to-many relationship. The server-side is being developed in-house, so I was able to get them to "correct" the JSON.

Old (incorrect) JSON were "host" is the to-one relationship:
{
"sev":4,
"id":1,
"host":10,
"status":2
}

New (working) JSON:
{
"sev":4,
"id":1,
"host":
{
"id":10
},
"status":2
}

@itsniper itsniper closed this Sep 28, 2012

Glnn commented on cbd6c18 Nov 5, 2012

I'd say this is pretty essential stuff!

Owner

itsniper replied Nov 6, 2012

Actually I need to reverse this commit. Totally forgot it was up on GitHub. The issue ended up being that my JSON was incorrectly formatted. This fixed it for my JSON format, but I have no idea what else it might have broken. I just changed my JSON format and the original code works fine. If you're seeing this issue check your JSON against the unit test examples in the project.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment