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

Add support for Jira 9+ CreateMeta handling #514

Conversation

hmmwhatsthisdo
Copy link
Contributor

Description

This PR adjusts Get-JiraIssueCreateMetadata and ConvertTo-JiraCreateMetaField to support Jira 9, where CreateMeta changes have prevented creation of issues.

In Jira 9 and above, the instance-level CreateMeta endpoint was removed from the REST API. The only CreateMeta option available is the one specific to project/issue types.

JiraPS already handles this limitation as Get-JiraIssueCreateMetadata is scoped to an individual project/issuetype, but what's missing is support for the new:

  • API endpoint
  • Response format (see below)

New response format

In Jira 8 and below, the "old" CreateMeta endpoint returned a collection of projects, those projects' issue types, and those issue types' fields.

The .projects.issuetypes.fields property was a KVP/dictionary type where:

  • Key names were field IDs: assignee, reporter, customfield_10101
  • Values were another dictionary with those fields' relevant configurations: fieldID (...yeah, again), name, required, etc.

In Jira 9+, the new CreateMeta endpoint returns a paginated array of objects matching the values from Jira 8. Field IDs are still included in the array of response objects, but are no longer being used as the key in a key/value pair.

To accommodate this, ConvertTo-JiraCreateMetaField packs both forms of responses into an array of hashtables, where:

  • Name is the field ID.
  • Value is the field's configuration object.

Then performs the same value-conversion process for both response shapes.

Areas of uncertainty

  • Get-JiraIssueCreateMetadata uses Write-DebugMessage, whereas ConvertTo-JiraCreateMetaField uses just Write-Debug. Which do we want to use here?
  • Jira 8.4 has the same "new" CreateMeta endpoint as Jira 9. Do we want to move the "bar" for old/new CreateMeta endpoints further back in Jira's historical versions?
  • The Jira 9+ CreateMeta endpoint appears to be paginated. Get-JiraIssueCreateMetadata does not currently attempt pagination.
    • Do we just need to add -Paging to the call to Invoke-JiraMethod for this?
    • Given that Jira 8 does not support paging this response, how do we feel about not marking Get-JiraIssueCreateMetadata as supporting paging? I feel like marking the cmdlet as SupportsPaging but then throwing if we're on Jira 8 is not helpful for end-users.

Motivation and Context

Closes #461, #469, #473, and #498,

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist

  • My code follows the code style of this project.
  • I have added Pester Tests that describe what my changes should do.
  • I have updated the documentation accordingly.

@hmmwhatsthisdo hmmwhatsthisdo requested a review from a team as a code owner August 2, 2024 03:19
@hmmwhatsthisdo hmmwhatsthisdo changed the base branch from develop to release/2.15-alpha August 2, 2024 03:20
@hmmwhatsthisdo
Copy link
Contributor Author

Whoops - didn't realize this was already done in #488.

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

Successfully merging this pull request may close these issues.

Jira 9 breaks creating Jira issues
1 participant