CreateDerivedEnumerationCodec

sttp.tapir.macros.CreateDerivedEnumerationCodec
class CreateDerivedEnumerationCodec[L, T](validator: Enumeration[T], schemaAnnotations: SchemaAnnotations[T])

Attributes

Graph
Supertypes
class Object
trait Matchable
class Any

Members list

Concise view

Value members

Constructors

def this(validator: Enumeration[T])

Concrete methods

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

Creates the codec using the provided decoding & encoding functions.

Creates the codec using the provided decoding & encoding functions.

Attributes

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.

def defaultStringBased(implicit lIsString: L =:= String): PlainCodec[T]

Creates the codec assuming the low-level representation is a String. The encoding function uses the enum's .toString. Similarly, the decoding function performs a case-insensitive search using the enum's .toString

Creates the codec assuming the low-level representation is a String. The encoding function uses the enum's .toString. Similarly, the decoding function performs a case-insensitive search using the enum's .toString

Attributes