atlassian-api / atlassian-python-api

Atlassian Python REST API wrapper
https://atlassian-python-api.readthedocs.io
Apache License 2.0
1.33k stars 660 forks source link

in version 3.13.0 get_project_versions_paginated() does not respect status #837

Open wetjenk opened 3 years ago

wetjenk commented 3 years ago
    def get_paginated_project_version(
        self,
    ):
        """
        Returns all project versions paginated as an iterator.
        """
        all_proj_relcand_dicts = self.jira.get_project_versions_paginated(
            key=self.spacekey,
            start=None,
            limit=100000,
            order_by="releaseDate",
            expand=None,
            query=None,
            status=["unreleased"],
        )

        return all_proj_relcand_dicts

This should return only unreleased versions. but it only returns released versions. Problem does not occur in 3.9

cheers

gonchik commented 3 years ago

Hi @wetjenk , Could you share a version of Jira? or you meant it's only wrapper level ?

Cheers, Gonchik

wetjenk commented 3 years ago

hi, not sure what you mean exactly?

using version 3.13.0 of atlassian-python-api calling to Atlassian Jira Project Management Software (v8.15.1#815002-sha1:9ca7b02)

the function the wrapper is calling seems to not work afaik

hope that helps?

leehicks-pe commented 3 months ago

The status parameter for the Jira wrapper for get_project_versions_paginated is supposed to accept a list of statuses, and that is what its documentation indicates. This would match the status parameter for the Jira API call, as it accepts a list.

However in the Jira class implementation, the status parameter is being treated as a string, its value is validated to be in a list of the valid values, and then it is put into a list:

    if status in ["released", "unreleased", "archived"]:
        params["status"] = status

This ends up returning all versions because the if statement will always be False when the caller passes in a list.

What it needs to do instead if status is not None:

Validate each value in the status list passed in by the caller and create a list of the resulting valid values to pass to the API call.