All Downloads are FREE. Search and download functionalities are using the official Maven repository.

commonMain.Validations.kt Maven / Gradle / Ivy

package pt.lightweightform.lfkotlin

/** Schema validation. */
public interface Validation

/** Synchronous schema validation. */
public interface SyncValidation : Validation {
    /**
     * Synchronously validates a value within a context by returning an iterable of found issues.
     */
    public fun Context.validate(value: T): Iterable
}

/** Computed "is required" validation. */
public interface IsRequired

/** Synchronous computed "is required" validation. */
public interface SyncIsRequired : IsRequired {
    /** Synchronously verifies whether a value is required within a context. */
    public fun Context.isRequired(): Boolean
}

/** Computed "allowed values" used for validation. */
public interface AllowedValues

/** Synchronous computed "allowed values" validation. */
public interface SyncAllowedValues : AllowedValues {
    /** Synchronously returns the allowed values that a schema is allowed to contain. */
    public fun Context.allowedValues(): List?
}

/**
 * Computed "bound" used for validation (`min`, `max`, `minDate`, `maxDate`, `minLength`,
 * `maxLength`, `minSize`, or `maxSize`).
 */
public interface Bound

/** Synchronous computed "bound" used for validation. */
public interface SyncBound : Bound {
    /** Synchronously returns a bound that should be respected. */
    public fun Context.bound(): T?
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy