package tapir
- Alphabetic
- By Inheritance
- tapir
- Tapir
- ModifyMacroSupport
- ModifyMacroFunctorSupport
- TapirStaticContentEndpoints
- TapirComputedInputs
- TapirExtensions
- AnyRef
- Any
- Hide All
- Show All
- Public
- Protected
Package Members
Type Members
- type AnyEndpoint = Endpoint[_, _, _, _, _]
- type AnyListCodec = Codec[_ <: List[_], _, _ <: CodecFormat]
- type AnyPart = Part[_]
- class AttributeKey[T] extends AnyRef
- T
Type of the value of the attribute.
- case class AttributeMap extends Product with Serializable
An attribute is arbitrary data that is attached to an endpoint or endpoint input/output.
An attribute is arbitrary data that is attached to an endpoint or endpoint input/output. The data is not interpreted by tapir's core in any way, but might be used by interpreters.
Typically, you'll add attributes using Endpoint.attribute and EndpointTransput.Atom.attribute. The attribute keys should be defined by the interpreters which are using them, and made available for import.
- trait Codec[L, H, +CF <: CodecFormat] extends AnyRef
A bi-directional mapping between low-level values of type
L
and high-level values of typeH
.A bi-directional mapping between low-level values of type
L
and high-level values of typeH
. Low level values are formatted asCF
.The mapping consists of a pair of functions, one to decode (
L => H
), and one to encode (H => L
). Decoding can fail, and this is represented as a result of type DecodeResult.A codec also contains optional meta-data in the
schema
of the high-level value (which includes validators), as well as an instance of the format (which determines the media type of the low-level value).Codec instances are used as implicit values, and are looked up when defining endpoint inputs/outputs. Depending on a particular endpoint input/output, it might require a codec which uses a specific format, or a specific low-level value.
Codec instances can be derived basing on other values (e.g. such as json encoders/decoders when integrating with json libraries). Or, they can be defined by hand for custom types, usually customising an existing, simpler codec.
Codecs can be chained with Mapping s using the
map
function.- L
The type of the low-level value.
- H
The type of the high-level value.
- CF
The format of encoded values. Corresponds to the media type.
- Annotations
- @implicitNotFound()
- trait CodecExtensions extends AnyRef
- trait CodecExtensions2 extends AnyRef
- trait CodecFormat extends AnyRef
Specifies the format of the encoded values.
Specifies the format of the encoded values. Each variant must be a proper type so that it can be used as a discriminator for different (implicit) instances of Codec values.
- sealed trait DecodeResult[+T] extends AnyRef
- case class Endpoint[SECURITY_INPUT, INPUT, ERROR_OUTPUT, OUTPUT, -R](securityInput: EndpointInput[SECURITY_INPUT], input: EndpointInput[INPUT], errorOutput: EndpointOutput[ERROR_OUTPUT], output: EndpointOutput[OUTPUT], info: EndpointInfo) extends EndpointSecurityInputsOps[SECURITY_INPUT, INPUT, ERROR_OUTPUT, OUTPUT, R] with EndpointInputsOps[SECURITY_INPUT, INPUT, ERROR_OUTPUT, OUTPUT, R] with EndpointErrorOutputsOps[SECURITY_INPUT, INPUT, ERROR_OUTPUT, OUTPUT, R] with EndpointErrorOutputVariantsOps[SECURITY_INPUT, INPUT, ERROR_OUTPUT, OUTPUT, R] with EndpointOutputsOps[SECURITY_INPUT, INPUT, ERROR_OUTPUT, OUTPUT, R] with EndpointInfoOps[R] with EndpointMetaOps with EndpointServerLogicOps[SECURITY_INPUT, INPUT, ERROR_OUTPUT, OUTPUT, R] with Product with Serializable
A description of an endpoint with the given inputs & outputs.
A description of an endpoint with the given inputs & outputs. The inputs are divided into two parts: security (
A
) and regular inputs (I
). There are also two kinds of outputs: error outputs (E
) and regular outputs (O
).In case there are no security inputs, the PublicEndpoint alias can be used, which omits the
A
parameter type.An endpoint can be interpreted as a server, client or documentation. The endpoint requires that server/client interpreters meet the capabilities specified by
R
(if any).When interpreting an endpoint as a server, the inputs are decoded and the security logic is run first, before decoding the body in the regular inputs. This allows short-circuiting further processing in case security checks fail. Server logic can be provided using EndpointServerLogicOps.serverSecurityLogic variants for secure endpoints, and EndpointServerLogicOps.serverLogic variants for public endpoints.
A concise description of an endpoint can be generated using the EndpointMetaOps.show method.
- SECURITY_INPUT
Security input parameter types, abbreviated as
A
.- INPUT
Input parameter types, abbreviated as
I
.- ERROR_OUTPUT
Error output parameter types, abbreviated as
E
.- OUTPUT
Output parameter types, abbreviated as
O
.- R
The capabilities that are required by this endpoint's inputs/outputs. This might be
Any
(no requirements), sttp.capabilities.Effect (the interpreter must support the given effect type), sttp.capabilities.Streams (the ability to send and receive streaming bodies) or sttp.capabilities.WebSockets (the ability to handle websocket requests).
- trait EndpointErrorOutputVariantsOps[A, I, E, O, -R] extends AnyRef
- trait EndpointErrorOutputsOps[A, I, E, O, -R] extends EndpointErrorOutputsMacros[A, I, E, O, R]
- sealed trait EndpointIO[T] extends EndpointInput[T] with EndpointOutput[T]
- case class EndpointInfo(name: Option[String], summary: Option[String], description: Option[String], tags: Vector[String], deprecated: Boolean, attributes: AttributeMap) extends Product with Serializable
- trait EndpointInfoOps[-R] extends AnyRef
- sealed trait EndpointInput[T] extends EndpointTransput[T]
- trait EndpointInputsOps[A, I, E, O, -R] extends EndpointInputsMacros[A, I, E, O, R]
- trait EndpointMetaOps extends AnyRef
- sealed trait EndpointOutput[T] extends EndpointTransput[T]
- trait EndpointOutputsOps[A, I, E, O, -R] extends EndpointOutputsMacros[A, I, E, O, R]
- trait EndpointSecurityInputsOps[A, I, E, O, -R] extends EndpointSecurityInputsMacros[A, I, E, O, R]
- trait EndpointServerLogicOps[A, I, E, O, -R] extends AnyRef
- 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).
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 valuebasic
: corresponds to an input/output which is encoded/decoded in one step; alwayssingle
atom
: corresponds to a single component of a request or response. Such inputs/outputs contain a Codec and Info meta-data, and are alwaysbasic
- case class FieldName(name: String, encodedName: String) extends Product with Serializable
- case class FileRange(file: tapir.TapirFile, range: Option[RangeValue] = None) extends Product with Serializable
- trait LowPriorityCodec extends AnyRef
Lower-priority codec implicits, which transform other codecs.
Lower-priority codec implicits, which transform other codecs. For example, when deriving a codec
List[T] <-> Either[A, B]
, given codecsca: T <-> A
andcb: T <-> B
, we want to getlistHead(eitherRight(ca, cb))
, noteitherRight(listHead(ca), listHead(cb))
(although they would function the same). - trait LowPrioritySchema extends AnyRef
- trait Mapping[L, H] extends AnyRef
A bi-directional mapping between values of type
L
and values of typeH
.A bi-directional mapping between values of type
L
and values of typeH
.Low-level values of type
L
can be **decoded** to a higher-level value of typeH
. The decoding can fail; this is represented by a result of type DecodeResult.Failure. Failures might occur due to format errors, wrong arity, exceptions, or validation errors. Validators can be added through thevalidate
method.High-level values of type
H
can be **encoded** as a low-level value of typeL
.Mappings can be chained using one of the
map
functions.- L
The type of the low-level value.
- H
The type of the high-level value.
- case class MultipartCodec[T](rawBodyType: MultipartBody, codec: Codec[Seq[RawPart], T, MultipartFormData]) extends Product with Serializable
Information needed to handle a multipart body.
Information needed to handle a multipart body. Individual parts are decoded as described by rawBodyType, which contains codecs for each part, as well as an optional default codec. The sequence of decoded parts can be further decoded into a high-level
T
type using codec. - case class PartCodec[R, T](rawBodyType: RawBodyType[R], codec: Codec[List[Part[R]], T, _ <: CodecFormat]) extends Product with Serializable
Information needed to read a single part of a multipart body: the raw type (
rawBodyType
), and the codec which further decodes it. - type PublicEndpoint[INPUT, ERROR_OUTPUT, OUTPUT, -R] = Endpoint[Unit, INPUT, ERROR_OUTPUT, OUTPUT, R]
- case class RangeValue(start: Option[Long], end: Option[Long], fileSize: Long) extends Product with Serializable
- sealed trait RawBodyType[R] extends AnyRef
The raw format of the body: what do we need to know, to read it and pass to a codec for further decoding.
- type RawPart = Part[_]
- case class Schema[T](schemaType: SchemaType[T], name: Option[SName] = None, isOptional: Boolean = false, description: Option[String] = None, default: Option[(T, Option[Any])] = None, format: Option[String] = None, encodedExample: Option[Any] = None, deprecated: Boolean = false, hidden: Boolean = false, validator: Validator[T] = Validator.pass[T], attributes: AttributeMap = AttributeMap.Empty) extends SchemaMacros[T] with Product with Serializable
Describes the type
T
: its low-level representation, meta-data and validation rules.Describes the type
T
: its low-level representation, meta-data and validation rules.- format
The name of the format of the low-level representation of
T
.
- Annotations
- @implicitNotFound()
- final case class SchemaAnnotations[T](description: Option[String], encodedExample: Option[Any], default: Option[(T, Option[Any])], format: Option[String], deprecated: Option[Boolean], hidden: Option[Boolean], encodedName: Option[String], validate: List[Validator[T]], validateEach: List[Validator[Any]]) extends Product with Serializable
- sealed trait SchemaType[T] extends AnyRef
The type of the low-level representation of a
T
values.The type of the low-level representation of a
T
values. Part of Schemas. - case class StreamBodyIO[BS, T, S](streams: Streams[S], codec: Codec[BS, T, CodecFormat], info: Info[T], charset: Option[Charset], encodedExamples: List[Example[Any]]) extends Atom[T] with Product with Serializable
- trait Tapir extends TapirExtensions with TapirComputedInputs with TapirStaticContentEndpoints with ModifyMacroSupport
- class BinaryBodyPartiallyApplied[R] extends AnyRef
- Definition Classes
- Tapir
- final class WebSocketBodyBuilder[REQ, REQ_CF <: CodecFormat, RESP, RESP_CF <: CodecFormat] extends AnyRef
- Definition Classes
- Tapir
- trait TapirAliases extends AnyRef
Mixin containing aliases for top-level types and modules in the tapir package.
- trait TapirComputedInputs extends AnyRef
- trait TapirExtensions extends AnyRef
- type TapirFile = File
- Definition Classes
- TapirExtensions
- case class ValidationError[T](validator: Primitive[T], invalidValue: Any, path: List[FieldName] = Nil, customMessage: Option[String] = None) extends Product with Serializable
- sealed trait ValidationResult extends AnyRef
- sealed trait Validator[T] extends AnyRef
- case class WebSocketBodyOutput[PIPE_REQ_RESP, REQ, RESP, T, S](streams: Streams[S], requests: Codec[WebSocketFrame, REQ, CodecFormat], responses: Codec[WebSocketFrame, RESP, CodecFormat], codec: Codec[PIPE_REQ_RESP, T, CodecFormat], info: Info[T], requestsInfo: Info[REQ], responsesInfo: Info[RESP], concatenateFragmentedFrames: Boolean, ignorePong: Boolean, autoPongOnPing: Boolean, decodeCloseRequests: Boolean, decodeCloseResponses: Boolean, autoPing: Option[(FiniteDuration, Ping)]) extends Atom[T] with Product with Serializable
- implicit class ModifyEach[F[_], T] extends AnyRef
- Definition Classes
- ModifyMacroFunctorSupport
- trait ModifyFunctor[F[_], A] extends AnyRef
- Definition Classes
- ModifyMacroFunctorSupport
- implicit class ModifyEachMap[F[_, _], K, T] extends AnyRef
- Definition Classes
- ModifyMacroSupport
Value Members
- def auth: TapirAuth.type
Inputs which describe authentication credentials with metadata.
Inputs which describe authentication credentials with metadata.
- Definition Classes
- Tapir
- def binaryBody[R](rbt: Binary[R]): BinaryBodyPartiallyApplied[R]
Usage:
Usage:
binaryBody(RawBodyType.FileBody)[MyType]
, given that a codec between a file and
MyType
is available in the implicit scope.- Definition Classes
- Tapir
- def byteArrayBody: Body[Array[Byte], Array[Byte]]
- Definition Classes
- Tapir
- def byteBufferBody: Body[ByteBuffer, ByteBuffer]
- Definition Classes
- Tapir
- def clientIp: EndpointInput[Option[String]]
- Definition Classes
- TapirComputedInputs
- def cookie[T](name: String)(implicit arg0: Codec[Option[String], T, TextPlain]): Cookie[T]
- Definition Classes
- Tapir
- def cookies: Header[List[Cookie]]
- Definition Classes
- Tapir
- def customCodecJsonBody[T](implicit arg0: JsonCodec[T]): Body[String, T]
Requires an implicit Codec.JsonCodec in scope.
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.- Definition Classes
- Tapir
- val emptyAuth: Auth[Unit, ApiKey]
An empty authentication input, to express the fact (for documentation) that authentication is optional, even in the presence of multiple optional authentication inputs (which by default are treated as alternatives).
An empty authentication input, to express the fact (for documentation) that authentication is optional, even in the presence of multiple optional authentication inputs (which by default are treated as alternatives).
- Definition Classes
- Tapir
- val emptyInput: EndpointInput[Unit]
- Definition Classes
- Tapir
- val emptyOutput: Atom[Unit]
- Definition Classes
- Tapir
- def emptyOutputAs[T](value: T): Atom[T]
An empty output.
- val endpoint: PublicEndpoint[Unit, Unit, Unit, Any]
- Definition Classes
- Tapir
- def extractFromRequest[T](f: (ServerRequest) => T): ExtractFromRequest[T]
Extract a value from a server request.
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.
- Definition Classes
- Tapir
- def fileBody: Body[FileRange, TapirFile]
- Definition Classes
- Tapir
- def fileGetServerEndpoint[F[_]](prefix: EndpointInput[Unit])(systemPath: String): ServerEndpoint[Any, F]
A server endpoint, which exposes a single file from local storage found at
systemPath
, using the givenpath
.A server endpoint, which exposes a single file from local storage found at
systemPath
, using the givenpath
.fileGetServerEndpoint("static" / "hello.html")("/home/app/static/data.html")
- Definition Classes
- TapirStaticContentEndpoints
- def fileRangeBody: Body[FileRange, FileRange]
- Definition Classes
- Tapir
- def filesGetEndpoint(prefix: EndpointInput[Unit]): PublicEndpoint[StaticInput, StaticErrorOutput, StaticOutput[FileRange], Any]
- Definition Classes
- TapirStaticContentEndpoints
- lazy val filesGetEndpoint: PublicEndpoint[StaticInput, StaticErrorOutput, StaticOutput[FileRange], Any]
- Definition Classes
- TapirStaticContentEndpoints
- def filesGetServerEndpoint[F[_]](prefix: EndpointInput[Unit])(systemPath: String, options: FilesOptions[F] = FilesOptions.default[F]): ServerEndpoint[Any, F]
A server endpoint, which exposes files from local storage found at
systemPath
, using the givenprefix
.A server endpoint, which exposes files from local storage found at
systemPath
, using the givenprefix
. Typically, the prefix is a path, but it can also contain other inputs. For example:filesGetServerEndpoint("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.- Definition Classes
- TapirStaticContentEndpoints
- def filesHeadServerEndpoint[F[_]](prefix: EndpointInput[Unit])(systemPath: String, options: FilesOptions[F] = FilesOptions.default[F]): ServerEndpoint[Any, F]
A server endpoint, used to verify if sever supports range requests for file under particular path Additionally it verify file existence and returns its size
A server endpoint, used to verify if sever supports range requests for file under particular path Additionally it verify file existence and returns its size
- Definition Classes
- TapirStaticContentEndpoints
- def filesServerEndpoints[F[_]](prefix: EndpointInput[Unit])(systemPath: String, options: FilesOptions[F] = FilesOptions.default[F]): List[ServerEndpoint[Any, F]]
Create a pair of endpoints (head, get) for exposing files from local storage found at
systemPath
, using the givenprefix
.Create a pair of endpoints (head, get) for exposing files from local storage found at
systemPath
, using the givenprefix
. Typically, the prefix is a path, but it can also contain other inputs. For example:filesServerEndpoints("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.- Definition Classes
- TapirStaticContentEndpoints
- def formBody[T](charset: Charset)(implicit arg0: Codec[String, T, XWwwFormUrlencoded]): Body[String, T]
- Definition Classes
- Tapir
- def formBody[T](implicit arg0: Codec[String, T, XWwwFormUrlencoded]): Body[String, T]
- Definition Classes
- Tapir
- def header(name: String, value: String): FixedHeader[Unit]
- Definition Classes
- Tapir
- def header(h: Header): FixedHeader[Unit]
- Definition Classes
- Tapir
- def header[T](name: String)(implicit arg0: Codec[List[String], T, TextPlain]): Header[T]
- Definition Classes
- Tapir
- def headers: Headers[List[Header]]
- Definition Classes
- Tapir
- val htmlBodyUtf8: Body[String, String]
- Definition Classes
- Tapir
- val infallibleEndpoint: PublicEndpoint[Unit, Nothing, Unit, Any]
- Definition Classes
- Tapir
- def inputStreamBody: Body[InputStream, InputStream]
- Definition Classes
- Tapir
- def isWebSocket: EndpointInput[Boolean]
- Definition Classes
- TapirComputedInputs
- def multipartBody[T](implicit multipartCodec: MultipartCodec[T]): Body[Seq[RawPart], T]
- Definition Classes
- Tapir
- val multipartBody: Body[Seq[RawPart], Seq[Part[Array[Byte]]]]
- Definition Classes
- Tapir
- val noTrailingSlash: EndpointInput[Unit]
An input which matches if the request URI ends with a trailing slash, otherwise the result is a decode failure on the path.
An input which matches if the request URI ends with a trailing slash, otherwise the result is a decode failure on the path. Has no effect when used by documentation or client interpreters.
- Definition Classes
- TapirComputedInputs
- def oneOf[T](firstVariant: OneOfVariant[_ <: T], otherVariants: OneOfVariant[_ <: T]*): OneOf[T, T]
An output which contains a number of variant outputs.
An output which contains a number of variant outputs. Each variant can contain different outputs and represent different content. To describe an output which represents same content, but with different content types, use oneOfBody.
All possible outputs must have a common supertype (
T
). Typically, the supertype is a sealed trait, and the variants are implementing case classes.When encoding to a response, the first matching output is chosen, using the following rules:
- the variant's
appliesTo
method, applied to the output value (as returned by the server logic) must returntrue
. - when a fixed content type is specified by the output, it must match the request's
Accept
header (if present). This implements content negotiation.
When decoding from a response, the first output which decodes successfully is chosen.
The outputs might vary in status codes, headers (e.g. different content types), and body implementations. However, for bodies, only replayable ones can be used, and they need to have the same raw representation (e.g. all byte-array-base, or all file-based).
Note that exhaustiveness of the variants (that all subtypes of
T
are covered) is not checked.- Definition Classes
- Tapir
- the variant's
- def oneOfBody[T](first: (ContentTypeRange, StreamBodyWrapper[_, T]), second: (ContentTypeRange, StreamBodyWrapper[_, T]), others: (ContentTypeRange, StreamBodyWrapper[_, T])*): OneOfBody[T, T]
Streaming variant of oneOfBody.
- def oneOfBody[T](first: (ContentTypeRange, Body[_, T]), others: (ContentTypeRange, Body[_, T])*): OneOfBody[T, T]
See oneOfBody.
- def oneOfBody[T](first: StreamBodyWrapper[_, T], others: StreamBodyWrapper[_, T]*): OneOfBody[T, T]
Streaming variant of oneOfBody.
- def oneOfBody[T](first: Body[_, T], others: Body[_, T]*): OneOfBody[T, T]
A body input or output, which can be one of the given variants.
A body input or output, which can be one of the given variants. All variants should represent
T
instances using different content types. Hence, the content type is used as a discriminator to choose the appropriate variant.Should be used to describe an input or output which represents the same content, but using different content types. For an output which describes variants including possibly different outputs (representing different content), see oneOf.
The server behavior is as follows:
- when encoding to a response, the first variant matching the request's
Accept
header is chosen (if present). Otherwise, the first variant is used. This implements content negotiation. - when decoding a request, the variant corresponding to the request's
Content-Type
header is chosen (if present). Otherwise, a decode failure is returned, which by default results in an415 Unsupported Media Type
response.
The client behavior is as follows:
- when encoding a request, the first variant is used.
- when decoding a response, the variant corresponding to the response's
Content-Type
header is chosen (if present). Otherwise, the first variant is used. For client interpreters to work correctly, all body variants must have the same raw type (e.g. all are string-based or all byte-array-based)
All possible bodies must have the same type
T
. Typically, the bodies will vary in the Codecs that are used for the body.- Definition Classes
- Tapir
- when encoding to a response, the first variant matching the request's
- def oneOfDefaultVariant[T](output: EndpointOutput[T]): OneOfVariant[T]
Create a fallback variant to be used in oneOf output descriptions.
- def oneOfVariant[T](code: StatusCode, output: EndpointOutput[T])(implicit arg0: ClassTag[T], arg1: ErasureSameAsType[T]): OneOfVariant[T]
Create a one-of-variant which uses
output
if the class of the provided value (when interpreting as a server) matches the runtime class ofT
.Create a one-of-variant which uses
output
if the class of the provided value (when interpreting as a server) matches the runtime class ofT
. Adds a fixed status-code output with the given value.This will fail at compile-time if the type erasure of
T
is different fromT
, as a runtime check in this situation would give invalid results. In such cases, use oneOfVariantClassMatcher, oneOfVariantValueMatcher or oneOfVariantFromMatchType instead.Should be used in oneOf output descriptions.
- Definition Classes
- Tapir
- def oneOfVariant[T](output: EndpointOutput[T])(implicit arg0: ClassTag[T], arg1: ErasureSameAsType[T]): OneOfVariant[T]
Create a one-of-variant which uses
output
if the class of the provided value (when interpreting as a server) matches the runtime class ofT
.Create a one-of-variant which uses
output
if the class of the provided value (when interpreting as a server) matches the runtime class ofT
.This will fail at compile-time if the type erasure of
T
is different fromT
, as a runtime check in this situation would give invalid results. In such cases, use oneOfVariantClassMatcher, oneOfVariantValueMatcher or oneOfVariantFromMatchType instead.Should be used in oneOf output descriptions.
- Definition Classes
- Tapir
- def oneOfVariantClassMatcher[T](code: StatusCode, output: EndpointOutput[T], runtimeClass: Class[_]): OneOfVariant[T]
Create a one-of-variant which uses
output
i the class of the provided value (when interpreting as a server) matches the givenruntimeClass
.Create a one-of-variant which uses
output
i the class of the provided value (when interpreting as a server) matches the givenruntimeClass
. Note that this does not take into account type erasure. Adds a fixed status-code output with the given value.Should be used in oneOf output descriptions.
- Definition Classes
- Tapir
- def oneOfVariantClassMatcher[T](output: EndpointOutput[T], runtimeClass: Class[_]): OneOfVariant[T]
Create a one-of-variant which uses
output
if the class of the provided value (when interpreting as a server) matches the givenruntimeClass
. - def oneOfVariantExactMatcher[T](code: StatusCode, output: EndpointOutput[T])(firstExactValue: T, rest: T*)(implicit arg0: ClassTag[T]): OneOfVariant[T]
Create a one-of-variant which uses
output
if the provided value exactly matches one of the values provided in the second argument list. - def oneOfVariantExactMatcher[T](output: EndpointOutput[T])(firstExactValue: T, rest: T*)(implicit arg0: ClassTag[T]): OneOfVariant[T]
Create a one-of-variant which
output
if the provided value exactly matches one of the values provided in the second argument list. - def oneOfVariantFromMatchType[T](code: StatusCode, output: EndpointOutput[T])(implicit arg0: MatchType[T]): OneOfVariant[T]
Create a one-of-variant which uses
output
if the provided value matches the target type, as checked by MatchType.Create a one-of-variant which uses
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. Adds a fixed status-code output with the given value.Should be used in oneOf output descriptions.
- Definition Classes
- Tapir
- def oneOfVariantFromMatchType[T](output: EndpointOutput[T])(implicit arg0: MatchType[T]): OneOfVariant[T]
Create a one-of-variant which uses
output
if the provided value matches the target type, as checked by MatchType.Create a one-of-variant which uses
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.
- Definition Classes
- Tapir
- def oneOfVariantValueMatcher[T](code: StatusCode, output: EndpointOutput[T])(matcher: PartialFunction[Any, Boolean]): OneOfVariant[T]
Create a one-of-variant which uses
output
if the provided value (when interpreting as a server matches thematcher
predicate). - def oneOfVariantValueMatcher[T](output: EndpointOutput[T])(matcher: PartialFunction[Any, Boolean]): OneOfVariant[T]
Create a one-of-variant which uses
output
if the provided value (when interpreting as a server matches thematcher
predicate). - implicit def optionModifyFunctor[A]: ModifyFunctor[Option, A]
- Definition Classes
- ModifyMacroFunctorSupport
- def path[T](name: String)(implicit arg0: Codec[String, T, TextPlain]): PathCapture[T]
- Definition Classes
- Tapir
- def path[T](implicit arg0: Codec[String, T, TextPlain]): PathCapture[T]
- Definition Classes
- Tapir
- def pathBody: Body[FileRange, Path]
- Definition Classes
- TapirExtensions
- def paths: PathsCapture[List[String]]
- Definition Classes
- Tapir
- def plainBody[T](charset: Charset)(implicit arg0: Codec[String, T, TextPlain]): Body[String, T]
- Definition Classes
- Tapir
- def plainBody[T](implicit arg0: Codec[String, T, TextPlain]): Body[String, T]
- Definition Classes
- Tapir
- def query[T](name: String)(implicit arg0: Codec[List[String], T, TextPlain]): Query[T]
- Definition Classes
- Tapir
- def queryParams: QueryParams[QueryParams]
- Definition Classes
- Tapir
- def rawBinaryBody[R](rbt: Binary[R])(implicit codec: Codec[R, R, OctetStream]): Body[R, R]
- Definition Classes
- Tapir
- def resourceGetServerEndpoint[F[_]](prefix: EndpointInput[Unit])(classLoader: ClassLoader, resourcePath: String, options: ResourcesOptions[F] = ResourcesOptions.default[F]): ServerEndpoint[Any, F]
A server endpoint, which exposes a single resource available from the given
classLoader
atresourcePath
, using the givenpath
.A server endpoint, which exposes a single resource available from the given
classLoader
atresourcePath
, using the givenpath
.resourceGetServerEndpoint("static" / "hello.html")(classOf[App].getClassLoader, "app/data.html")
- Definition Classes
- TapirStaticContentEndpoints
- def resourcesGetEndpoint(prefix: EndpointInput[Unit]): PublicEndpoint[StaticInput, StaticErrorOutput, StaticOutput[InputStream], Any]
- Definition Classes
- TapirStaticContentEndpoints
- lazy val resourcesGetEndpoint: PublicEndpoint[StaticInput, StaticErrorOutput, StaticOutput[InputStream], Any]
- Definition Classes
- TapirStaticContentEndpoints
- def resourcesGetServerEndpoint[F[_]](prefix: EndpointInput[Unit])(classLoader: ClassLoader, resourcePrefix: String, options: ResourcesOptions[F] = ResourcesOptions.default[F]): ServerEndpoint[Any, F]
A server endpoint, which exposes resources available from the given
classLoader
, using the givenprefix
.A server endpoint, which exposes resources available from the given
classLoader
, using the givenprefix
. Typically, the prefix is a path, but it can also contain other inputs. For example:resourcesGetServerEndpoint("static" / "files")(classOf[App].getClassLoader, "app")
A request to
/static/files/css/styles.css
will try to read the/app/css/styles.css
resource.- Definition Classes
- TapirStaticContentEndpoints
- def setCookie(name: String): Header[CookieValueWithMeta]
- Definition Classes
- Tapir
- def setCookieOpt(name: String): Header[Option[CookieValueWithMeta]]
- Definition Classes
- Tapir
- def setCookies: Header[List[CookieWithMeta]]
- Definition Classes
- Tapir
- def statusCode(statusCode: StatusCode): FixedStatusCode[Unit]
An fixed status code output.
An fixed status code output.
- Definition Classes
- Tapir
- def statusCode: StatusCode[StatusCode]
An output which maps to the status code in the response.
An output which maps to the status code in the response.
- Definition Classes
- Tapir
- def streamBinaryBody[S](s: Streams[S])(format: CodecFormat): StreamBodyIO[BinaryStream, BinaryStream, S]
Creates a stream body with a binary schema.
Creates a stream body with a binary schema.
- s
A supported streams implementation.
- format
The media type to use by default. Can be later overridden by providing a custom
Content-Type
header.
- Definition Classes
- Tapir
- def streamBody[S, T](s: Streams[S])(schema: Schema[T], format: CodecFormat, charset: Option[Charset] = None): StreamBodyIO[BinaryStream, BinaryStream, S]
Creates a stream body with the given schema.
Creates a stream body with the given schema.
- s
A supported streams implementation.
- schema
Schema of the body. This should be a schema for the "deserialized" stream.
- format
The media type to use by default. Can be later overridden by providing a custom
Content-Type
header.- charset
An optional charset of the resulting stream's data, to be used in the content type.
- Definition Classes
- Tapir
- def streamTextBody[S](s: Streams[S])(format: CodecFormat, charset: Option[Charset] = None): StreamBodyIO[BinaryStream, BinaryStream, S]
Creates a stream body with a text schema.
Creates a stream body with a text schema.
- s
A supported streams implementation.
- format
The media type to use by default. Can be later overridden by providing a custom
Content-Type
header.- charset
An optional charset of the resulting stream's data, to be used in the content type.
- Definition Classes
- Tapir
- def stringBody(charset: Charset): Body[String, String]
- Definition Classes
- Tapir
- def stringBody(charset: String): Body[String, String]
- Definition Classes
- Tapir
- def stringBody: Body[String, String]
- Definition Classes
- Tapir
- def stringBodyAnyFormat[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 usingcharset
.A body in any format, read using the given
codec
, from a raw string read usingcharset
.- Definition Classes
- Tapir
- def stringBodyUtf8AnyFormat[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.- Definition Classes
- Tapir
- def stringJsonBody(charset: Charset): Body[String, String]
A body in the JSON format, read from a raw string using
charset
.A body in the JSON format, read from a raw string using
charset
.- Definition Classes
- Tapir
- def stringJsonBody: Body[String, String]
A body in the JSON format, read from a raw string using UTF-8.
A body in the JSON format, read from a raw string using UTF-8.
- Definition Classes
- Tapir
- implicit def stringToPath(s: String): FixedPath[Unit]
- Definition Classes
- Tapir
- implicit def traversableModifyFunctor[F[_], A](implicit fac: Factory[A, F[A]], ev: (F[A]) => Iterable[A]): ModifyFunctor[F, A]
- Definition Classes
- ModifyMacroSupport
- def webSocketBody[REQ, REQ_CF <: CodecFormat, RESP, RESP_CF <: CodecFormat]: WebSocketBodyBuilder[REQ, REQ_CF, RESP, RESP_CF]
- 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.
- Definition Classes
- Tapir
- def webSocketBodyRaw[S](s: Streams[S]): WebSocketBodyOutput[Pipe[WebSocketFrame, WebSocketFrame], WebSocketFrame, WebSocketFrame, Pipe[WebSocketFrame, WebSocketFrame], S]
- Definition Classes
- Tapir
- def xmlBody[T](implicit arg0: XmlCodec[T]): Body[String, T]
Requires an implicit Codec.XmlCodec in scope.
Requires an implicit Codec.XmlCodec in scope. Such a codec can be created using Codec.xml.
- Definition Classes
- Tapir
- object AttributeKey extends AttributeKeyMacros
- object AttributeMap extends Serializable
- object Codec extends CodecExtensions with CodecExtensions2 with FormCodecMacros with CodecMacros with LowPriorityCodec
- object CodecFormat
- object DecodeResult
- object Defaults
- object EndpointIO
- object EndpointInput extends EndpointInputMacros
- object EndpointOutput extends EndpointOutputMacros
- object EndpointTransput
- object FieldName extends Serializable
- object Mapping
- object MultipartCodec extends MultipartCodecMacros with Serializable
- object PartCodec extends Serializable
- object RawBodyType
- object Schema extends LowPrioritySchema with SchemaCompanionMacros with Serializable
- object SchemaAnnotations extends SchemaAnnotationsMacros with Serializable
- object SchemaType
- object TapirAuth
- object TapirFile
- object ValidationResult
- object Validator extends ValidatorMacros