Skip to content

/projects/:id/approvals cannot set multiple options from UI

Everyone can contribute. Help move this issue forward while earning points, leveling up and collecting rewards.

Summary

GitLab web UI has options in 'Settings / General / Merge request approvals' called Require approval from code owners and Prevent approval of merge requests by merge request committers. These options have no equivalent in the Merge request approvals API (https://docs.gitlab.com/ee/api/merge_request_approvals.html).

Steps to reproduce

  1. Perform an HTTP GET to /projects/:id/approvals.

  2. Observe there are no fields for Require approval from code owners and Prevent approval of merge requests by merge request committers.

  3. Check the boxes in the GitLab web UI.

  4. Click 'Save changes'.

  5. Perform an HTTP GET to /projects/:id/approvals.

  6. Observe no change in output compared to step 2.

  7. Browse to documentation at https://docs.gitlab.com/ee/api/merge_request_approvals.html.

  8. Observe there is no documentation for the fields Require approval from code owners and Prevent approval of merge requests by merge request committers.

Example Project

Project is irrelevant. This is not project specific.

What is the current bug behavior?

Require approval from code owners and Prevent approval of merge requests by merge request committers cannot be retrieved or set using the Merge request approvals API and must be manually set in the GitLab web UI.

What is the expected correct behavior?

Require approval from code owners and Prevent approval of merge requests by merge request committers can be set using the Merge request approvals API.

Relevant logs and/or screenshots

# http --check-status "GET" "https://<host>/api/v4/projects/<id>/approvals" Private-Token:"<token>" | jq
{
  "approvers": [],
  "approver_groups": [],
  "approvals_before_merge": 1,
  "reset_approvals_on_push": true,
  "disable_overriding_approvers_per_merge_request": true,
  "merge_requests_author_approval": false
}

Output of checks

n/a

Results of GitLab environment info

do not have access version is GitLab Enterprise Edition 11.11.2-ee

Results of GitLab application Check

n/a

Possible fixes

https://gitlab.com/gitlab-org/gitlab-ee/blob/a0228bb80d3ccaa9b5606a37b53e7dad7d7863d0/ee/lib/api/project_approvals.rb#L28-32 appears to be missing merge_requests_require_code_owner_approval and merge_requests_disable_committers_approval.

Edited by 🤖 GitLab Bot 🤖