gitlab4j-api icon indicating copy to clipboard operation
gitlab4j-api copied to clipboard

Make light versions of response objects more explicit

Open mkorniluk-veepee opened this issue 1 year ago • 1 comments
trafficstars

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.

mkorniluk-veepee avatar Feb 01 '24 13:02 mkorniluk-veepee

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()

jmini avatar Feb 02 '24 15:02 jmini