sttp.tapir.ztapir
Type members
Classlikes
An endpoint with the security logic provided, and the main logic yet unspecified. See RichZEndpoint.zServerLogic.
An endpoint with the security logic provided, and the main logic yet unspecified. See RichZEndpoint.zServerLogic.
The provided security part of the server logic transforms inputs of type A
, either to an error of type E
, or value of type U
.
The part of the server logic which is not provided, will have to transform 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. Hence, it's possible to create a base, secured input, and then specialise it with inputs, outputs and logic as needed.
- Type Params
- A
Type of the security inputs, transformed into U
- C
The capabilities that are required by this endpoint's inputs/outputs.
Any
, if no requirements.- E
Error output parameter types.
- I
Input parameter types.
- O
Output parameter types.
- U
Type of transformed security input.
Inherited classlikes
Inherited types
Value members
Inherited methods
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
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
Inputs which describe authentication credentials with metadata.
Inputs which describe authentication credentials with metadata.
- Inherited from
- Tapir
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
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
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
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
.
fileGetServerEndpoint("static" / "hello.html")("/home/app/static/data.html")
- Inherited from
- TapirStaticContentEndpoints
Create pair of endpoints (head, get) for particular file
Create pair of endpoints (head, get) for particular file
- Inherited from
- TapirStaticContentEndpoints
- Inherited from
- TapirStaticContentEndpoints
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:
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.
- Inherited from
- TapirStaticContentEndpoints
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
- Inherited from
- TapirStaticContentEndpoints
An output which contains a number of variant outputs.
An output which contains a number of variant outputs.
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.
- Inherited from
- Tapir
Create a fallback variant to be used in oneOf output descriptions. Multiple such variants can be specified, with different body content types.
Create a fallback variant to be used in oneOf output descriptions. Multiple such variants can be specified, with different body content types.
- Inherited from
- Tapir
Create a one-of-variant which uses output
if the class of the provided value (when interpreting as a server) matches the runtime
class of T
. Adds a fixed status-code output with the given value.
Create a one-of-variant which uses output
if the class of the provided value (when interpreting as a server) matches the runtime
class of T
. Adds a fixed status-code output with the given value.
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 oneOfVariantClassMatcher, oneOfVariantValueMatcher or oneOfVariantFromMatchType
instead.
Should be used in oneOf output descriptions.
- Inherited from
- Tapir
Create a one-of-variant which uses output
if the class of the provided value (when interpreting as a server) matches the runtime
class of 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 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 oneOfVariantClassMatcher, oneOfVariantValueMatcher or oneOfVariantFromMatchType
instead.
Should be used in oneOf output descriptions.
- Inherited from
- Tapir
Create a one-of-variant which uses output
i 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. Adds a fixed status-code output with the given value.
Create a one-of-variant which uses output
i 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. Adds a fixed status-code output with the given value.
Should be used in oneOf output descriptions.
- Inherited from
- Tapir
Create a one-of-variant which uses 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-variant which uses 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
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.
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.
- Inherited from
- Tapir
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.
- Inherited from
- Tapir
Experimental!
Experimental!
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.
- Inherited from
- Tapir
Experimental!
Experimental!
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.
- Inherited from
- Tapir
Create a one-of-variant which uses output
if the provided value (when interpreting as a server matches the matcher
predicate. Adds
a fixed status-code output with the given value.
Create a one-of-variant which uses output
if the provided value (when interpreting as a server matches the matcher
predicate. Adds
a fixed status-code output with the given value.
Should be used in oneOf output descriptions.
- Inherited from
- Tapir
Create a one-of-variant which uses output
if the provided value (when interpreting as a server matches the matcher
predicate.
Create a one-of-variant which uses output
if the provided value (when interpreting as a server matches the matcher
predicate.
Should be used in oneOf output descriptions.
- Inherited from
- Tapir
- Inherited from
- Tapir
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
.
resourceGetServerEndpoint("static" / "hello.html")(classOf[App].getClassLoader, "app/data.html")
- Inherited from
- TapirStaticContentEndpoints
- Inherited from
- TapirStaticContentEndpoints
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:
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.
- Inherited from
- TapirStaticContentEndpoints
An output which maps to the status code in the response.
An output which maps to the status code in the response.
- Inherited from
- Tapir
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
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
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
- 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
- Inherited from
- Tapir
Deprecated and Inherited methods
- Deprecated
[Since version 0.18.0]
Use customJsonBody- Inherited from
- Tapir
- Deprecated
[Since version 0.19.0]
- Inherited from
- Tapir
- Deprecated
[Since version 0.19.0]
- Inherited from
- Tapir
- Deprecated
[Since version 0.19.0]
- Inherited from
- Tapir
- Deprecated
[Since version 0.19.0]
- Inherited from
- Tapir
- Deprecated
[Since version 0.19.0]
- Inherited from
- Tapir
- Deprecated
[Since version 0.19.0]
- Inherited from
- Tapir
Inherited fields
Implicits
Inherited implicits
- Inherited from
- ModifyMacroSupport
- Inherited from
- ZTapir
- Inherited from
- ModifyMacroSupport