Packages

object DefaultDecodeFailureHandler extends Serializable

Linear Supertypes
Serializable, AnyRef, Any
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. DefaultDecodeFailureHandler
  2. Serializable
  3. AnyRef
  4. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. Protected

Value Members

  1. final def !=(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  2. final def ##: Int
    Definition Classes
    AnyRef → Any
  3. final def ==(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  4. final def asInstanceOf[T0]: T0
    Definition Classes
    Any
  5. def clone(): AnyRef
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.CloneNotSupportedException]) @native() @HotSpotIntrinsicCandidate()
  6. val default: DefaultDecodeFailureHandler

    The default implementation of the DecodeFailureHandler.

    The default implementation of the DecodeFailureHandler.

    A 400 (bad request) is returned if a query, header or body input can't be decoded (for any reason), or if decoding a path capture causes a validation error.

    A 401 (unauthorized) is returned when an authentication input (created using Tapir.auth) cannot be decoded. The appropriate WWW-Authenticate headers are included.

    Otherwise (e.g. if the method, a path segment, or path capture is missing, there's a mismatch or a decode error), None is returned, which is a signal to try the next endpoint.

    The error messages contain information about the source of the decode error, and optionally the validation error detail that caused the failure.

    The default decode failure handler can be customised by providing alternate functions for deciding whether a response should be sent, creating the error message and creating the response.

    Furthermore, how decode failures are handled can be adjusted globally by changing the flags passed to respond. By default, if the shape of the path for an endpoint matches the request, but decoding a path capture causes an error (e.g. a path[Int]("amount") cannot be parsed), the next endpoint is tried. However, if there's a validation error (e.g. a path[Kind]("kind"), where Kind is an enum, and a value outside the enumeration values is provided), a 400 response is sent.

    Finally, behavior can be adjusted per-endpoint-input, by setting an attribute. Import the OnDecodeFailure object and use the OnDecodeFailure.RichEndpointTransput.onDecodeFailureBadRequest and OnDecodeFailure.RichEndpointTransput.onDecodeFailureNextEndpoint extension methods.

    This is only used for failures that occur when decoding inputs, not for exceptions that happen when the server logic is invoked. Exceptions can be either handled by the server logic, and converted to an error output value. Uncaught exceptions can be handled using the sttp.tapir.server.interceptor.exception.ExceptionInterceptor.

  7. final def eq(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  8. def equals(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef → Any
  9. def failureResponse(c: StatusCode, hs: List[Header], m: String): ValuedEndpointOutput[_]
  10. final def getClass(): Class[_ <: AnyRef]
    Definition Classes
    AnyRef → Any
    Annotations
    @native() @HotSpotIntrinsicCandidate()
  11. def hashCode(): Int
    Definition Classes
    AnyRef → Any
    Annotations
    @native() @HotSpotIntrinsicCandidate()
  12. val hideEndpointsWithAuth: DefaultDecodeFailureHandler

    A default handler which responds with a 404 Not Found, instead of a 401 Unauthorized or 400 Bad Request, in case any input fails to decode, and the endpoint contains authentication inputs (created using Tapir.auth).

    A default handler which responds with a 404 Not Found, instead of a 401 Unauthorized or 400 Bad Request, in case any input fails to decode, and the endpoint contains authentication inputs (created using Tapir.auth). No WWW-Authenticate headers are sent.

    Hence, the information if the endpoint exists, but needs authentication is hidden from the client. However, the existence of the endpoint might still be revealed using timing attacks.

  13. final def isInstanceOf[T0]: Boolean
    Definition Classes
    Any
  14. final def ne(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  15. final def notify(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native() @HotSpotIntrinsicCandidate()
  16. final def notifyAll(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native() @HotSpotIntrinsicCandidate()
  17. def respond(ctx: DecodeFailureContext, badRequestOnPathErrorIfPathShapeMatches: Boolean, badRequestOnPathInvalidIfPathShapeMatches: Boolean): Option[(StatusCode, List[Header])]

    badRequestOnPathErrorIfPathShapeMatches

    Should a status 400 be returned if the shape of the path of the request matches, but decoding some path segment fails with a DecodeResult.Error.

    badRequestOnPathInvalidIfPathShapeMatches

    Should a status 400 be returned if the shape of the path of the request matches, but decoding some path segment fails with a DecodeResult.InvalidValue.

  18. def respondNotFoundIfHasAuth(ctx: DecodeFailureContext, response: Option[(StatusCode, List[Header])]): Option[(StatusCode, List[Header])]
  19. final def synchronized[T0](arg0: => T0): T0
    Definition Classes
    AnyRef
  20. def toString(): String
    Definition Classes
    AnyRef → Any
  21. final def wait(arg0: Long, arg1: Int): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException])
  22. final def wait(arg0: Long): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException]) @native()
  23. final def wait(): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException])
  24. object FailureMessages

    Default messages for DecodeResult.Failure s.

  25. object OnDecodeFailure
  26. object ValidationMessages

    Default messages when the decode failure is due to a validation error.

Deprecated Value Members

  1. def finalize(): Unit
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.Throwable]) @Deprecated
    Deprecated

Inherited from Serializable

Inherited from AnyRef

Inherited from Any

Ungrouped