EndpointTransput

sttp.tapir.EndpointTransput
See theEndpointTransput companion object
sealed trait EndpointTransput[T] extends EndpointTransputMacros[T]

A transput is EITHER an input, or an output (see: https://ell.stackexchange.com/questions/21405/hypernym-for-input-and-output). The transput traits contain common functionality, shared by all inputs and outputs.

Note that implementations of EndpointIO can be used both as inputs and outputs.

The hierarchy is as follows:

                       /---> `EndpointInput`  >---\
`EndpointTransput` >---                            ---> `EndpointIO`
                       \---> `EndpointOutput` >---/

Inputs and outputs additionally form another hierarchy:

                                     /--> `Single` >--> `Basic` >--> `Atom`
`EndpointInput` / `EndpointOutput` >--
                                     \--> `Pair`

where the intuition behind the traits is:

  • single: represents a single value, as opposed to a pair (tuple); a pair, but transformed using .map is also a single value
  • basic: corresponds to an input/output which is encoded/decoded in one step; always single
  • atom: corresponds to a single component of a request or response. Such inputs/outputs contain a Codec and Info meta-data, and are always basic

Attributes

Companion
object
Graph
Supertypes
class Object
trait Matchable
class Any
Known subtypes
trait EndpointInput[T]
trait EndpointIO[T]
class Pair[T, U, TU]
trait Single[I]
trait Basic[I]
trait Atom[I]
class Body[R, T]
class Empty[T]
class FixedHeader[T]
class Header[T]
class Headers[T]
class StreamBodyWrapper[BS, T]
class OneOfBody[O, T]
class MappedPair[T, U, TU, V]
class Pair[T, U, TU]
trait Single[T]
class Auth[T, TYPE]
trait Basic[T]
trait Atom[T]
class Cookie[T]
class FixedMethod[T]
class FixedPath[T]
class PathCapture[T]
class PathsCapture[T]
class Query[T]
class QueryParams[T]
class MappedPair[T, U, TU, V]
trait EndpointOutput[T]
class Pair[T, U, TU]
trait Single[T]
trait Basic[T]
trait Atom[T]
class FixedStatusCode[T]
class StatusCode[T]
class WebSocketBodyWrapper[PIPE_REQ_RESP, T]
class MappedPair[T, U, TU, V]
class OneOf[O, T]
class Void[T]
trait Basic[T]
trait Atom[T]
class StreamBodyIO[BS, T, S]
class WebSocketBodyOutput[PIPE_REQ_RESP, REQ, RESP, T, S]
trait Pair[T]
Show all

Members list

Value members

Abstract methods

def map[U](mapping: Mapping[T, U]): ThisType[U]
def show: String

Concrete methods

def map[U](f: T => U)(g: U => T): ThisType[U]
def mapDecode[U](f: T => DecodeResult[U])(g: U => T): ThisType[U]
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
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 methods

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

Attributes

Inherited from:
EndpointTransputMacros