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

Events API - targetType returning 'Null' (Confirmed BUG)

Open heat23 opened this issue 1 year ago • 4 comments

When using the Events API like this:

List<Event> events = api.getEventsApi() .getUserEventsStream(user, null, null, new Date(), after, null) .collect(Collectors.toList());

For the results where actionName = accepted, targetType is coming back as NULL. I would expect the value to be MergeRequest. Any ideas?

heat23 avatar Aug 08 '24 15:08 heat23

How does it looks like in the JSON?

You can log the HTTP traffic. See: https://github.com/gitlab4j/gitlab4j-api/issues/1109#issuecomment-2051728505

jmini avatar Aug 12 '24 13:08 jmini

@jmini Thanks for your response. I tried Level.INFO but only got the request URL - It didn't dump the response. I tried Level.ALL and I got NO log messages.

api = new GitLabApi("https://mygitlabinstance", db.getApiKey()) .withRequestResponseLogging(Level.ALL);

Any idea why it isn't logging the raw response?

heat23 avatar Aug 13 '24 14:08 heat23

@jmini I tried this using curl and confirmed that the API does indeed return a non-null target_type:

From curl "id": 2864260, "project_id": 6637, "action_name": "accepted", "target_id": 245740, "target_iid": 724, "target_type": "MergeRequest", "author_id": 473,

from gitlab4j (both 5.1, 5.6, and 6.0-rc5) "id" : 2864260, "projectId" : 6637, "actionName" : "accepted", "targetId" : 245740, "targetIid" : 724, "targetType" : null,

What can be done to resolve this BUG in version 5.x?

heat23 avatar Aug 13 '24 14:08 heat23

The specification says the value should be merge_request https://docs.gitlab.com/ee/api/events.html#target-types but your curl command indicated you got MergeRequest 🤯

jmini avatar Sep 18 '24 15:09 jmini