Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

expand parameter missing in JIRA get_issue vs issue methid #1354

Closed
gkowalc opened this issue Mar 20, 2024 · 1 comment
Closed

expand parameter missing in JIRA get_issue vs issue methid #1354

gkowalc opened this issue Mar 20, 2024 · 1 comment

Comments

@gkowalc
Copy link
Contributor

gkowalc commented Mar 20, 2024

I am trying to get details from the issue and to expand some of the fields (like changelog). Looking at the code I noticed we have a method named issue:

def issue(self, key, fields="*all", expand=None):
        base_url = self.resource_url("issue")
        url = "{base_url}/{key}?fields={fields}".format(base_url=base_url, key=key, fields=fields)
        params = {}
        if expand:
            params["expand"] = expand
        return self.get(url, params=params)

which takes expand params. I tested it and everything works well.
But we also have method get_issue:

  def get_issue(
        self,
        issue_id_or_key,
        fields=None,
        properties=None,
        update_history=True,
    ):
        """
        Returns a full representation of the issue for the given issue key
        By default, all fields are returned in this get-issue resource

        :param issue_id_or_key: str
        :param fields: str
        :param properties: str
        :param update_history: bool
        :return: issue
        """
        base_url = self.resource_url("issue")
        url = "{base_url}/{issue_id_or_key}".format(base_url=base_url, issue_id_or_key=issue_id_or_key)
        params = {}

        if fields is not None:
            if isinstance(fields, (list, tuple, set)):
                fields = ",".join(fields)
            params["fields"] = fields
        if properties is not None:
            params["properties"] = properties
        if update_history is True:
            params["updateHistory"] = "true"
        if update_history is False:
            params["updateHistory"] = "false"

        return self.get(url, params=params)

which takes few other parameters fields=None, properties=None, update_history=True but not expand. Is there a good reason to have to methods which basically serve the same functionality which different set of accepted parameters?
Im thinking about adding PR with:

      if expand:
           params["expand"] = expand `

condition to get_issue method and add a deprecated note to issue method (so that people relying on that method can re-write their code before removing duplicated issue method. What do you think?

@gkowalc
Copy link
Contributor Author

gkowalc commented Mar 22, 2024

I added PR that adds expand parameter to get_issue method - #1357

@gkowalc gkowalc closed this as completed Mar 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant