FacetOwner
Additional validation that a plugin applies to the values of a facet. The app first checks a value against the schema of the facet, and then calls validate for the rules that a schema cannot express, such as a relationship between two fields.
Example
Section titled “Example”ctx.facets.define(minutes, { validate: value => (typeof value === 'number' && value >= 0 ? valid() : invalid({ code: 'minutes', message: 'Minutes must be zero or more' })),});Properties
Section titled “Properties”validate?
Section titled “validate?”readonly validate?: (value) => ValueVerdict;Called for a value that already conforms to the schema.
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
value |
unknown |
the value to check |
Returns
Section titled “Returns”valid() to accept the value, coerced(value) to keep another value in its place, or invalid({ code, message }) to refuse it
