Skip to main content
Version: Deploy 24.3

Defining a synthetic enum property

This topic will explain how to create an enum kind property fully in synthetic.xml. In previous versions of the product(s) you needed to have a compiled Java Enum class on the classpath to define the values of the enumeration. Now you can add the following properties to the synthetic.xml file of your plugins / extensions:

<type ...>
<property name="myEnum" kind="enum">
<enum-values>
<value>value-1</value>
<value>value-2</value>
</enum-values>
</property>
</type>

Now the UI will show a drop-down box with a choice of value-1 and value-2. And it will automatically be validated that the value entered is one of the choices.

Define Dynamic UI Fields Based on the Value of an enum Property

The following example synthetic.xml shows how we can further restrict enum values of an existing enum property and show only a subset of all properties (i.e. show only properties associated with selected enum value):

<type-modification type="some.Server">
<property name="authenticationMethod" kind="enum"
enum-class="com.xebialabs.xlrelease.domain.configuration.HttpConnection$AuthenticationMethod"
hidden="false" default="None">
<!--
Use enum-values to additionally restrict possible authentication methods
from [None, Basic, Ntlm, PAT, Oauth2] to [None, Basic, NTLM].
-->
<enum-values>
<value>None</value>
<value>Basic</value>
<value>PAT</value>
</enum-values>
</property>

<!--
Define hidden property with the name in the format `<enum_property_name>_DependentProperties`.
It maps certain enum values to property fields that will be displayed when that value is selected.
Other properties with the same category (in the example: `Authentication`) will be hidden.
-->
<property name="authenticationMethod_DependentProperties"
category="Authentication"
kind="map_string_string"
hidden="true"
required="false"
default="Basic:username;password,PAT:apiToken" />
</type-modification>