Skip to content

Generalize PATCH endpoint of Protected Branches API

Currently, we have PATCH endpoint in Protected Branches API https://docs.gitlab.com/ee/api/protected_branches.html#require-code-owner-approvals-for-a-single-branch that is very specific in its description and only allows updating code_owner_approval_required attribute. It should be more general and extendable in its nature.

The endpoint has a specific implementation and allows updating only code_owner_approval_required attribute.

Within this issue, we should

  1. Use ::ProtectedBranches::UpdateService via ApiService just like CreateService
  2. Update the descriptions that this endpoint is for updating a protected branch, not only a code owner approval attribute
  3. Update the documentation to reflect the change: https://docs.gitlab.com/ee/api/protected_branches.html#require-code-owner-approvals-for-a-single-branch (can be done separately via a docs MR)

It's a prerequisite for #20229 (closed)