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

feat: Raise an error when invalid custom field is specified. #518

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

martinpovolny
Copy link
Contributor

@martinpovolny martinpovolny commented Dec 5, 2022

Raise an error when an invalid custom field is specified.

Currently, the invalid custom field is silently ignored which creates a wrong impressing that everything is OK.

Copy link
Owner

@ankitpokhrel ankitpokhrel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @martinpovolny, thank you for the PR.

I think the validation was not added because the Jira API is flexible about this. The API simply ignores invalid fields and set the valid ones. The CLI behavior is same as this and I am not sure if we need to be strict on the CLI side. Also, this would be sort of a breaking change IMO. Thoughts?


if !found {
fmt.Fprintf(os.Stderr, "\nInvalid custom field specified: %s\n", key)
os.Exit(1)
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since this is a package, instead of exiting we should return appropriate error and let the caller decide what to do with the error.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed.

@martinpovolny
Copy link
Contributor Author

martinpovolny commented Dec 10, 2022

The CLI behavior is same as this and I am not sure if we need to be strict on the CLI side. Also, this would be sort of a breaking change IMO. Thoughts?

The problem is that when you (as a user) have incorrectly set Custom fields in the configuration file, you have no idea, what is happening because the invalid custom field is silently ignored.

That is confusing and creates frustration when using the Custom fields feature. It took me several tries and several minutes to figure out what was wrong in my case.

At the very least there should be a warning. You are passing an argument and expect it to have an effect. There's none.

I would not consider it a breaking change when the CLI newly checks this. It merely points out an error situation that was previously wrongly ignored.

@ankitpokhrel
Copy link
Owner

I would not consider it a breaking change when the CLI newly checks this. It merely points out an error situation that was previously wrongly ignored.

I think we should start with the warning and fail in future release. I would suggest the following:

  • Add a warning when running the command so the users of this feature are aware of the incoming change.
  • Do a new minor release with this change in place.
  • A version after that will include the patch to fail for invalid custom field.

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.

2 participants