trait Tapir extends TapirExtensions with TapirComputedInputs with TapirStaticContentEndpoints with ModifyMacroSupport
- Alphabetic
- By Inheritance
- Tapir
- ModifyMacroSupport
- ModifyMacroFunctorSupport
- TapirStaticContentEndpoints
- TapirComputedInputs
- TapirExtensions
- AnyRef
- Any
- Hide All
- Show All
- Public
- All
Type Members
- class BinaryBodyPartiallyApplied[R] extends AnyRef
-
type
TapirFile = File
- Definition Classes
- TapirExtensions
- final class WebSocketBodyBuilder[REQ, REQ_CF <: CodecFormat, RESP, RESP_CF <: CodecFormat] extends AnyRef
-
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
-
trait
ModifyMapAtFunctor[F[_, _], K, T] extends AnyRef
- Definition Classes
- ModifyMacroSupport
Value Members
-
final
def
!=(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
final
def
##(): Int
- Definition Classes
- AnyRef → Any
-
final
def
==(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
final
def
asInstanceOf[T0]: T0
- Definition Classes
- Any
-
def
auth: TapirAuth.type
Inputs which describe authentication credentials with metadata.
-
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.binaryBody(RawBodyType.FileBody)[MyType] }}} scope.
- def byteArrayBody: Body[Array[Byte], Array[Byte]]
- def byteBufferBody: Body[ByteBuffer, ByteBuffer]
-
def
clientIp: EndpointInput[Option[String]]
- Definition Classes
- TapirComputedInputs
-
def
clone(): AnyRef
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws( ... ) @native() @HotSpotIntrinsicCandidate()
- def cookie[T](name: String)(implicit arg0: Codec[Option[String], T, TextPlain]): Cookie[T]
- def cookies: Header[List[Cookie]]
-
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. -
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).
- val emptyInput: EndpointInput[Unit]
- val emptyOutput: Atom[Unit]
-
def
emptyOutputAs[T](value: T): Atom[T]
An empty output.
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.
- val endpoint: PublicEndpoint[Unit, Unit, Unit, Any]
-
final
def
eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
-
def
equals(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
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.
- def fileBody: Body[FileRange, TapirFile]
- def fileRangeBody: Body[FileRange, FileRange]
- def formBody[T](charset: Charset)(implicit arg0: Codec[String, T, XWwwFormUrlencoded]): Body[String, T]
- def formBody[T](implicit arg0: Codec[String, T, XWwwFormUrlencoded]): Body[String, T]
-
final
def
getClass(): Class[_]
- Definition Classes
- AnyRef → Any
- Annotations
- @native() @HotSpotIntrinsicCandidate()
-
def
hashCode(): Int
- Definition Classes
- AnyRef → Any
- Annotations
- @native() @HotSpotIntrinsicCandidate()
- def header(name: String, value: String): FixedHeader[Unit]
- def header(h: Header): FixedHeader[Unit]
- def header[T](name: String)(implicit arg0: Codec[List[String], T, TextPlain]): Header[T]
- def headers: Headers[List[Header]]
- val htmlBodyUtf8: Body[String, String]
- val infallibleEndpoint: PublicEndpoint[Unit, Nothing, Unit, Any]
- def inputStreamBody: Body[InputStream, InputStream]
- def inputStreamRangeBody: Body[InputStreamRange, InputStreamRange]
-
final
def
isInstanceOf[T0]: Boolean
- Definition Classes
- Any
-
def
isWebSocket: EndpointInput[Boolean]
- Definition Classes
- TapirComputedInputs
-
implicit
def
mapModifyFunctor[M[KT, TT] <: Map[KT, TT], K, T](implicit cbf: CanBuildFrom[M[K, T], (K, T), M[K, T]]): ModifyMapAtFunctor[M, K, T]
- Definition Classes
- ModifyMacroSupport
- def multipartBody[T](implicit multipartCodec: MultipartCodec[T]): Body[Seq[RawPart], T]
- val multipartBody: Body[Seq[RawPart], Seq[Part[Array[Byte]]]]
-
final
def
ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
-
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
-
final
def
notify(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native() @HotSpotIntrinsicCandidate()
-
final
def
notifyAll(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native() @HotSpotIntrinsicCandidate()
-
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. - 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.
Streaming variant of oneOfBody.
Allows explicitly specifying the content type range, for which each body will be used, instead of defaulting to the exact media type as specified by the body's codec. This is only used when choosing which body to decode.
-
def
oneOfBody[T](first: (ContentTypeRange, Body[_, T]), others: (ContentTypeRange, Body[_, T])*): OneOfBody[T, T]
See oneOfBody.
See oneOfBody.
Allows explicitly specifying the content type range, for which each body will be used, instead of defaulting to the exact media type as specified by the body's codec. This is only used when choosing which body to decode.
-
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. - 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.
Create a fallback variant to be used in oneOf output descriptions. Multiple such variants can be specified, with different body content types.
-
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.
-
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.
-
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.
-
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
.Create a one-of-variant which uses
output
if the class of the provided value (when interpreting as a server) matches the givenruntimeClass
. Note that this does not take into account type erasure.Should be used in oneOf output descriptions.
-
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.Create a one-of-variant which uses
output
if the provided value exactly matches one of the values provided in the second argument list. Adds a fixed status-code output with the given value.Should be used in oneOf output descriptions.
-
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.Create a one-of-variant which
output
if the provided value exactly matches one of the values provided in the second argument list.Should be used in oneOf output descriptions.
-
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.
-
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.
-
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).Create a one-of-variant which uses
output
if the provided value (when interpreting as a server matches thematcher
predicate). Adds a fixed status-code output with the given value.Should be used in oneOf output descriptions.
-
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).Create a one-of-variant which uses
output
if the provided value (when interpreting as a server matches thematcher
predicate).Should be used in oneOf output descriptions.
-
implicit
def
optionModifyFunctor[A]: ModifyFunctor[Option, A]
- Definition Classes
- ModifyMacroFunctorSupport
- def path[T](name: String)(implicit arg0: Codec[String, T, TextPlain]): PathCapture[T]
- def path[T](implicit arg0: Codec[String, T, TextPlain]): PathCapture[T]
- def paths: PathsCapture[List[String]]
- def plainBody[T](charset: Charset)(implicit arg0: Codec[String, T, TextPlain]): Body[String, T]
- def plainBody[T](implicit arg0: Codec[String, T, TextPlain]): Body[String, T]
- def query[T](name: String)(implicit arg0: Codec[List[String], T, TextPlain]): Query[T]
-
def
queryAnyFormat[T, CF <: CodecFormat](name: String, codec: Codec[List[String], T, CF]): Query[T]
A query parameter in any format, read using the given
codec
. - def queryParams: QueryParams[QueryParams]
- def rawBinaryBody[R](rbt: Binary[R])(implicit codec: Codec[R, R, OctetStream]): Body[R, R]
- def setCookie(name: String): Header[CookieValueWithMeta]
- def setCookieOpt(name: String): Header[Option[CookieValueWithMeta]]
- def setCookies: Header[List[CookieWithMeta]]
-
def
statusCode(statusCode: StatusCode): FixedStatusCode[Unit]
An fixed status code output.
-
def
statusCode: StatusCode[StatusCode]
An output which maps to the status code in the response.
-
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.
-
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.
-
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.
- def stringBody(charset: Charset): Body[String, String]
- def stringBody(charset: String): Body[String, String]
- def stringBody: Body[String, String]
-
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
. -
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. -
def
stringJsonBody(charset: Charset): Body[String, String]
A body in the JSON format, read from a raw string using
charset
. -
def
stringJsonBody: Body[String, String]
A body in the JSON format, read from a raw string using UTF-8.
- implicit def stringToPath(s: String): FixedPath[Unit]
-
final
def
synchronized[T0](arg0: ⇒ T0): T0
- Definition Classes
- AnyRef
-
def
toString(): String
- Definition Classes
- AnyRef → Any
-
implicit
def
traversableModifyFunctor[F[_], A](implicit cbf: CanBuildFrom[F[A], A, F[A]], ev: (F[A]) ⇒ TraversableLike[A, F[A]]): ModifyFunctor[F, A]
- Definition Classes
- ModifyMacroSupport
-
final
def
wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
final
def
wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... ) @native()
-
final
def
wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
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.
- def webSocketBodyRaw[S](s: Streams[S]): WebSocketBodyOutput[Pipe[WebSocketFrame, WebSocketFrame], WebSocketFrame, WebSocketFrame, Pipe[WebSocketFrame, WebSocketFrame], S]
-
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.
Deprecated Value Members
-
def
finalize(): Unit
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws( classOf[java.lang.Throwable] ) @Deprecated
- Deprecated