jira-cli icon indicating copy to clipboard operation
jira-cli copied to clipboard

Unable to create issue due to additional required fields

Open allout58 opened this issue 4 years ago • 5 comments

What it should do

Find required fields, and allow inputting required ones

What it does

Fails to create a new issue because some fields are required for new issues on our Jira projects.

Other Info

After looking into the Jira API a bit, the expand query string can be set to get all fields on an issue type. However, with many projects this can be massive. I would suggest waiting to fetch a more detailed set of metadata until after the user has selected the project at the very least, maybe even better to wait until they have selected the type. The request can then be filtered down by project name and issue type to limit the returned data (see https://docs.atlassian.com/software/jira/docs/api/REST/8.1.2/#api/2/issue-getCreateIssueMeta)

allout58 avatar Jul 11 '19 04:07 allout58

This could be fairly easy to implement as you said, however, I'm thinking how we can implement this when creating issues without the interactive mode, any ideas?

miguelmich avatar Jul 12 '19 00:07 miguelmich

One temporal solution, if the project and issue type are provided and it has additional fields, enter into the interactive mode to ask for those required fields: jira create -p PK -t bug -m "My issue name" (ask for the required fields interactively) what do you think?

miguelmich avatar Jul 12 '19 00:07 miguelmich

Maybe provide a "generic" flag where you could pass some kind of set of key value pairs for the additional fields, maybe just a plain old JSON object (which would be cleaner to parse, but might be harder to type). I don't know about the flag parsing library you are using, but if you are allowed to repeat flags, you could do like -c "key: value" -c "key2: value2" to allow for multiple fields to be input.

The "go-to-interactive" thing seems like a decent stopgap, but looses some of the power you get to automate things when you have everything as a flag.

allout58 avatar Jul 12 '19 02:07 allout58

@allout58 that sounds good, and it's supported by commander, now I'm thinking about the data type, is it always text?

miguelmich avatar Jul 25 '19 05:07 miguelmich

Here is an example of the types for the project I found this issue on originally.

["issuetype","array","string","project","option","timetracking","any","date","user","priority","issuelink"]

It looks like just strings should be okay, as my guess is all of these would have to be typed as strings for the JSON request anyways.

allout58 avatar Jul 28 '19 17:07 allout58