Atom

sttp.tapir.EndpointTransput.Atom
sealed trait Atom[T] extends Basic[T]

Attributes

Graph
Supertypes
trait Basic[T]
trait EndpointTransput[T]
class Object
trait Matchable
class Any
Show all
Known subtypes
trait Atom[T]
trait Atom[I]
class Body[R, T]
class Empty[T]
class FixedHeader[T]
class Header[T]
class Headers[T]
class StreamBodyWrapper[BS, T]
class Cookie[T]
class FixedMethod[T]
class FixedPath[T]
class PathCapture[T]
class PathsCapture[T]
class Query[T]
class QueryParams[T]
trait Atom[T]
class FixedStatusCode[T]
class StatusCode[T]
class WebSocketBodyWrapper[PIPE_REQ_RESP, T]
class StreamBodyIO[BS, T, S]
class WebSocketBodyOutput[PIPE_REQ_RESP, REQ, RESP, T, S]
Show all

Members list

Value members

Abstract methods

def codec: Codec[L, T, CF]
def info: Info[T]

Concrete methods

def attribute[A](k: AttributeKey[A]): Option[A]
def attribute[A](k: AttributeKey[A], v: A): ThisType[T]
def default(d: T): ThisType[T]
def deprecated(): ThisType[T]
def description(d: String): ThisType[T]
def example(t: T): ThisType[T]
def example(example: Example[T]): ThisType[T]
def examples(examples: List[Example[T]]): ThisType[T]
override def map[U](mapping: Mapping[T, U]): ThisType[U]

Attributes

Definition Classes
def schema(s: Schema[T]): ThisType[T]
def schema(s: Option[Schema[T]]): ThisType[T]
def schema(modify: Schema[T] => Schema[T]): ThisType[T]
def validateIterable[C <: (Iterable), U](v: Validator[U])(implicit tIsCU: T =:= C[U]): ThisType[T]

Adds a validator which validates each element in the collection.

Adds a validator which validates each element in the collection.

Should only be used if the schema hasn't been created by .mapping another one, but directly from Schema[U]. Otherwise the shape of the schema doesn't correspond to the type T, but to some lower-level representation of the type. This might cause invalid results at run-time.

Attributes

def validateOption[U](v: Validator[U])(implicit tIsOptionU: T =:= Option[U]): ThisType[T]

Adds a validator which validates the option's element, if it is present.

Adds a validator which validates the option's element, if it is present.

Should only be used if the schema hasn't been created by .mapping another one, but directly from Schema[U]. Otherwise the shape of the schema doesn't correspond to the type T, but to some lower-level representation of the type. This might cause invalid results at run-time.

Attributes

Inherited methods

def map[U](f: T => U)(g: U => T): ThisType[U]

Attributes

Inherited from:
EndpointTransput
def mapDecode[U](f: T => DecodeResult[U])(g: U => T): ThisType[U]

Attributes

Inherited from:
EndpointTransput
inline def mapTo[CASE_CLASS <: Product](using mc: ProductOf[CASE_CLASS]): ThisType[CASE_CLASS]

Attributes

Inherited from:
EndpointTransputMacros
def mapValidate[U](v: Validator[T])(f: T => U)(g: U => T): ThisType[U]

Adds the given validator, and maps to the given higher-level type U.

Adds the given validator, and maps to the given higher-level type U.

Unlike a .validate(v).map(f)(g) invocation, during decoding the validator is run before applying the f function. If there are validation errors, decoding fails. However, the validator is then invoked again on the fully decoded value.

This is useful to create inputs/outputs for types, which are unrepresentable unless the validator's condition is met, e.g. due to preconditions in the constructor.

Attributes

See also
Inherited from:
EndpointTransput
def show: String

Attributes

Inherited from:
EndpointTransput
def validate(v: Validator[T]): ThisType[T]

Adds a validator.

Adds a validator.

Note that validation is run on a fully decoded value. That is, during decoding, first the decoding functions are run, followed by validations. Hence any functions provided in subsequent .maps or .mapDecodes will be invoked before validation.

Attributes

See also
Inherited from:
EndpointTransput