Form data validation

Hello,

I’m having trouble to find examples of data validation in Bitbucket forms.

I’m developing a plugin and it has options page. I created a servlet and soy template to it. Now I need validation mechanism.

Are there any elegant way to do validation using SDK or should I implement my own mechanism from nothing?

Hi @rafal,

Can you elaborate on what part of Bitbucket Server you’re developing for?

If you’re making a Repository Merge Check, that page suggests you might be able to use a <validator/> tag in your <repository-merge-check/>

Hello,

It’s not Repository Merge Check. It’s a plugin which do stuff based on onMerge event, but it’s not Repository Merge Check workflow.

I added options to this plugin and don’t know how to validate it. I don’t want to reinvent the wheel if there’s dedicated solution in SDK. :slight_smile:

My experience with searching info about it tells me either is some ultra secret knowledge for chosen ones or there’s no solution in SDK. :wink:

Any confirmation?

Implement the SettingsValidator interface and tie that to your <repository-merge-check/> definition.

https://docs.atlassian.com/bitbucket-server/javadoc/5.9.0/spi/reference/com/atlassian/bitbucket/setting/SettingsValidator.html

Will it work even when I’m not implementing plugin that not validates merge but does something else?