case class ZPartialServerEndpoint[R, SECURITY_INPUT, PRINCIPAL, INPUT, ERROR_OUTPUT, OUTPUT, -C](endpoint: Endpoint[SECURITY_INPUT, INPUT, ERROR_OUTPUT, OUTPUT, C], securityLogic: SECURITY_INPUT => ZIO[R, ERROR_OUTPUT, PRINCIPAL]) extends EndpointInputsOps[SECURITY_INPUT, INPUT, ERROR_OUTPUT, OUTPUT, C] with EndpointOutputsOps[SECURITY_INPUT, INPUT, ERROR_OUTPUT, OUTPUT, C] with EndpointErrorOutputVariantsOps[SECURITY_INPUT, INPUT, ERROR_OUTPUT, OUTPUT, C] with EndpointInfoOps[C] with EndpointMetaOps
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 SECURITY_INPUT, either to an error of type ERROR_OUTPUT, or
value of type PRINCIPAL.
The part of the server logic which is not provided, will have to transform a tuple: (PRINCIPAL, INPUT) either into an error, or a
value of type OUTPUT.
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.
Attributes
C
The capabilities that are required by this endpoint's inputs/outputs. Any, if no requirements.
ERROR_OUTPUT
Error output parameter types.
INPUT
Input parameter types.
OUTPUT
Output parameter types.
PRINCIPAL
Type of transformed security input.
SECURITY_INPUT
Type of the security inputs, transformed into PRINCIPAL
def errorOutEither[E2](o: EndpointOutput[E2]): EndpointType[A, I, Either[E, E2], O, R]
Adds a new error variant, where the current error output is represented as a Left, and the given one as a Right.
Adds a new error variant, where the current error output is represented as a Left, and the given one as a Right.
Attributes
Inherited from:
EndpointErrorOutputVariantsOps
def errorOutVariant[E2 >: ERROR_OUTPUT](o: OneOfVariant[_ <: E2])(implicit ct: ClassTag[ERROR_OUTPUT], eEqualToErasure: ErasureSameAsType[ERROR_OUTPUT]): EndpointType[A, I, E2, O, R]
Replaces the current error output with a Tapir.oneOf output, where:
Replaces the current error output with a Tapir.oneOf output, where:
the first output variant is the current output: oneOfVariant(errorOutput)
the second output variant is the given o
The variant for the current endpoint output will be created using Tapir.oneOfVariant. Hence, the current output will be used if
the run-time class of the output matches E. If the erasure of the E type is different from E, there will be a compile-time
failure, as no such run-time check is possible. In this case, use errorOutVariantsFromCurrent and create a variant using one of
the other variant factory methods (e.g. Tapir.oneOfVariantValueMatcher).
During encoding/decoding, the new o variant will be considered after the current variant.
Usage example:
sealed trait Parent
case class Child1(v: String) extends Parent
case class Child2(v: String) extends Parent
val e: PublicEndpoint[Unit, Parent, Unit, Any] = endpoint
.errorOut(stringBody.mapTo[Child1])
.errorOutVariant[Parent](oneOfVariant(stringBody.mapTo[Child2]))
Adding error output variants is useful when extending the error outputs in a PartialServerEndpoint, created using
EndpointServerLogicOps.serverSecurityLogic.
Attributes
E2
A common supertype of the new variant and the current output E.
o
The variant to add. Can be created given an output with one of the Tapir.oneOfVariant methods.
Inherited from:
EndpointErrorOutputVariantsOps
def errorOutVariantPrepend[E2 >: ERROR_OUTPUT](o: OneOfVariant[_ <: E2]): EndpointType[A, I, E2, O, R]
Replaces the current error output with a Tapir.oneOf output, where:
Replaces the current error output with a Tapir.oneOf output, where:
the first output variant is the given o
the second, default output variant is the current output: oneOfDefaultVariant(errorOutput)
Useful for adding specific error variants, while the more general ones are already covered by the existing error output.
During encoding/decoding, the new o variant will be considered before the current variant.
Adding error output variants is useful when extending the error outputs in a PartialServerEndpoint, created using
EndpointServerLogicOps.serverSecurityLogic.
Attributes
E2
A common supertype of the new variant and the current output E.
o
The variant to add. Can be created given an output with one of the Tapir.oneOfVariant methods.
Inherited from:
EndpointErrorOutputVariantsOps
def errorOutVariants[E2 >: ERROR_OUTPUT](first: OneOfVariant[_ <: E2], other: OneOfVariant[_ <: E2]*)(implicit ct: ClassTag[ERROR_OUTPUT], eEqualToErasure: ErasureSameAsType[ERROR_OUTPUT]): EndpointType[A, I, E2, O, R]
Same as errorOutVariant, but allows appending multiple variants in one go.
Same as errorOutVariant, but allows appending multiple variants in one go.
Attributes
Inherited from:
EndpointErrorOutputVariantsOps
def errorOutVariantsFromCurrent[E2 >: ERROR_OUTPUT](variants: EndpointOutput[ERROR_OUTPUT] => List[OneOfVariant[_ <: E2]]): EndpointType[A, I, E2, O, R]
Replace the error output with a Tapir.oneOf output, using the variants returned by variants. The current output should be
included in one of the returned variants.
Replace the error output with a Tapir.oneOf output, using the variants returned by variants. The current output should be
included in one of the returned variants.
Allows creating the variant list in a custom order, placing the current variant in an arbitrary position, and using default variants
if necessary.
Adding error output variants is useful when extending the error outputs in a PartialServerEndpoint, created using
EndpointServerLogicOps.serverSecurityLogic.
Attributes
E2
A common supertype of the new variant and the current output E.
Basic information about the endpoint, excluding mapping information, with inputs sorted (first the method, then path, etc.). E.g.:
POST /books /add {header Authorization} {body as application/json (UTF-8)} -> {body as text/plain (UTF-8)}/-
Basic information about the endpoint, excluding mapping information, with inputs sorted (first the method, then path, etc.). E.g.:
POST /books /add {header Authorization} {body as application/json (UTF-8)} -> {body as text/plain (UTF-8)}/-
Shortened information about the endpoint. If the endpoint is named, returns the name, e.g. [my endpoint]. Otherwise, returns the
string representation of the method (if any) and path, e.g. POST /books/add
Shortened information about the endpoint. If the endpoint is named, returns the name, e.g. [my endpoint]. Otherwise, returns the
string representation of the method (if any) and path, e.g. POST /books/add