Skip to main content

Validation

String, integer or long type settings can have custom regular expression that will be used to validate the setting. If a value is entered that does not match the regex then a custom message will be shown to the person configuring the setting and saving will not be allowed.

Usage

[Setting("This is a string", "Horse")]
[Validation("[0-9a-zA-Z]{5,}", "Must have 5 or more characters")]
public string AStringSetting { get; set; } = null!;

It is also possible to use some built in regular expressions for common validation checks. For example:

[Setting("This is a string", "Horse")]
[Validation(ValidationType.NotEmpty)]
public string AStringSetting { get; set; } = null!;

Appearance

Validation

Overriding via Environment Variable

The validation value can be overridden using an environment variable. It should be in the format FIG_SettingName_VALIDATIONREGEX and FIG_SettingName_VALIDATIONEXPLANATION

Use a value of 'null' to clear the current value.