Skip to content

Trying to list merge requests containing specific approver_ids returns an exception #1010

Closed
@sim0nx

Description

@sim0nx

Description of the problem, including code/CLI snippet

I am trying to list merge requests which contain a certain approver ID. As per https://docs.gitlab.com/ee/api/merge_requests.html#list-merge-requests this should be doable via:

gl.mergerequests.list(approver_ids=[1])

Calling that code raises the following exception (GitLab EE):

Traceback (most recent call last):
  File "/venv/lib/python3.7/site-packages/gitlab/exceptions.py", line 267, in wrapped_f
    return f(*args, **kwargs)
  File "/venv/lib/python3.7/site-packages/gitlab/mixins.py", line 141, in list
    obj = self.gitlab.http_list(path, **data)
  File "/venv/lib/python3.7/site-packages/gitlab/__init__.py", line 648, in http_list
    return list(GitlabList(self, url, query_data, get_next=False, **kwargs))
  File "/venv/lib/python3.7/site-packages/gitlab/__init__.py", line 771, in __init__
    self._query(url, query_data, **kwargs)
  File "/venv/lib/python3.7/site-packages/gitlab/__init__.py", line 776, in _query
    result = self._gl.http_request("get", url, query_data=query_data, **kwargs)
  File "/venv/lib/python3.7/site-packages/gitlab/__init__.py", line 572, in http_request
    response_body=result.content,
gitlab.exceptions.GitlabHttpError: 400: approver_ids should be an array, 'None' or 'Any'

In the gitlab server logs I see the following:

"GET /api/v4/merge_requests?approver_ids=1 HTTP/1.1" 400 60 "-" "python-gitlab/2.0.1" "-"

Expected Behavior

Return merge requests for the specified approver_ids.

Actual Behavior

Raises an exception.

Specifications

  • python-gitlab version: 2.0.1
  • API version you are using (v3/v4): v4
  • Gitlab server version (or gitlab.com): 12.7.5-ee

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions