← Back to Kairo Docs|API Reference (Dokka)

Required

sealed class Required<out T : Any> : OptionalBase<T>

Like Optional but without a Null variant. Use when the value must be non-null if present. Useful for required fields in JSON Merge Patch.

Inheritors

Types

Link copied to clipboard
object Companion
Link copied to clipboard
data object Missing : Required<Nothing>

The value was absent from the JSON. Treat as "do not modify".

Link copied to clipboard
data class Value<T : Any>(val value: T) : Required<T>

The value was present and non-null in the JSON.

Properties

Link copied to clipboard
abstract val isSpecified: Boolean

Functions

Link copied to clipboard
abstract override fun getOrThrow(): T
Link copied to clipboard
fun <T : Any> Required<T>.ifSpecified(block: (T) -> Unit)
Link copied to clipboard
fun <T : Any, R : Any> Required<T>.transform(block: (T) -> R): Required<R>

Applies block to the inner value, preserving Required.Missing state.