Skip to content

Update EventMergeRequest webhook to handle non-string merge param values#1317

Open
klew00 wants to merge 1 commit intogitlab4j:mainfrom
spartansw:update_webhook_merge_request_params
Open

Update EventMergeRequest webhook to handle non-string merge param values#1317
klew00 wants to merge 1 commit intogitlab4j:mainfrom
spartansw:update_webhook_merge_request_params

Conversation

@klew00
Copy link

@klew00 klew00 commented Mar 19, 2026

Calls from GitLab's merge request webhook event can have the merge_params property contain non-string values, such as should_remove_source_branch which is a boolean or train_ref which is an object (https://gitlab.com/gitlab-org/gitlab/-/merge_requests/129979). Example:

"object_attributes": {
  ...
  "merge_params": {
    "force_remove_source_branch": "1",
    "auto_merge_strategy": "merge_train",
    "should_remove_source_branch": true,
    "sha": "61f4798ee6668860a47f2f84b31bf8b88ab52bb9",
    "train_ref": {
      "commit_sha": "83d69a142f2fb301c3cce0a802ec1c5ee3a091a8",
      "merge_commit_sha": "83d69a142f2fb301c3cce0a802ec1c5ee3a091a8",
      "squash_commit_sha": "61f4798ee6668860a47f2f84b31bf8b88ab52bb9"
    }
  },
  ...
}

This causes issues when handling the event since the merge_params attribute in EventMergeRequest is a Map<String, String>, which expects every value to be a string. This change updates merge_params so it can handle the should_remove_source_branch and train_ref non-string values when converting the JSON.

The merge_params property can contain non-string values such as
"should_remove_source_branch" which is a boolean or "train_ref" which is
an object
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant