CodecMacros

class Object
trait Matchable
class Any
object Codec.type

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 parameters:
L

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

T

The type of the enum.

Value parameters:
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.

Implicits

Implicits

implicit inline def derivedValueClass[T <: AnyVal]: Codec[String, T, TextPlain]

Creates a codec for value class based on codecs defined in Codec companion

Creates a codec for value class based on codecs defined in Codec companion