In several parts of the API GitHub responds with incomplete representations when it is part of another response. They probably do this to save bandwidth.
For example, when one gets the JSON representation of an issue, the API responds with a JSON object containing a "user" key which contains an incomplete JSON representation of a user. When parsed into a GHUser, it contains a lot of nil fields.
To resolve this, there needs to be a check against this, and the fields should be filled lazily using the API url of the object itself. That is, in the case of GHUser, it should do something like this when a field is not filled:
fillFields
| updated |
updated := self
get: self url;
responseAs: self class.
self mergeFieldsFrom: updated.
In several parts of the API GitHub responds with incomplete representations when it is part of another response. They probably do this to save bandwidth.
For example, when one gets the JSON representation of an issue, the API responds with a JSON object containing a
"user"key which contains an incomplete JSON representation of a user. When parsed into aGHUser, it contains a lot ofnilfields.To resolve this, there needs to be a check against this, and the fields should be filled lazily using the API url of the object itself. That is, in the case of
GHUser, it should do something like this when a field is not filled: