As a Tracker Administrator,
When I configure a Tracker
I wish to upload a Validating Tuleap Function
As a Tracker user,
When I validate the changes on an Artifact
Then a Validating Tuleap Function verifies the new values and possibly blocks the change, emitting and error message.
Currently, the Tuleap Functions ensure the role of Mutating hooks: the artifacts values are possibly transformed automatically.
A Validating Tuleap Function will only do checks on the values. If the checks are OK, the changes are applied. If not, an error is returned and displayed by the Web UI or REST API client.
As possible use cases:
- allow finest format validation for string input (verify a CamelCase syntax, verify a syntax like "toto::titi"...)
- allow cross fields validation
- etc. (it's a hook)
Concerning the format:
{"errors":[{
"fields":[123],
"msg":"The expected format for Field1 is CamelCase"
}]}
Or
{"errors":[{
"fields":[123,456],
"msg":"Only an administrator is able to set this combination of fields"
}]}
The idea of the fields
attribute is to let the Web UI decorate the fields concerned by the error message.