MentionValidationRule

sealed interface MentionValidationRule

Type-safe validation rule for entity mentions.

Each rule is a strongly-typed class with compile-time checking. Rules can be composed using AllOf and AnyOf combinators.

Implements PropertyValidationRule to enable type-safe schema definitions:

ValidatedPropertyDefinition(
name = "name",
validationRules = listOf(
NoVagueReferences(),
LengthConstraint(maxLength = 150)
)
)

Inheritors

Properties

Link copied to clipboard
abstract val description: String

Human-readable description of this rule.

Functions

Link copied to clipboard
open fun failureReason(mention: String): String?
Link copied to clipboard
open fun isValid(mention: String): Boolean
Link copied to clipboard
abstract fun validate(mention: String): ValidationResult

Validate a mention span.