runValidation

fun <T> runValidation(formSchema: Schema<*>, validation: Validation<T>, value: T, path: Path = AbsolutePath.ROOT, dependencyValues: Map<String, Any?>? = null, externalContexts: ExternalContexts? = null): Flow<ValidationIssue>(source)
fun <T> runValidation(formSchema: Schema<*>, validation: Validation<T>, value: T, path: String, dependencyValues: Map<String, Any?>? = null, externalContexts: ExternalContexts? = null): Flow<ValidationIssue>(source)

Runs a given validation within a form with schema formSchema and returns a flow over its issues.

It is necessary to provide all information required to run the validation: the path of the value being validated, the value itself, the values of the dependencies (by dependency name), and the values of the external contexts that the validation depends on.

If the validation depends on values within the value being validated, then these may be omitted from the provided dependencyValues.

Otherwise, missing dependencies or external contexts will be passed to the validation as null, in which case the validation may or may not throw depending on its implementation.

Exceptions thrown while running the validation will not be caught by this function. As opposed to how a form manager operates, exceptions are not wrapped in a ValidationFailure nor emitted as part of the issues flow.

Throws

If path matches no schemas or contains fragments other than ids.

If validation contains an invalid dependency.

When providing unknown names for dependencyValues or externalContexts or when providing mismatching dependency values for dependencies within value.


fun <T> runValidation(validation: Validation<T>, value: T, path: Path = AbsolutePath.ROOT, dependencyValues: Map<String, Any?>? = null, externalContexts: ExternalContexts? = null): Flow<ValidationIssue>(source)
fun <T> runValidation(validation: Validation<T>, value: T, path: String, dependencyValues: Map<String, Any?>? = null, externalContexts: ExternalContexts? = null): Flow<ValidationIssue>(source)

Runs a given validation within a form with a schema of type AnySchema and returns a flow over its issues.

It is necessary to provide all information required to run the validation: the path of the value being validated, the value itself, the values of the dependencies (by dependency name), and the values of the external contexts that the validation depends on.

If the validation depends on values within the value being validated, then these may be omitted from the provided dependencyValues.

Otherwise, missing dependencies or external contexts will be passed to the validation as null, in which case the validation may or may not throw depending on its implementation.

Exceptions thrown while running the validation will not be caught by this function. As opposed to how a form manager operates, exceptions are not wrapped in a ValidationFailure nor emitted as part of the issues flow.

Throws

If path matches no schemas or contains fragments other than ids.

If validation contains an invalid dependency.

When providing unknown names for dependencyValues or externalContexts or when providing mismatching dependency values for dependencies within value.