Data validation in JIRA reports
Whenever we take user inputs, it is always a good idea to validate them to make sure the input is in the format that is expected. The same applies to reports also. JIRA reports, as we have seen in the previous recipes, accept user inputs based on which reports are generated. In the previous example we used, a project is selected and the details of issues in the selected project are displayed.
In the previous example, the likelihood of a wrong project being selected is low, as the project is selected from a valid list of available projects. However, the final URL that generates the report can be tampered with to include a wrong project ID, and so it is best to do the validation no matter how the input is taken.
Getting ready
Create the report plugin, as explained in the first recipe of this chapter.
How to do it...
All we need here is to override the validate
method to include our custom validations. The following are the steps:
Override the
validate
method...