Skip to content

Commit d8191e4

Browse files
committed
Expand type parameter names in Endpoint and ServerEndpoint
1 parent 8928cb0 commit d8191e4

File tree

13 files changed

+352
-257
lines changed

13 files changed

+352
-257
lines changed

core/src/main/scala/sttp/tapir/Endpoint.scala

+70-60
Original file line numberDiff line numberDiff line change
@@ -28,48 +28,55 @@ import scala.reflect.ClassTag
2828
*
2929
* A concise description of an endpoint can be generated using the [[EndpointMetaOps.show]] method.
3030
*
31-
* @tparam A
32-
* Security input parameter types.
33-
* @tparam I
34-
* Input parameter types.
35-
* @tparam E
36-
* Error output parameter types.
37-
* @tparam O
38-
* Output parameter types.
31+
* @tparam SECURITY_INPUT
32+
* Security input parameter types, abbreviated as `A`.
33+
* @tparam INPUT
34+
* Input parameter types, abbreviated as `I`.
35+
* @tparam ERROR_OUTPUT
36+
* Error output parameter types, abbreviated as `E`.
37+
* @tparam OUTPUT
38+
* Output parameter types, abbreviated as `O`.
3939
* @tparam R
4040
* The capabilities that are required by this endpoint's inputs/outputs. This might be `Any` (no requirements),
4141
* [[sttp.capabilities.Effect]] (the interpreter must support the given effect type), [[sttp.capabilities.Streams]] (the ability to send
4242
* and receive streaming bodies) or [[sttp.capabilities.WebSockets]] (the ability to handle websocket requests).
4343
*/
44-
case class Endpoint[A, I, E, O, -R](
45-
securityInput: EndpointInput[A],
46-
input: EndpointInput[I],
47-
errorOutput: EndpointOutput[E],
48-
output: EndpointOutput[O],
44+
case class Endpoint[SECURITY_INPUT, INPUT, ERROR_OUTPUT, OUTPUT, -R](
45+
securityInput: EndpointInput[SECURITY_INPUT],
46+
input: EndpointInput[INPUT],
47+
errorOutput: EndpointOutput[ERROR_OUTPUT],
48+
output: EndpointOutput[OUTPUT],
4949
info: EndpointInfo
50-
) extends EndpointSecurityInputsOps[A, I, E, O, R]
51-
with EndpointInputsOps[A, I, E, O, R]
52-
with EndpointErrorOutputsOps[A, I, E, O, R]
53-
with EndpointErrorOutputVariantsOps[A, I, E, O, R]
54-
with EndpointOutputsOps[A, I, E, O, R]
50+
) extends EndpointSecurityInputsOps[SECURITY_INPUT, INPUT, ERROR_OUTPUT, OUTPUT, R]
51+
with EndpointInputsOps[SECURITY_INPUT, INPUT, ERROR_OUTPUT, OUTPUT, R]
52+
with EndpointErrorOutputsOps[SECURITY_INPUT, INPUT, ERROR_OUTPUT, OUTPUT, R]
53+
with EndpointErrorOutputVariantsOps[SECURITY_INPUT, INPUT, ERROR_OUTPUT, OUTPUT, R]
54+
with EndpointOutputsOps[SECURITY_INPUT, INPUT, ERROR_OUTPUT, OUTPUT, R]
5555
with EndpointInfoOps[R]
5656
with EndpointMetaOps
57-
with EndpointServerLogicOps[A, I, E, O, R] { outer =>
57+
with EndpointServerLogicOps[SECURITY_INPUT, INPUT, ERROR_OUTPUT, OUTPUT, R] { outer =>
5858

5959
override type EndpointType[_A, _I, _E, _O, -_R] = Endpoint[_A, _I, _E, _O, _R]
60-
override type ThisType[-_R] = Endpoint[A, I, E, O, _R]
61-
override private[tapir] def withSecurityInput[A2, R2](securityInput: EndpointInput[A2]): Endpoint[A2, I, E, O, R with R2] =
60+
override type ThisType[-_R] = Endpoint[SECURITY_INPUT, INPUT, ERROR_OUTPUT, OUTPUT, _R]
61+
override private[tapir] def withSecurityInput[A2, R2](
62+
securityInput: EndpointInput[A2]
63+
): Endpoint[A2, INPUT, ERROR_OUTPUT, OUTPUT, R with R2] =
6264
this.copy(securityInput = securityInput)
63-
override private[tapir] def withInput[I2, R2](input: EndpointInput[I2]): Endpoint[A, I2, E, O, R with R2] = this.copy(input = input)
64-
override private[tapir] def withErrorOutput[E2, R2](errorOutput: EndpointOutput[E2]): Endpoint[A, I, E2, O, R with R2] =
65+
override private[tapir] def withInput[I2, R2](input: EndpointInput[I2]): Endpoint[SECURITY_INPUT, I2, ERROR_OUTPUT, OUTPUT, R with R2] =
66+
this.copy(input = input)
67+
override private[tapir] def withErrorOutput[E2, R2](
68+
errorOutput: EndpointOutput[E2]
69+
): Endpoint[SECURITY_INPUT, INPUT, E2, OUTPUT, R with R2] =
6570
this.copy(errorOutput = errorOutput)
6671
override private[tapir] def withErrorOutputVariant[E2, R2](
6772
errorOutput: EndpointOutput[E2],
68-
embedE: E => E2
69-
): Endpoint[A, I, E2, O, R with R2] =
73+
embedE: ERROR_OUTPUT => E2
74+
): Endpoint[SECURITY_INPUT, INPUT, E2, OUTPUT, R with R2] =
7075
this.copy(errorOutput = errorOutput)
71-
override private[tapir] def withOutput[O2, R2](output: EndpointOutput[O2]): Endpoint[A, I, E, O2, R with R2] = this.copy(output = output)
72-
override private[tapir] def withInfo(info: EndpointInfo): Endpoint[A, I, E, O, R] = this.copy(info = info)
76+
override private[tapir] def withOutput[O2, R2](output: EndpointOutput[O2]): Endpoint[SECURITY_INPUT, INPUT, ERROR_OUTPUT, O2, R with R2] =
77+
this.copy(output = output)
78+
override private[tapir] def withInfo(info: EndpointInfo): Endpoint[SECURITY_INPUT, INPUT, ERROR_OUTPUT, OUTPUT, R] =
79+
this.copy(info = info)
7380
override protected def showType: String = "Endpoint"
7481
}
7582

@@ -420,41 +427,41 @@ trait EndpointServerLogicOps[A, I, E, O, -R] { outer: Endpoint[A, I, E, O, R] =>
420427
* An example use-case is defining an endpoint with fully-defined errors, and with security logic built-in. Such an endpoint can be then
421428
* extended by multiple other endpoints, by specifying different inputs, outputs and the main logic.
422429
*/
423-
def serverSecurityLogic[U, F[_]](f: A => F[Either[E, U]]): PartialServerEndpoint[A, U, I, E, O, R, F] =
430+
def serverSecurityLogic[PRINCIPAL, F[_]](f: A => F[Either[E, PRINCIPAL]]): PartialServerEndpoint[A, PRINCIPAL, I, E, O, R, F] =
424431
PartialServerEndpoint(this, _ => f)
425432

426433
/** Like [[serverSecurityLogic]], but specialised to the case when the result is always a success (`Right`), hence when the logic type can
427-
* be simplified to `A => F[U]`.
434+
* be simplified to `A => F[PRINCIPAL]`.
428435
*/
429-
def serverSecurityLogicSuccess[U, F[_]](
430-
f: A => F[U]
431-
): PartialServerEndpoint[A, U, I, E, O, R, F] =
436+
def serverSecurityLogicSuccess[PRINCIPAL, F[_]](
437+
f: A => F[PRINCIPAL]
438+
): PartialServerEndpoint[A, PRINCIPAL, I, E, O, R, F] =
432439
PartialServerEndpoint(this, implicit m => a => f(a).map(Right(_)))
433440

434441
/** Like [[serverSecurityLogic]], but specialised to the case when the result is always an error (`Left`), hence when the logic type can
435442
* be simplified to `A => F[E]`.
436443
*/
437-
def serverSecurityLogicError[U, F[_]](
444+
def serverSecurityLogicError[PRINCIPAL, F[_]](
438445
f: A => F[E]
439-
): PartialServerEndpoint[A, U, I, E, O, R, F] =
446+
): PartialServerEndpoint[A, PRINCIPAL, I, E, O, R, F] =
440447
PartialServerEndpoint(this, implicit m => a => f(a).map(Left(_)))
441448

442449
/** Like [[serverSecurityLogic]], but specialised to the case when the logic function is pure, that is doesn't have any side effects. */
443-
def serverSecurityLogicPure[U, F[_]](f: A => Either[E, U]): PartialServerEndpoint[A, U, I, E, O, R, F] =
450+
def serverSecurityLogicPure[PRINCIPAL, F[_]](f: A => Either[E, PRINCIPAL]): PartialServerEndpoint[A, PRINCIPAL, I, E, O, R, F] =
444451
PartialServerEndpoint(this, implicit m => a => f(a).unit)
445452

446453
/** Same as [[serverSecurityLogic]], but requires `E` to be a throwable, and coverts failed effects of type `E` to endpoint errors. */
447-
def serverSecurityLogicRecoverErrors[U, F[_]](
448-
f: A => F[U]
449-
)(implicit eIsThrowable: E <:< Throwable, eClassTag: ClassTag[E]): PartialServerEndpoint[A, U, I, E, O, R, F] =
450-
PartialServerEndpoint(this, recoverErrors1[A, E, U, F](f))
454+
def serverSecurityLogicRecoverErrors[PRINCIPAL, F[_]](
455+
f: A => F[PRINCIPAL]
456+
)(implicit eIsThrowable: E <:< Throwable, eClassTag: ClassTag[E]): PartialServerEndpoint[A, PRINCIPAL, I, E, O, R, F] =
457+
PartialServerEndpoint(this, recoverErrors1[A, E, PRINCIPAL, F](f))
451458

452459
/** Like [[serverSecurityLogic]], but specialised to the case when the error type is `Unit` (e.g. a fixed status code), and the result of
453460
* the logic function is an option. A `None` is then treated as an error response.
454461
*/
455-
def serverSecurityLogicOption[U, F[_]](
456-
f: A => F[Option[U]]
457-
)(implicit eIsUnit: E =:= Unit): PartialServerEndpoint[A, U, I, Unit, O, R, F] = {
462+
def serverSecurityLogicOption[PRINCIPAL, F[_]](
463+
f: A => F[Option[PRINCIPAL]]
464+
)(implicit eIsUnit: E =:= Unit): PartialServerEndpoint[A, PRINCIPAL, I, Unit, O, R, F] = {
458465
import sttp.monad.syntax._
459466
PartialServerEndpoint(
460467
this.asInstanceOf[Endpoint[A, I, Unit, O, R]],
@@ -470,43 +477,46 @@ trait EndpointServerLogicOps[A, I, E, O, -R] { outer: Endpoint[A, I, E, O, R] =>
470477
//
471478

472479
/** Like [[serverSecurityLogic]], but allows the security function to contribute to the overall output of the endpoint. A value for the
473-
* complete output `O` defined so far has to be provided. The value `U` will be propagated as an input to the regular logic.
480+
* complete output `O` defined so far has to be provided. The value `PRINCIPAL` will be propagated as an input to the regular logic.
474481
*/
475-
def serverSecurityLogicWithOutput[U, F[_]](
476-
f: A => F[Either[E, (O, U)]]
477-
): PartialServerEndpointWithSecurityOutput[A, U, I, E, O, Unit, R, F] =
482+
def serverSecurityLogicWithOutput[PRINCIPAL, F[_]](
483+
f: A => F[Either[E, (O, PRINCIPAL)]]
484+
): PartialServerEndpointWithSecurityOutput[A, PRINCIPAL, I, E, O, Unit, R, F] =
478485
PartialServerEndpointWithSecurityOutput(this.output, this.copy(output = emptyOutput), _ => f)
479486

480487
/** Like [[serverSecurityLogicWithOutput]], but specialised to the case when the result is always a success (`Right`), hence when the
481-
* logic type can be simplified to `A => F[(O, U)]`.
488+
* logic type can be simplified to `A => F[(O, PRINCIPAL)]`.
482489
*/
483-
def serverSecurityLogicSuccessWithOutput[U, F[_]](
484-
f: A => F[(O, U)]
485-
): PartialServerEndpointWithSecurityOutput[A, U, I, E, O, Unit, R, F] =
490+
def serverSecurityLogicSuccessWithOutput[PRINCIPAL, F[_]](
491+
f: A => F[(O, PRINCIPAL)]
492+
): PartialServerEndpointWithSecurityOutput[A, PRINCIPAL, I, E, O, Unit, R, F] =
486493
PartialServerEndpointWithSecurityOutput(this.output, this.copy(output = emptyOutput), implicit m => a => f(a).map(Right(_)))
487494

488495
/** Like [[serverSecurityLogicWithOutput]], but specialised to the case when the logic function is pure, that is doesn't have any side
489496
* effects.
490497
*/
491-
def serverSecurityLogicPureWithOutput[U, F[_]](
492-
f: A => Either[E, (O, U)]
493-
): PartialServerEndpointWithSecurityOutput[A, U, I, E, O, Unit, R, F] =
498+
def serverSecurityLogicPureWithOutput[PRINCIPAL, F[_]](
499+
f: A => Either[E, (O, PRINCIPAL)]
500+
): PartialServerEndpointWithSecurityOutput[A, PRINCIPAL, I, E, O, Unit, R, F] =
494501
PartialServerEndpointWithSecurityOutput(this.output, this.copy(output = emptyOutput), implicit m => a => f(a).unit)
495502

496503
/** Same as [[serverSecurityLogicWithOutput]], but requires `E` to be a throwable, and coverts failed effects of type `E` to endpoint
497504
* errors.
498505
*/
499-
def serverSecurityLogicRecoverErrorsWithOutput[U, F[_]](
500-
f: A => F[(O, U)]
501-
)(implicit eIsThrowable: E <:< Throwable, eClassTag: ClassTag[E]): PartialServerEndpointWithSecurityOutput[A, U, I, E, O, Unit, R, F] =
502-
PartialServerEndpointWithSecurityOutput(this.output, this.copy(output = emptyOutput), recoverErrors1[A, E, (O, U), F](f))
506+
def serverSecurityLogicRecoverErrorsWithOutput[PRINCIPAL, F[_]](
507+
f: A => F[(O, PRINCIPAL)]
508+
)(implicit
509+
eIsThrowable: E <:< Throwable,
510+
eClassTag: ClassTag[E]
511+
): PartialServerEndpointWithSecurityOutput[A, PRINCIPAL, I, E, O, Unit, R, F] =
512+
PartialServerEndpointWithSecurityOutput(this.output, this.copy(output = emptyOutput), recoverErrors1[A, E, (O, PRINCIPAL), F](f))
503513

504514
/** Like [[serverSecurityLogicWithOutput]], but specialised to the case when the error type is `Unit` (e.g. a fixed status code), and the
505515
* result of the logic function is an option. A `None` is then treated as an error response.
506516
*/
507-
def serverSecurityLogicOptionWithOutput[U, F[_]](
508-
f: A => F[Option[(O, U)]]
509-
)(implicit eIsUnit: E =:= Unit): PartialServerEndpointWithSecurityOutput[A, U, I, Unit, O, Unit, R, F] = {
517+
def serverSecurityLogicOptionWithOutput[PRINCIPAL, F[_]](
518+
f: A => F[Option[(O, PRINCIPAL)]]
519+
)(implicit eIsUnit: E =:= Unit): PartialServerEndpointWithSecurityOutput[A, PRINCIPAL, I, Unit, O, Unit, R, F] = {
510520
import sttp.monad.syntax._
511521
PartialServerEndpointWithSecurityOutput(
512522
this.output,

core/src/main/scala/sttp/tapir/package.scala

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,5 +10,5 @@ package object tapir extends Tapir {
1010
type AnyListCodec = Codec[_ <: List[_], _, _ <: CodecFormat]
1111

1212
type AnyEndpoint = Endpoint[_, _, _, _, _]
13-
type PublicEndpoint[I, E, O, -R] = Endpoint[Unit, I, E, O, R]
13+
type PublicEndpoint[INPUT, ERROR_INPUT, OUTPUT, -R] = Endpoint[Unit, INPUT, ERROR_INPUT, OUTPUT, R]
1414
}

core/src/main/scala/sttp/tapir/server/PartialServerEndpoint.scala

+51-35
Original file line numberDiff line numberDiff line change
@@ -9,55 +9,58 @@ import scala.reflect.ClassTag
99

1010
/** An endpoint with the security logic provided, and the main logic yet unspecified. See [[Endpoint.serverSecurityLogic]].
1111
*
12-
* 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`.
12+
* The provided security part of the server logic transforms inputs of type `SECURITY_INPUT`, either to an error of type `ERROR_OUTPUT`, or
13+
* value of type `PRINCIPAL`.
1314
*
14-
* The part of the server logic which is not provided, will have to transform both `U` and the rest of the input `I` either into an error,
15-
* or a value of type `O`.
15+
* The part of the server logic which is not provided, will have to transform both `PRINCIPAL` and the rest of the input `INPUT` either
16+
* into an error, or a value of type `OUTPUT`.
1617
*
1718
* Inputs/outputs can be added to partial endpoints as to regular endpoints. The shape of the error outputs can be adjusted in a limited
1819
* way, by adding new error output variants, similar as if they were defined using [[Tapir.oneOf]]; the variants and the existing error
1920
* outputs should usually have a common supertype (other than `Any`). Hence, it's possible to create a base, secured input, and then
2021
* specialise it with inputs, outputs and logic as needed.
2122
*
22-
* @tparam A
23-
* "Auth": Security input parameter types, which the security logic accepts and returns a `U` or an error `E`.
24-
* @tparam U
25-
* "User": The type of the value returned by the security logic.
26-
* @tparam I
23+
* @tparam SECURITY_INPUT
24+
* Security input parameter types, which the security logic accepts and returns a `PRINCIPAL` or an error `ERROR_OUTPUT`.
25+
* @tparam PRINCIPAL
26+
* The type of the value returned by the security logic.
27+
* @tparam INPUT
2728
* Input parameter types.
28-
* @tparam E
29+
* @tparam ERROR_OUTPUT
2930
* Error output parameter types.
30-
* @tparam O
31+
* @tparam OUTPUT
3132
* Output parameter types.
3233
* @tparam R
3334
* The capabilities that are required by this endpoint's inputs/outputs. `Any`, if no requirements.
3435
* @tparam F
3536
* The effect type used in the provided partial server logic.
3637
*/
37-
case class PartialServerEndpoint[A, U, I, E, O, -R, F[_]](
38-
endpoint: Endpoint[A, I, E, O, R],
39-
securityLogic: MonadError[F] => A => F[Either[E, U]]
40-
) extends EndpointInputsOps[A, I, E, O, R]
41-
with EndpointOutputsOps[A, I, E, O, R]
42-
with EndpointErrorOutputVariantsOps[A, I, E, O, R]
38+
case class PartialServerEndpoint[SECURITY_INPUT, PRINCIPAL, INPUT, ERROR_OUTPUT, OUTPUT, -R, F[_]](
39+
endpoint: Endpoint[SECURITY_INPUT, INPUT, ERROR_OUTPUT, OUTPUT, R],
40+
securityLogic: MonadError[F] => SECURITY_INPUT => F[Either[ERROR_OUTPUT, PRINCIPAL]]
41+
) extends EndpointInputsOps[SECURITY_INPUT, INPUT, ERROR_OUTPUT, OUTPUT, R]
42+
with EndpointOutputsOps[SECURITY_INPUT, INPUT, ERROR_OUTPUT, OUTPUT, R]
43+
with EndpointErrorOutputVariantsOps[SECURITY_INPUT, INPUT, ERROR_OUTPUT, OUTPUT, R]
4344
with EndpointInfoOps[R]
4445
with EndpointMetaOps { outer =>
45-
override type ThisType[-_R] = PartialServerEndpoint[A, U, I, E, O, _R, F]
46-
override type EndpointType[_A, _I, _E, _O, -_R] = PartialServerEndpoint[_A, U, _I, _E, _O, _R, F]
46+
override type ThisType[-_R] = PartialServerEndpoint[SECURITY_INPUT, PRINCIPAL, INPUT, ERROR_OUTPUT, OUTPUT, _R, F]
47+
override type EndpointType[_A, _I, _E, _O, -_R] = PartialServerEndpoint[_A, PRINCIPAL, _I, _E, _O, _R, F]
4748

48-
override def securityInput: EndpointInput[A] = endpoint.securityInput
49-
override def input: EndpointInput[I] = endpoint.input
50-
override def errorOutput: EndpointOutput[E] = endpoint.errorOutput
51-
override def output: EndpointOutput[O] = endpoint.output
49+
override def securityInput: EndpointInput[SECURITY_INPUT] = endpoint.securityInput
50+
override def input: EndpointInput[INPUT] = endpoint.input
51+
override def errorOutput: EndpointOutput[ERROR_OUTPUT] = endpoint.errorOutput
52+
override def output: EndpointOutput[OUTPUT] = endpoint.output
5253
override def info: EndpointInfo = endpoint.info
5354

54-
override private[tapir] def withInput[I2, R2](input: EndpointInput[I2]): PartialServerEndpoint[A, U, I2, E, O, R with R2, F] =
55+
override private[tapir] def withInput[I2, R2](
56+
input: EndpointInput[I2]
57+
): PartialServerEndpoint[SECURITY_INPUT, PRINCIPAL, I2, ERROR_OUTPUT, OUTPUT, R with R2, F] =
5558
copy(endpoint = endpoint.copy(input = input))
5659
override private[tapir] def withOutput[O2, R2](output: EndpointOutput[O2]) = copy(endpoint = endpoint.copy(output = output))
5760
override private[tapir] def withErrorOutputVariant[E2, R2](
5861
errorOutput: EndpointOutput[E2],
59-
embedE: E => E2
60-
): PartialServerEndpoint[A, U, I, E2, O, R with R2, F] =
62+
embedE: ERROR_OUTPUT => E2
63+
): PartialServerEndpoint[SECURITY_INPUT, PRINCIPAL, INPUT, E2, OUTPUT, R with R2, F] =
6164
this.copy(
6265
endpoint = endpoint.copy(errorOutput = errorOutput),
6366
securityLogic = implicit m =>
@@ -71,26 +74,39 @@ case class PartialServerEndpoint[A, U, I, E, O, -R, F[_]](
7174

7275
override protected def showType: String = "PartialServerEndpoint"
7376

74-
def serverLogic(f: U => I => F[Either[E, O]]): ServerEndpoint.Full[A, U, I, E, O, R, F] = ServerEndpoint(endpoint, securityLogic, _ => f)
77+
def serverLogic(
78+
f: PRINCIPAL => INPUT => F[Either[ERROR_OUTPUT, OUTPUT]]
79+
): ServerEndpoint.Full[SECURITY_INPUT, PRINCIPAL, INPUT, ERROR_OUTPUT, OUTPUT, R, F] = ServerEndpoint(endpoint, securityLogic, _ => f)
7580

76-
def serverLogicSuccess(f: U => I => F[O]): ServerEndpoint.Full[A, U, I, E, O, R, F] =
81+
def serverLogicSuccess(
82+
f: PRINCIPAL => INPUT => F[OUTPUT]
83+
): ServerEndpoint.Full[SECURITY_INPUT, PRINCIPAL, INPUT, ERROR_OUTPUT, OUTPUT, R, F] =
7784
ServerEndpoint(endpoint, securityLogic, implicit m => u => i => f(u)(i).map(Right(_)))
7885

79-
def serverLogicError(f: U => I => F[E]): ServerEndpoint.Full[A, U, I, E, O, R, F] =
86+
def serverLogicError(
87+
f: PRINCIPAL => INPUT => F[ERROR_OUTPUT]
88+
): ServerEndpoint.Full[SECURITY_INPUT, PRINCIPAL, INPUT, ERROR_OUTPUT, OUTPUT, R, F] =
8089
ServerEndpoint(endpoint, securityLogic, implicit m => u => i => f(u)(i).map(Left(_)))
8190

82-
def serverLogicPure(f: U => I => Either[E, O]): ServerEndpoint.Full[A, U, I, E, O, R, F] =
91+
def serverLogicPure(
92+
f: PRINCIPAL => INPUT => Either[ERROR_OUTPUT, OUTPUT]
93+
): ServerEndpoint.Full[SECURITY_INPUT, PRINCIPAL, INPUT, ERROR_OUTPUT, OUTPUT, R, F] =
8394
ServerEndpoint(endpoint, securityLogic, implicit m => u => i => f(u)(i).unit)
8495

8596
def serverLogicRecoverErrors(
86-
f: U => I => F[O]
87-
)(implicit eIsThrowable: E <:< Throwable, eClassTag: ClassTag[E]): ServerEndpoint.Full[A, U, I, E, O, R, F] =
88-
ServerEndpoint(endpoint, securityLogic, recoverErrors2[U, I, E, O, F](f))
97+
f: PRINCIPAL => INPUT => F[OUTPUT]
98+
)(implicit
99+
eIsThrowable: ERROR_OUTPUT <:< Throwable,
100+
eClassTag: ClassTag[ERROR_OUTPUT]
101+
): ServerEndpoint.Full[SECURITY_INPUT, PRINCIPAL, INPUT, ERROR_OUTPUT, OUTPUT, R, F] =
102+
ServerEndpoint(endpoint, securityLogic, recoverErrors2[PRINCIPAL, INPUT, ERROR_OUTPUT, OUTPUT, F](f))
89103

90-
def serverLogicOption(f: U => I => F[Option[O]])(implicit eIsUnit: E =:= Unit): ServerEndpoint.Full[A, U, I, Unit, O, R, F] =
104+
def serverLogicOption(f: PRINCIPAL => INPUT => F[Option[OUTPUT]])(implicit
105+
eIsUnit: ERROR_OUTPUT =:= Unit
106+
): ServerEndpoint.Full[SECURITY_INPUT, PRINCIPAL, INPUT, Unit, OUTPUT, R, F] =
91107
ServerEndpoint(
92-
endpoint.asInstanceOf[Endpoint[A, I, Unit, O, R]],
93-
securityLogic.asInstanceOf[MonadError[F] => A => F[Either[Unit, U]]],
108+
endpoint.asInstanceOf[Endpoint[SECURITY_INPUT, INPUT, Unit, OUTPUT, R]],
109+
securityLogic.asInstanceOf[MonadError[F] => SECURITY_INPUT => F[Either[Unit, PRINCIPAL]]],
94110
implicit m =>
95111
u =>
96112
i =>

0 commit comments

Comments
 (0)