sttp.tapir.ztapir

Type members

Classlikes

abstract class ZPartialServerEndpoint[R, U, I, E, O](val endpoint: ZEndpoint[I, E, O]) extends EndpointInputsOps[I, E, O, Nothing] with EndpointOutputsOps[I, E, O, Nothing] with EndpointInfoOps[I, E, O, Nothing] with EndpointMetaOps[I, E, O, Nothing]

An endpoint, with some of the server logic already provided, and some left unspecified. See RichZEndpoint.zServerLogicForCurrent.

An endpoint, with some of the server logic already provided, and some left unspecified. See RichZEndpoint.zServerLogicForCurrent.

The part of the server logic which is provided transforms some inputs either to an error of type E, or value of type U.

The part of the server logic which is not provided, transforms a tuple: (U, I) either into an error, or a value of type O.

Inputs/outputs can be added to partial endpoints as to regular endpoints, however the shape of the error outputs is fixed and cannot be changed.

Type Params
E

Error output parameter types.

I

Input parameter types.

O

Output parameter types.

R

The environment needed by the partial server logic.

U

Type of partially transformed input.

abstract class ZServerEndpointInParts[R, U, J, I, E, O](val endpoint: ZEndpoint[I, E, O]) extends EndpointInfoOps[I, E, O, Nothing] with EndpointMetaOps[I, E, O, Nothing]

An endpoint description together with partial server logic. See RichZEndpoint.zServerLogicPart.

An endpoint description together with partial server logic. See RichZEndpoint.zServerLogicPart.

The part of the server logic which is provided transforms some inputs either to an error of type E, or value of type U.

The part of the server logic which is not provided, transforms a tuple: (U, J) either into an error of type E, or a value of type O.

Type Params
E

Error output parameter types.

I

Entire input parameter types. I = T + J, where T is the part of the input consumed by the partial logic, and converted to U.

J

Remaining input parameter types, for which logic has yet to be provided.

O

Output parameter types.

R

The environment needed by the partial server logic.

U

The type of the value returned by the partial server logic.

trait ZTapir

Inherited classlikes

class ModifyEach[F[_], T](t: F[T])(implicit f: ModifyFunctor[F, T])
class ModifyEachMap[F[_, _], K, T](t: F[K, T])(implicit fac: Factory[(K, T), F[K, T]])
Inherited from
ModifyMacroSupport
trait ModifyFunctor[F[_], A]
class RichZEndpoint[I, E, O](e: ZEndpoint[I, E, O])
Inherited from
ZTapir
class RichZServiceEndpoint[R, I, E, O](zse: ZServerEndpoint[R, I, E, O])
Inherited from
ZTapir
final class WebSocketBodyBuilder[REQ, REQ_CF <: CodecFormat, RESP, RESP_CF <: CodecFormat]
Inherited from
Tapir

Inherited types

type TapirFile = File
Inherited from
TapirExtensions
type ZEndpoint[I, E, O] = Endpoint[I, E, O, ZioStreams & WebSockets]
Inherited from
ZTapir
type ZServerEndpoint[R, I, E, O] = ServerEndpoint[I, E, O, ZioStreams & WebSockets, [_] =>> RIO[R, _$1]]
Inherited from
ZTapir

Value members

Inherited methods

def anyFromStringBody[T, CF <: CodecFormat](codec: Codec[String, T, CF], charset: Charset): Body[String, T]

A body in any format, read using the given codec, from a raw string read using charset.

A body in any format, read using the given codec, from a raw string read using charset.

Inherited from
Tapir
def anyFromUtf8StringBody[T, CF <: CodecFormat](codec: Codec[String, T, CF]): Body[String, T]

A body in any format, read using the given codec, from a raw string read using UTF-8.

A body in any format, read using the given codec, from a raw string read using UTF-8.

Inherited from
Tapir
def auth: TapirAuth
Inherited from
Tapir
def binaryBody[R, T](implicit evidence$12: Binary[R], evidence$13: Codec[R, T, OctetStream]): Body[R, T]
Inherited from
Tapir
def byteArrayBody: Body[Array[Byte], Array[Byte]]
Inherited from
Tapir
def byteBufferBody: Body[ByteBuffer, ByteBuffer]
Inherited from
Tapir
def clientIp: EndpointInput[Option[String]]
Inherited from
TapirComputedInputs
def cookies: Header[List[Cookie]]
Inherited from
Tapir
def customJsonBody[T](implicit evidence$9: JsonCodec[T]): Body[String, T]

Requires an implicit Codec.JsonCodec in scope. Such a codec can be created using Codec.json.

Requires an implicit Codec.JsonCodec in scope. Such a codec can be created using Codec.json.

However, json codecs are usually derived from json-library-specific implicits. That's why integrations with various json libraries define jsonBody methods, which directly require the library-specific implicits.

Unless you have defined a custom json codec, the jsonBody methods should be used.

Inherited from
Tapir
def emptyOutputAs[T](value: T): Basic[T]

An empty output. Useful if one of the oneOf branches of a coproduct type is a case object that should be mapped to an empty body.

An empty output. Useful if one of the oneOf branches of a coproduct type is a case object that should be mapped to an empty body.

Inherited from
Tapir
def extractFromRequest[T](f: ServerRequest => T): ExtractFromRequest[T]

Extract a value from a server request. This input is only used by server interpreters, it is ignored by documentation interpreters and the provided value is discarded by client interpreters.

Extract a value from a server request. This input is only used by server interpreters, it is ignored by documentation interpreters and the provided value is discarded by client interpreters.

Inherited from
Tapir
def fileBody: Body[TapirFile, TapirFile]
Inherited from
Tapir
def fileServerEndpoint[F[_]](path: EndpointInput[Unit])(systemPath: String): ServerEndpoint[StaticInput, StaticErrorOutput, StaticOutput[File], Any, F]

A server endpoint, which exposes a single file from local storage found at systemPath, using the given path.

A server endpoint, which exposes a single file from local storage found at systemPath, using the given path.

fileServerEndpoint("static" / "hello.html")("/home/app/static/data.html")
Inherited from
TapirStaticContentEndpoints
def filesEndpoint(prefix: EndpointInput[Unit]): Endpoint[StaticInput, StaticErrorOutput, StaticOutput[File], Any]
Inherited from
TapirStaticContentEndpoints
def filesServerEndpoint[F[_]](prefix: EndpointInput[Unit])(systemPath: String): ServerEndpoint[StaticInput, StaticErrorOutput, StaticOutput[File], Any, F]

A server endpoint, which exposes files from local storage found at systemPath, using the given prefix. Typically, the prefix is a path, but it can also contain other inputs. For example:

A server endpoint, which exposes files from local storage found at systemPath, using the given prefix. Typically, the prefix is a path, but it can also contain other inputs. For example:

filesServerEndpoint("static" / "files")("/home/app/static")

A request to /static/files/css/styles.css will try to read the /home/app/static/css/styles.css file.

Inherited from
TapirStaticContentEndpoints
def formBody[T](charset: Charset)(implicit evidence$15: Codec[String, T, XWwwFormUrlencoded]): Body[String, T]
Inherited from
Tapir
def formBody[T](implicit evidence$14: Codec[String, T, XWwwFormUrlencoded]): Body[String, T]
Inherited from
Tapir
def header(name: String, value: String): FixedHeader[Unit]
Inherited from
Tapir
def header(h: Header): FixedHeader[Unit]
Inherited from
Tapir
def header[T](name: String)(implicit evidence$4: Codec[List[String], T, TextPlain]): Header[T]
Inherited from
Tapir
def headers: Headers[List[Header]]
Inherited from
Tapir
def inputStreamBody: Body[InputStream, InputStream]
Inherited from
Tapir
def isWebSocket: EndpointInput[Boolean]
Inherited from
TapirComputedInputs
def multipartBody[T](implicit multipartCodec: MultipartCodec[T]): Body[Seq[RawPart], T]
Inherited from
Tapir
def oneOf[T](firstCase: OneOfMapping[_ <: T], otherCases: OneOfMapping[_ <: T]*): OneOf[T, T]

Specifies a correspondence between status codes and outputs.

Specifies a correspondence between status codes and outputs.

All outputs must have a common supertype (T). Typically, the supertype is a sealed trait, and the mappings are implementing cases classes.

A single status code can have multiple mappings (or there can be multiple default mappings), with different body content types. The mapping can then be chosen based on content type negotiation, or the content type header.

Note that exhaustiveness of the mappings is not checked (that all subtypes of T are covered).

Inherited from
Tapir
def oneOfDefaultMapping[T](output: EndpointOutput[T]): OneOfMapping[T]

Create a fallback mapping to be used in oneOf output descriptions. Multiple such mappings can be specified, with different body content types.

Create a fallback mapping to be used in oneOf output descriptions. Multiple such mappings can be specified, with different body content types.

Inherited from
Tapir
inline def oneOfMapping[T](statusCode: StatusCode, output: EndpointOutput[T])(implicit evidence$1: ClassTag[T]): OneOfMapping[T]

Create a one-of-mapping which uses statusCode and output if the class of the provided value (when interpreting as a server) matches the runtime class of T.

Create a one-of-mapping which uses statusCode and output if the class of the provided value (when interpreting as a server) matches the runtime class of T.

This will fail at compile-time if the type erasure of T is different from T, as a runtime check in this situation would give invalid results. In such cases, use oneOfMappingClassMatcher, oneOfMappingValueMatcher or oneOfMappingFromMatchType instead.

Should be used in oneOf output descriptions.

Inherited from
TapirMacros
def oneOfMappingClassMatcher[T](statusCode: StatusCode, output: EndpointOutput[T], runtimeClass: Class[_]): OneOfMapping[T]

Create a one-of-mapping which uses statusCode and output if the class of the provided value (when interpreting as a server) matches the given runtimeClass. Note that this does not take into account type erasure.

Create a one-of-mapping which uses statusCode and output if the class of the provided value (when interpreting as a server) matches the given runtimeClass. Note that this does not take into account type erasure.

Should be used in oneOf output descriptions.

Inherited from
Tapir
def oneOfMappingExactMatcher[T](statusCode: StatusCode, output: EndpointOutput[T])(firstExactValue: T, rest: T*)(implicit evidence$16: ClassTag[T]): OneOfMapping[T]

Create a one-of-mapping which uses statusCode and output if the provided value exactly matches one of the values provided in the second argument list.

Create a one-of-mapping which uses statusCode and output if the provided value exactly matches one of the values provided in the second argument list.

Should be used in oneOf output descriptions.

Inherited from
Tapir
def oneOfMappingFromMatchType[T](statusCode: StatusCode, output: EndpointOutput[T])(implicit evidence$18: MatchType[T]): OneOfMapping[T]

Experimental!

Experimental!

Create a one-of-mapping which uses statusCode and output if the provided value matches the target type, as checked by MatchType. Instances of MatchType are automatically derived and recursively check that classes of all fields match, to bypass issues caused by type erasure.

Should be used in oneOf output descriptions.

Inherited from
Tapir
def oneOfMappingValueMatcher[T](statusCode: StatusCode, output: EndpointOutput[T])(matcher: PartialFunction[Any, Boolean]): OneOfMapping[T]

