gitlab4j / gitlab4j-api

GitLab4J API (gitlab4j-api) provides a full featured Java client library for working with GitLab repositories via the GitLab REST API
MIT License
1.07k stars 463 forks source link

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

Open heat23 opened 3 months ago

heat23 commented 3 months ago

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?

jmini commented 3 months ago

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

heat23 commented 3 months ago

@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 commented 3 months ago

@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?

jmini commented 2 months ago

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 🤯