Skip to content

jira.worklogs function should return a top level object instead of list of worklogs #673

Open
@kadimgh

Description

@kadimgh

There are two ways to get issue worklogs:

  1. If you obtained issue object through search for example then you can access worklogs by issue.fields.worklog. It has "total" and "maxResults" fields and by comparing those you could tell if you got all the worklogs or not (currently REST API will only return first 20 worklogs). Also it contains worklogs fields with the list of actual worklogs.

  2. Then if there are more than 20 worklogs you can get them by directly calling jira.worklogs(issue_key), this request does not have limitation of 20, however as a result of this call you get list of worklogs, although returned JSON also contains "total" and "maxResults" fields that could be used by calling application to understand if all of the worklogs have been returned.

Actual behavior: jira.worklogs(issue_key) call returns list of worklogs only
Expected behavior: jira.worklogs(issue_key) should return worklog object with "total", "maxResults" and "worklogs" fields, as it is in original JSON response. Alternatively there could be additional API that would return the full worklog object, to not break existing jira.worklogs(issue_key) or jira.worklog(issue_key, worklog_id) APIs

I'm referring to the following code

@translate_resource_args
    def worklogs(self, issue):
        """Get a list of worklog Resources from the server for an issue.

        :param issue: ID or key of the issue to get worklogs from
        """
        r_json = self._get_json('issue/' + str(issue) + '/worklog')
        worklogs = [Worklog(self._options, self._session, raw_worklog_json)
                    for raw_worklog_json in r_json['worklogs']]
        return worklogs

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions