CodecMacros

sttp.tapir.macros.CodecMacros

Attributes

Graph
Supertypes
class Object
trait Matchable
class Any
Known subtypes
object Codec.type

Members list

Concise view

Value members

Concrete methods

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.

This method cannot be implicit, as there's no way to constraint the type T to be a sealed trait / class enumeration, so that this would be invoked only when necessary.

Attributes

L

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

T

The type of the enum.

Creates a codec for an Enumeration, where the validator is created using the enumeration's values. Unlike the default derivedEnumerationValue method, which provides the schema implicitly, this variant allows customising how the codec is created. This is useful if the low-level representation of the schema is different than a String, or if the enumeration's values should be encoded in a different way than using .toString.

Creates a codec for an Enumeration, where the validator is created using the enumeration's values. Unlike the default derivedEnumerationValue method, which provides the schema implicitly, this variant allows customising how the codec is created. This is useful if the low-level representation of the schema is different than a String, or if the enumeration's values should be encoded in a different way than using .toString.

Because of technical limitations of macros, the customisation arguments can't be given here directly, instead being delegated to CreateDerivedEnumerationSchema.

Attributes

L

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

T

The type of the enum.

Implicits

Implicits

implicit inline def derivedEnumerationValue[T <: Value]: Codec[String, T, TextPlain]

A default codec for enumerations, which returns a string-based enumeration codec, using the enum's .toString to encode values, and performing a case-insensitive search through the possible values, converted to strings using .toString.

A default codec for enumerations, which returns a string-based enumeration codec, using the enum's .toString to encode values, and performing a case-insensitive search through the possible values, converted to strings using .toString.

To customise the enum encoding/decoding functions, provide a custom implicit created using derivedEnumerationValueCustomise.

Attributes

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

Attributes