Add support for Jira 9+ CreateMeta handling #514
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
This PR adjusts
Get-JiraIssueCreateMetadata
andConvertTo-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: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:assignee
,reporter
,customfield_10101
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
usesWrite-DebugMessage
, whereasConvertTo-JiraCreateMetaField
uses justWrite-Debug
. Which do we want to use here?Get-JiraIssueCreateMetadata
does not currently attempt pagination.-Paging
to the call toInvoke-JiraMethod
for this?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
Checklist