CRUDUI

Home > @polyspec/crudui-validator > ValidateSlot

ValidateSlot interface

Validation rules (SPEC §3 slots.validate). Each value may be an expression/condition map, expressing conditional validation without a separate key (e.g. required: '.subscribe', email: true) — the condition is the value's expression (G1), never a separate key.

The named members are every built-in rule, with the parameter shapes the meta-schema declares; false or null disables a rule. equalTo, containedIn, typeFrom, minFrom, maxFrom, notEqual, unique, enddate, reference, accept, match, pattern, in and conditionTree receive their parameter unchanged, so they take no condition map. No other rule name exists: the meta-schema rejects it and the runtime fails the load with UNKNOWN_RULE.

Signature:

export interface ValidateSlot 

Properties

Property

Modifiers

Type

Description

accept?

string | string[] | false | null

(Optional) Accepted file extensions or MIME types.

conditionTree?

true | 'judge' | false | null

(Optional) A condition tree; judge also permits judged text (validation-rules.md, "Condition trees").

containedIn?

string | false | null

(Optional) Field whose string value must contain the string value (CUVR-075).

date?

Evaluated<boolean | null>

(Optional) Requires a valid date when enabled.

dateISO?

Evaluated<boolean | null>

(Optional) Requires a YYYY-MM-DD date when enabled.

digits?

Evaluated<boolean | null>

(Optional) Requires digits only when enabled.

email?

Evaluated<boolean | null>

(Optional) Requires a syntactically valid email address when enabled.

enddate?

string | false | null

(Optional) Start-date field the end date must not precede.

equalTo?

string | false | null

(Optional) Field whose value must be equal.

in?

string | Array<string | number | boolean | null> | Array<ChoicePair | ChoiceGroup> | Record<string, LangMap | string | null> | false | null

(Optional) Allowed values: comma-separated string, list, choice list with groups, or value-to-label map.

match?

string | false | null

(Optional) Regular expression the value must match.

max?

Evaluated<number | false | null>

(Optional) Numeric upper bound.

maxcount?

Evaluated<number | false | null>

(Optional) Maximum collection size.

maxFrom?

string | false | null

(Optional) Field whose value is the inclusive upper bound of the value (CUVR-079).

maxlength?

Evaluated<number | false | null>

(Optional) Maximum string length.

min?

Evaluated<number | false | null>

(Optional) Numeric lower bound.

mincount?

Evaluated<number | false | null>

(Optional) Minimum collection size.

minFrom?

string | false | null

(Optional) Field whose value is the inclusive lower bound of the value (CUVR-079).

minlength?

Evaluated<number | false | null>

(Optional) Minimum string length.

notEqual?

string | number | boolean | null

(Optional) Dot-prefixed field reference or literal value the input must differ from.

number?

Evaluated<boolean | null>

(Optional) Requires a finite number when enabled.

pattern?

string | false | null

(Optional) Same rule as match.

range?

Evaluated<[number, number] | false | null>

(Optional) Numeric lower and upper bounds.

rangelength?

Evaluated<[number, number] | false | null>

(Optional) Minimum and maximum string length.

reference?

string | false | null

(Optional) Declaration path of the field whose values are the ids the value must name.

required?

Evaluated<boolean | null>

(Optional) Requires a supplied, nonempty value when enabled.

step?

Evaluated<number | false | null>

(Optional) Numeric increment.

typeFrom?

string | false | null

(Optional) Field whose value names the type of the value: bool, int or enum (CUVR-077).

unique?

boolean | string | null

(Optional) Uniqueness; a string names an item field or a filter condition.

url?

Evaluated<boolean | null>

(Optional) Requires a valid URL when enabled.