dynoKey

inline fun <T> dynoKey(name: String? = null, serializer: KSerializer<T & Any> = kotlinx.serialization.serializer<T>().unsafeCast()): SchemaPropertySpec<T>

Creates a SchemaPropertySpec for type T with an optional name.

If name is not provided, it will be inferred from the property name when used with by delegate syntax.

The resulting prototype can be further configured with onAssign, onDecode, or validate methods.

Example:

object Person: SimpleDynoSchema {
val name by dynoKey<String>() // name inferred from property
val age by dynoKey<Int>("userAge") // explicit name

val email by dynoKey<String>()
.validate { require("@" in it) { "Invalid email" } }
}

inline fun <S2 : AbstractDynoSchema<M>, M> dynoKey(schema: S2): SchemaPropertySpec<M>
inline fun <S2 : EntitySchema> dynoKey(schema: S2): SchemaPropertySpec<Entity<S2>>