gofish icon indicating copy to clipboard operation
gofish copied to clipboard

Client not set for child objects

Open stmcginnis opened this issue 4 years ago • 0 comments

Most objects contain links to use to fetch child objects. There are a few (at least PowerSupply and Thermal) that include the full object in the returned JSON. Since these objects are not fetched directly, they never have their client references set. This means if someone then tries to call Update() or any action methods on the object it will fail when trying to use the client to send the update.

The workaround is to use the object.ODataID to fetch the object directly from the system, then operating on that object to update. This is less than ideal though.

One approach may be to change these to private fields of the parent struct, then provide an access method to call to get them. This would be similar behavior to how linked objects are handled. We could then set the client reference prior to returning the objects through this call.

Another option may be to handle these child objects in the UnmarshalJSON calls of the parent object and set the client reference at that point.

stmcginnis avatar May 21 '20 21:05 stmcginnis