CodecMacros

class Object
trait Matchable
class Any
object Codec

Value members

Concrete methods

inline
def derivedEnumeration[L, T](decode: L => Option[T], encode: T => L, default: Option[T])(implicit baseCodec: PlainCodec[L]): PlainCodec[T]

Creates a codec for an enumeration, where the validator is derived using sttp.tapir.Validator.derivedEnumeration. This requires that all subtypes of the sealed hierarchy T must be objects.

Creates a codec for an enumeration, where the validator is derived using sttp.tapir.Validator.derivedEnumeration. This requires that all subtypes of the sealed hierarchy T must be objects.

Type Params
L

The type of the low-level representation of the enum, typically a String or an Int.

T

The type of the enum.

Value Params
decode

How low-level values are decoded to the enum value. None if the low-level value is invalid, that is, when there's no high-level enum value.

encode

How the enum value is encoded as a low-level value.