gitlab4j-api
gitlab4j-api copied to clipboard
Make light versions of response objects more explicit
There are several cases of bulk queries that return 'lighter' versions of objects. For example mergeRequestApi.getMergeRequests() returns a list MergeRequest objects that contain only basic info. The class provides accessors to get approvals, changes, etc. but they are null unless queried using other calls (using mergeRequestApi.getApprovals() for approvals for example).
Would it be possible to make this more explicit in 6.0.0? For example make mergeRequestApi.getMergeRequests() return a list of another type (let's call it BasicMergeRequest) that contains only the info that is actually available for this call.
Yes this is possible. We have this pattern at a lot of places.
The best is to have a parent class containing only the common fields.
Have a look at AbstractUser or AbstractGroup where we use already this pattern.
Could you create a pull request? or at least identify the attributes that are only present in getMergeRequests()