EndpointErrorOutputVariantsOps
Attributes
- Graph
-
- Supertypes
-
class Objecttrait Matchableclass Any
- Known subtypes
-
class PartialServerEndpointWithSecurityOutput[SECURITY_INPUT, PRINCIPAL, INPUT, ERROR_OUTPUT, SECURITY_OUTPUT, OUTPUT, R, F]
Members list
Type members
Types
Value members
Abstract methods
Concrete methods
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
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.
Type parameters
- E2
-
A common supertype of the new variant and the current output
E
.
Value parameters
- o
-
The variant to add. Can be created given an output with one of the Tapir.oneOfVariant methods.
Attributes
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.
Type parameters
- E2
-
A common supertype of the new variant and the current output
E
.
Value parameters
- o
-
The variant to add. Can be created given an output with one of the Tapir.oneOfVariant methods.
Attributes
Same as errorOutVariant, but allows appending multiple variants in one go.
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.
Type parameters
- E2
-
A common supertype of the new variant and the current output
E
.
Attributes
Same as errorOutVariantPrepend, but allows appending multiple variants in one go.