Create a one-of-mapping which uses statusCode and output if the provided value (when interpreting as a server matches the matcher predicate.

Create a one-of-mapping which uses statusCode and output if the provided value (when interpreting as a server matches the matcher predicate.

Should be used in oneOf output descriptions.

Inherited from
Tapir
def path[T](name: String)(implicit evidence$2: Codec[String, T, TextPlain]): PathCapture[T]
Inherited from
Tapir
def path[T](implicit evidence$1: Codec[String, T, TextPlain]): PathCapture[T]
Inherited from
Tapir
def pathBody: Body[File, Path]
Inherited from
TapirExtensions
def paths: PathsCapture[List[String]]
Inherited from
Tapir
def plainBody[T](charset: Charset)(implicit evidence$7: Codec[String, T, TextPlain]): Body[String, T]
Inherited from
Tapir
def plainBody[T](implicit evidence$6: Codec[String, T, TextPlain]): Body[String, T]
Inherited from
Tapir
def query[T](name: String)(implicit evidence$3: Codec[List[String], T, TextPlain]): Query[T]
Inherited from
Tapir
def queryParams: QueryParams[QueryParams]
Inherited from
Tapir
def rawBinaryBody[R](implicit evidence$11: Binary[R], codec: Codec[R, R, OctetStream]): Body[R, R]
Inherited from
Tapir
def resourceServerEndpoint[F[_]](prefix: EndpointInput[Unit])(classLoader: ClassLoader, resourcePath: String): ServerEndpoint[StaticInput, StaticErrorOutput, StaticOutput[InputStream], Any, F]

A server endpoint, which exposes a single resource available from the given classLoader at resourcePath, using the given path.

A server endpoint, which exposes a single resource available from the given classLoader at resourcePath, using the given path.

resourceServerEndpoint("static" / "hello.html")(classOf[App].getClassLoader, "app/data.html")
Inherited from
TapirStaticContentEndpoints
def resourcesEndpoint(prefix: EndpointInput[Unit]): Endpoint[StaticInput, StaticErrorOutput, StaticOutput[InputStream], Any]
Inherited from
TapirStaticContentEndpoints
def resourcesServerEndpoint[F[_]](prefix: EndpointInput[Unit])(classLoader: ClassLoader, resourcePrefix: String): ServerEndpoint[StaticInput, StaticErrorOutput, StaticOutput[InputStream], Any, F]

A server endpoint, which exposes resources available from the given classLoader, using the given prefix. Typically, the prefix is a path, but it can also contain other inputs. For example:

A server endpoint, which exposes resources available from the given classLoader, using the given prefix. Typically, the prefix is a path, but it can also contain other inputs. For example:

resourcesServerEndpoint("static" / "files")(classOf[App].getClassLoader, "app")

A request to /static/files/css/styles.css will try to read the /app/css/styles.css resource.

Inherited from
TapirStaticContentEndpoints
def setCookie(name: String): Header[CookieValueWithMeta]
Inherited from
Tapir
def setCookies: Header[List[CookieWithMeta]]
Inherited from
Tapir
def statusCode(statusCode: StatusCode): FixedStatusCode[Unit]
Inherited from
Tapir
def statusCode: StatusCode[StatusCode]
Inherited from
Tapir
def streamBinaryBody[S](s: Streams[S]): StreamBodyIO[BinaryStream, BinaryStream, S]

Creates a stream body with a binary schema. The application/octet-stream media type will be used by default, but can be later overridden by providing a custom Content-Type header value.

Creates a stream body with a binary schema. The application/octet-stream media type will be used by default, but can be later overridden by providing a custom Content-Type header value.

Value Params
s

A supported streams implementation.

Inherited from
Tapir
def streamBody[S, T](s: Streams[S])(schema: Schema[T], format: CodecFormat, charset: Option[Charset]): StreamBodyIO[BinaryStream, BinaryStream, S]

Creates a stream body with a text schema.

Creates a stream body with a text schema.

Value Params
charset

An optional charset of the resulting stream's data, to be used in the content type.

format

The media type to use by default. Can be later overridden by providing a custom Content-Type header.

s

A supported streams implementation.

schema

Schema of the body. This should be a schema for the "deserialized" stream.

Inherited from
Tapir
def streamTextBody[S](s: Streams[S])(format: CodecFormat, charset: Option[Charset]): StreamBodyIO[BinaryStream, BinaryStream, S]

Creates a stream body with a text schema.

Creates a stream body with a text schema.

Value Params
charset

An optional charset of the resulting stream's data, to be used in the content type.

format

The media type to use by default. Can be later overridden by providing a custom Content-Type header.

s

A supported streams implementation.

Inherited from
Tapir
def stringBody(charset: Charset): Body[String, String]
Inherited from
Tapir
def stringBody(charset: String): Body[String, String]
Inherited from
Tapir
def stringBody: Body[String, String]
Inherited from
Tapir
def webSocketBody[REQ, REQ_CF <: CodecFormat, RESP, RESP_CF <: CodecFormat]: WebSocketBodyBuilder[REQ, REQ_CF, RESP, RESP_CF]
Type Params
REQ

The type of messages that are sent to the server.

REQ_CF

The codec format (media type) of messages that are sent to the server.

RESP

The type of messages that are received from the server.

RESP_CF

The codec format (media type) of messages that are received from the server.

Inherited from
Tapir
def webSocketBodyRaw[S](s: Streams[S]): WebSocketBodyOutput[Pipe[WebSocketFrame, WebSocketFrame], WebSocketFrame, WebSocketFrame, Pipe[WebSocketFrame, WebSocketFrame], S]
Inherited from
Tapir
def xmlBody[T](implicit evidence$10: XmlCodec[T]): Body[String, T]

Requires an implicit Codec.XmlCodec in scope. Such a codec can be created using Codec.xml.

Requires an implicit Codec.XmlCodec in scope. Such a codec can be created using Codec.xml.

Inherited from
Tapir

Deprecated and Inherited methods

@deprecated(message = "Use customJsonBody", since = "0.18.0")
def anyJsonBody[T](implicit evidence$8: JsonCodec[T]): Body[String, T]
Deprecated
[Since version 0.18.0] Use customJsonBody
Inherited from
Tapir
@deprecated("Use oneOfDefaultMapping", since = "0.18")
def statusDefaultMapping[T](output: EndpointOutput[T]): OneOfMapping[T]
Deprecated
[Since version 0.18]
Inherited from
Tapir
@deprecated("Use oneOfMapping", since = "0.18")
inline def statusMapping[T](statusCode: StatusCode, output: EndpointOutput[T])(implicit evidence$2: ClassTag[T]): OneOfMapping[T]
Deprecated
[Since version 0.18]
Inherited from
TapirMacros
@deprecated("Use oneOfMappingClassMatcher", since = "0.18")
def statusMappingClassMatcher[T](statusCode: StatusCode, output: EndpointOutput[T], runtimeClass: Class[_]): OneOfMapping[T]
Deprecated
[Since version 0.18]
Inherited from
Tapir
@deprecated("Use oneOfMappingExactMatcher", since = "0.18")
def statusMappingExactMatcher[T](statusCode: StatusCode, output: EndpointOutput[T])(firstExactValue: T, rest: T*)(implicit evidence$17: ClassTag[T]): OneOfMapping[T]
Deprecated
[Since version 0.18]
Inherited from
Tapir
@deprecated("Use oneOfMappingFromMatchType", since = "0.18")
def statusMappingFromMatchType[T](statusCode: StatusCode, output: EndpointOutput[T])(implicit evidence$19: MatchType[T]): OneOfMapping[T]
Deprecated
[Since version 0.18]
Inherited from
Tapir
@deprecated("Use oneOfMappingValueMatcher", since = "0.18")
def statusMappingValueMatcher[T](statusCode: StatusCode, output: EndpointOutput[T])(matcher: PartialFunction[Any, Boolean]): OneOfMapping[T]
Deprecated
[Since version 0.18]
Inherited from
Tapir

Inherited fields

val emptyOutput: Empty[Unit]

An empty output. Useful if one of oneOf branches should be mapped to the status code only.

An empty output. Useful if one of oneOf branches should be mapped to the status code only.

Inherited from
Tapir
val endpoint: Endpoint[Unit, Unit, Unit, Any]
Inherited from
Tapir
val htmlBodyUtf8: Body[String, String]
Inherited from
Tapir
val infallibleEndpoint: Endpoint[Unit, Nothing, Unit, Any]
Inherited from
Tapir
val multipartBody: Body[Seq[RawPart], Seq[Part[Array[Byte]]]]
Inherited from
Tapir

Implicits

Inherited implicits

implicit def optionModifyFunctor[A]: ModifyFunctor[[A] =>> Option[A], A]
Inherited from
ModifyMacroFunctorSupport
implicit def stringToPath(s: String): FixedPath[Unit]
Inherited from
Tapir
implicit def traversableModifyFunctor[F[_], A](implicit fac: Factory[A, F[A]], ev: F[A] => Iterable[A]): ModifyFunctor[F, A]
Inherited from
ModifyMacroSupport