pycontribs / jira

Python Jira library. Development chat available on https://matrix.to/#/#pycontribs:matrix.org
https://jira.readthedocs.io
BSD 2-Clause "Simplified" License
1.96k stars 870 forks source link

Add support for /customFields endpoint #1619

Open majusmisiak opened 1 year ago

majusmisiak commented 1 year ago

Problem trying to solve

I would like to be able to fetch customfield descriptions from Jira. Use case is for generating documentation of existing fields. It looks like there is no function in the library that supports fetching field description.

Currently the library support /field endpoint, which strangely enough does not return custom field description.

Example data structure

  {
    "id": "issuetype",
    "name": "Issue Type",
    "custom": false,
    "orderable": true,
    "navigable": true,
    "searchable": true,
    "clauseNames": [
      "issuetype",
      "type"
    ],
    "schema": {
      "type": "issuetype",
      "system": "issuetype"
    }
  },

Possible solution(s)

There is another API endpoint in Jira server called /customFields, which seems to have relevant description data.

LTS 8 and 9 version docs: https://docs.atlassian.com/software/jira/docs/api/REST/8.20.19/#api/2/customFields-getCustomFields https://docs.atlassian.com/software/jira/docs/api/REST/9.4.3/#api/2/customFields-getCustomFields

    {
      "id": "customfield_12345",
      "name": "Custom Field Name",
      "description": "The description of the custom field",
      "type": "Labels",
      "searcherKey": "exacttextsearcher",
      "projectIds": [],
      "issueTypeIds": [],
      "self": "<jira-server>/jira/rest/api/2/customFields/customfield_12345",
      "numericId": 12345,
      "isLocked": false,
      "isManaged": false,
      "isAllProjects": true,
      "isTrusted": true,
      "projectsCount": 0,
      "screensCount": 0
    }

Alternatives

No response

Additional Context

Open to implement, if this is not already supported in some other way that I missed?

studioj commented 1 year ago

could it be this would be part of a solution for you? https://github.com/pycontribs/jira/pull/1626/files#diff-442d14b20d591afd0c3de830d2803e30d4816eedc708f9ad129316aa7e5a4a7cR2665

majusmisiak commented 1 year ago

Hi @studioj unfortunately this endpoint returns fieldId and name, but not the description.

For now, I am using plain requests.get() to retrieve this information.