Packages

t

endpoints4s.akkahttp.server

JsonEntitiesFromEncodersAndDecoders

trait JsonEntitiesFromEncodersAndDecoders extends algebra.JsonEntities with EndpointsWithCustomErrors

Interpreter for endpoints4s.algebra.JsonEntities that decodes JSON entities with a endpoints4s.Decoder and encodes JSON entities with an endpoints4s.Encoder.

The difference with JsonEntitiesFromCodecs is that you don’t need bidirectional codecs: you only need an encoder to build responses, or a decoder to decode requests.

It is especially useful to encode OpenApi documents into JSON entities.

Source
JsonEntities.scala
Linear Supertypes
EndpointsWithCustomErrors, Methods, Urls, StatusCodes, algebra.JsonEntities, algebra.EndpointsWithCustomErrors, Errors, Responses, algebra.StatusCodes, Requests, endpoints4s.SemigroupalSyntax, algebra.Methods, algebra.Urls, endpoints4s.PartialInvariantFunctorSyntax, endpoints4s.InvariantFunctorSyntax, AnyRef, Any
Type Hierarchy
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. JsonEntitiesFromEncodersAndDecoders
  2. EndpointsWithCustomErrors
  3. Methods
  4. Urls
  5. StatusCodes
  6. JsonEntities
  7. EndpointsWithCustomErrors
  8. Errors
  9. Responses
  10. StatusCodes
  11. Requests
  12. SemigroupalSyntax
  13. Methods
  14. Urls
  15. PartialInvariantFunctorSyntax
  16. InvariantFunctorSyntax
  17. AnyRef
  18. Any
Implicitly
  1. by any2stringadd
  2. by StringFormat
  3. by Ensuring
  4. by ArrowAssoc
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. Protected

Type Members

  1. case class Endpoint[A, B](request: Request[A], response: Response[B]) extends Product with Serializable
    Definition Classes
    EndpointsWithCustomErrors
  2. trait Request[A] extends AnyRef
    Definition Classes
    EndpointsWithCustomErrors
  3. trait RequestHeaders[A] extends AnyRef
    Definition Classes
    EndpointsWithCustomErrors
  4. final class CallbackDocs extends Serializable
    Definition Classes
    EndpointsWithCustomErrors
  5. type CallbacksDocs = Map[String, CallbackDocs]
    Definition Classes
    EndpointsWithCustomErrors
  6. abstract type ClientErrors
    Definition Classes
    Errors
  7. final class EndpointDocs extends Serializable
    Definition Classes
    EndpointsWithCustomErrors
  8. implicit final class EndpointSyntax[A, B] extends AnyRef
    Definition Classes
    EndpointsWithCustomErrors
  9. implicit class InvariantFunctorSyntax[A, F[_]] extends AnyRef
    Definition Classes
    InvariantFunctorSyntax
  10. type JsonRequest[A] = Decoder[String, A]
    Definition Classes
    JsonEntitiesFromEncodersAndDecoders → JsonEntities
  11. type JsonResponse[A] = Encoder[A, String]
    Definition Classes
    JsonEntitiesFromEncodersAndDecoders → JsonEntities
  12. type Method = HttpMethod
    Definition Classes
    Methods → Methods
  13. implicit class PartialInvariantFunctorSyntax[A, F[_]] extends AnyRef
    Definition Classes
    PartialInvariantFunctorSyntax
  14. implicit class PathOps[A] extends AnyRef
    Definition Classes
    Urls
  15. implicit class QueryStringSyntax[A] extends AnyRef
    Definition Classes
    Urls
  16. type RequestEntity[A] = Directive[(A)]
    Definition Classes
    EndpointsWithCustomErrors → Requests
  17. implicit class RequestEntitySyntax[A] extends AnyRef
    Definition Classes
    Requests
  18. implicit final class RequestSyntax[A] extends AnyRef
    Definition Classes
    Requests
  19. type Response[A] = (A) => Route
    Definition Classes
    EndpointsWithCustomErrors → Responses
  20. type ResponseEntity[A] = Marshaller[A, MessageEntity]
    Definition Classes
    EndpointsWithCustomErrors → Responses
  21. type ResponseHeaders[A] = (A) => Seq[HttpHeader]
    Definition Classes
    EndpointsWithCustomErrors → Responses
  22. implicit class ResponseSyntax[A] extends AnyRef
    Definition Classes
    Responses
  23. implicit class SemigroupalSyntax[A, F[_]] extends AnyRef
    Definition Classes
    SemigroupalSyntax
  24. abstract type ServerError
    Definition Classes
    Errors
  25. type StatusCode = akka.http.scaladsl.model.StatusCode
    Definition Classes
    StatusCodes → StatusCodes
  26. type WithDefault[A] = A
    Definition Classes
    Urls → Urls
  27. trait Path[A] extends EndpointsWithCustomErrors.Url[A]
    Definition Classes
    Urls
  28. trait QueryString[T] extends AnyRef
    Definition Classes
    Urls
  29. trait QueryStringParam[T] extends AnyRef

    Given a parameter name and a query string content, returns a decoded parameter value of type T, or Invalid if decoding failed

    Given a parameter name and a query string content, returns a decoded parameter value of type T, or Invalid if decoding failed

    Definition Classes
    Urls
  30. trait Segment[A] extends AnyRef
    Definition Classes
    Urls
  31. trait Url[A] extends AnyRef
    Definition Classes
    Urls

Abstract Value Members

  1. abstract def clientErrorsResponseEntity: ResponseEntity[ClientErrors]
    Definition Classes
    Errors
  2. abstract def clientErrorsToInvalid(clientErrors: ClientErrors): Invalid
    Definition Classes
    Errors
  3. abstract def invalidToClientErrors(invalid: Invalid): ClientErrors
    Definition Classes
    Errors
  4. abstract def serverErrorResponseEntity: ResponseEntity[ServerError]
    Definition Classes
    Errors
  5. abstract def serverErrorToThrowable(serverError: ServerError): Throwable
    Definition Classes
    Errors
  6. abstract def throwableToServerError(throwable: Throwable): ServerError
    Definition Classes
    Errors

Concrete Value Members

  1. def Accepted: Success
    Definition Classes
    StatusCodes → StatusCodes
  2. def AlreadyReported: Success
    Definition Classes
    StatusCodes → StatusCodes
  3. def BadRequest: ClientError
    Definition Classes
    StatusCodes → StatusCodes
  4. def Conflict: ClientError
    Definition Classes
    StatusCodes → StatusCodes
  5. def Created: Success
    Definition Classes
    StatusCodes → StatusCodes
  6. def Delete: HttpMethod
    Definition Classes
    Methods → Methods
  7. def ExpectationFailed: ClientError
    Definition Classes
    StatusCodes → StatusCodes
  8. def FailedDependency: ClientError
    Definition Classes
    StatusCodes → StatusCodes
  9. def Forbidden: ClientError
    Definition Classes
    StatusCodes → StatusCodes
  10. def Get: HttpMethod
    Definition Classes
    Methods → Methods
  11. def Gone: ClientError
    Definition Classes
    StatusCodes → StatusCodes
  12. def IMUsed: Success
    Definition Classes
    StatusCodes → StatusCodes
  13. def InternalServerError: akka.http.scaladsl.model.StatusCodes.ServerError
    Definition Classes
    StatusCodes → StatusCodes
  14. def LengthRequired: ClientError
    Definition Classes
    StatusCodes → StatusCodes
  15. def Locked: ClientError
    Definition Classes
    StatusCodes → StatusCodes
  16. def MethodNotAllowed: ClientError
    Definition Classes
    StatusCodes → StatusCodes
  17. def MisdirectedRequest: ClientError
    Definition Classes
    StatusCodes → StatusCodes
  18. def MultiStatus: Success
    Definition Classes
    StatusCodes → StatusCodes
  19. def NoContent: Success
    Definition Classes
    StatusCodes → StatusCodes
  20. def NonAuthoritativeInformation: Success
    Definition Classes
    StatusCodes → StatusCodes
  21. def NotAcceptable: ClientError
    Definition Classes
    StatusCodes → StatusCodes
  22. def NotFound: ClientError
    Definition Classes
    StatusCodes → StatusCodes
  23. def NotImplemented: akka.http.scaladsl.model.StatusCodes.ServerError
    Definition Classes
    StatusCodes → StatusCodes
  24. def NotModified: Redirection
    Definition Classes
    StatusCodes → StatusCodes
  25. def OK: Success
    Definition Classes
    StatusCodes → StatusCodes
  26. def Options: HttpMethod
    Definition Classes
    Methods → Methods
  27. def PartialContent: Success
    Definition Classes
    StatusCodes → StatusCodes
  28. def Patch: HttpMethod
    Definition Classes
    Methods → Methods
  29. def PayloadTooLarge: ClientError
    Definition Classes
    StatusCodes → StatusCodes
  30. def PaymentRequired: ClientError
    Definition Classes
    StatusCodes → StatusCodes
  31. def PermanentRedirect: Redirection
    Definition Classes
    StatusCodes → StatusCodes
  32. def Post: HttpMethod
    Definition Classes
    Methods → Methods
  33. def PreconditionFailed: ClientError
    Definition Classes
    StatusCodes → StatusCodes
  34. def PreconditionRequired: ClientError
    Definition Classes
    StatusCodes → StatusCodes
  35. def ProxyAuthenticationRequired: ClientError
    Definition Classes
    StatusCodes → StatusCodes
  36. def Put: HttpMethod
    Definition Classes
    Methods → Methods
  37. def RangeNotSatisfiable: ClientError
    Definition Classes
    StatusCodes → StatusCodes
  38. def RequestHeaderFieldsTooLarge: ClientError
    Definition Classes
    StatusCodes → StatusCodes
  39. def RequestTimeout: ClientError
    Definition Classes
    StatusCodes → StatusCodes
  40. def ResetContent: Success
    Definition Classes
    StatusCodes → StatusCodes
  41. def TemporaryRedirect: Redirection
    Definition Classes
    StatusCodes → StatusCodes
  42. def TooEarly: ClientError
    Definition Classes
    StatusCodes → StatusCodes
  43. def TooManyRequests: ClientError
    Definition Classes
    StatusCodes → StatusCodes
  44. def Unauthorized: ClientError
    Definition Classes
    StatusCodes → StatusCodes
  45. def UnavailableForLegalReasons: ClientError
    Definition Classes
    StatusCodes → StatusCodes
  46. def UnprocessableEntity: ClientError
    Definition Classes
    StatusCodes → StatusCodes
  47. def UnsupportedMediaType: ClientError
    Definition Classes
    StatusCodes → StatusCodes
  48. def UpgradeRequired: ClientError
    Definition Classes
    StatusCodes → StatusCodes
  49. def UriTooLong: ClientError
    Definition Classes
    StatusCodes → StatusCodes
  50. def addRequestHeaders[A, H](currentRequest: Request[A], heads: RequestHeaders[H])(implicit tupler: Tupler[A, H]): Request[Out]
    Definition Classes
    EndpointsWithCustomErrors → Requests
  51. def addRequestQueryString[A, Q](request: Request[A], qs: QueryString[Q])(implicit tupler: Tupler[A, Q]): Request[Out]
    Definition Classes
    EndpointsWithCustomErrors → Requests
  52. def addResponseHeaders[A, H](response: Response[A], headers: ResponseHeaders[H])(implicit tupler: Tupler[A, H]): Response[Out]
    Definition Classes
    EndpointsWithCustomErrors → Responses
  53. final def badRequest[A, R](docs: Documentation, headers: ResponseHeaders[A])(implicit tupler: Tupler.Aux[ClientErrors, A, R]): Response[R]
    Definition Classes
    Responses
  54. implicit def booleanQueryString: QueryStringParam[Boolean]
    Definition Classes
    Urls
  55. def chainPaths[A, B](first: Path[A], second: Path[B])(implicit tupler: Tupler[A, B]): Path[Out]
    Definition Classes
    Urls → Urls
  56. def choiceRequestEntity[A, B](requestEntityA: Directive1[A], requestEntityB: Directive1[B]): Directive1[Either[A, B]]
    Definition Classes
    EndpointsWithCustomErrors → Requests
  57. def choiceResponse[A, B](responseA: Response[A], responseB: Response[B]): Response[Either[A, B]]
    Definition Classes
    EndpointsWithCustomErrors → Responses
  58. lazy val clientErrorsResponse: Response[ClientErrors]
    Definition Classes
    Errors
  59. def combineQueryStrings[A, B](first: QueryString[A], second: QueryString[B])(implicit tupler: Tupler[A, B]): QueryString[Out]
    Definition Classes
    Urls → Urls
  60. final def delete[UrlP, HeadersP, Out](url: Url[UrlP], docs: Documentation, headers: RequestHeaders[HeadersP])(implicit tuplerUH: Tupler.Aux[UrlP, HeadersP, Out]): Request[Out]
    Definition Classes
    Requests
  61. lazy val directive1InvFunctor: PartialInvariantFunctor[Directive1]
    Definition Classes
    EndpointsWithCustomErrors
  62. implicit def doubleQueryString: QueryStringParam[Double]
    Definition Classes
    Urls
  63. implicit def doubleSegment: Segment[Double]
    Definition Classes
    Urls
  64. def emptyRequest: RequestEntity[Unit]
    Definition Classes
    EndpointsWithCustomErrors → Requests
  65. def emptyRequestHeaders: RequestHeaders[Unit]
    Definition Classes
    EndpointsWithCustomErrors → Requests
  66. def emptyResponse: ResponseEntity[Unit]
    Definition Classes
    EndpointsWithCustomErrors → Responses
  67. def emptyResponseHeaders: ResponseHeaders[Unit]
    Definition Classes
    EndpointsWithCustomErrors → Responses
  68. def endpoint[A, B](request: Request[A], response: Response[B], docs: EndpointDocs = EndpointDocs()): Endpoint[A, B]
    Definition Classes
    EndpointsWithCustomErrors → EndpointsWithCustomErrors
  69. final def get[UrlP, HeadersP, Out](url: Url[UrlP], docs: Documentation, headers: RequestHeaders[HeadersP])(implicit tuplerUH: Tupler.Aux[UrlP, HeadersP, Out]): Request[Out]
    Definition Classes
    Requests
  70. def handleClientErrors(invalid: Invalid): StandardRoute

    This method is called by endpoints4s when decoding a request failed.

    This method is called by endpoints4s when decoding a request failed.

    The provided implementation calls clientErrorsResponse to complete with a response containing the errors.

    This method can be overridden to customize the error reporting logic.

    Definition Classes
    Urls
  71. def handleServerError(throwable: Throwable): StandardRoute

    This method is called by endpoints when an exception is thrown during request processing.

    This method is called by endpoints when an exception is thrown during request processing.

    The provided implementation uses serverErrorResponse to complete with a response containing the error message.

    This method can be overridden to customize the error reporting logic.

    Definition Classes
    EndpointsWithCustomErrors
  72. implicit def intQueryString: QueryStringParam[Int]
    Definition Classes
    Urls
  73. implicit def intSegment: Segment[Int]
    Definition Classes
    Urls
  74. final def internalServerError[A, R](docs: Documentation, headers: ResponseHeaders[A])(implicit tupler: Tupler.Aux[ServerError, A, R]): Response[R]
    Definition Classes
    Responses
  75. def jsonRequest[A](implicit decoder: Decoder[String, A]): RequestEntity[A]
    Definition Classes
    JsonEntitiesFromEncodersAndDecoders → JsonEntities
  76. def jsonResponse[A](implicit encoder: Encoder[A, String]): ResponseEntity[A]
    Definition Classes
    JsonEntitiesFromEncodersAndDecoders → JsonEntities
  77. implicit def longQueryString: QueryStringParam[Long]
    Definition Classes
    Urls
  78. implicit def longSegment: Segment[Long]
    Definition Classes
    Urls
  79. def mapEndpointDocs[A, B](endpoint: Endpoint[A, B], f: (EndpointDocs) => EndpointDocs): Endpoint[A, B]
    Definition Classes
    EndpointsWithCustomErrors → EndpointsWithCustomErrors
  80. def mapEndpointRequest[A, B, C](endpoint: Endpoint[A, B], f: (Request[A]) => Request[C]): Endpoint[C, B]
    Definition Classes
    EndpointsWithCustomErrors → EndpointsWithCustomErrors
  81. def mapEndpointResponse[A, B, C](endpoint: Endpoint[A, B], f: (Response[B]) => Response[C]): Endpoint[A, C]
    Definition Classes
    EndpointsWithCustomErrors → EndpointsWithCustomErrors
  82. final def ok[A, B, R](entity: ResponseEntity[A], docs: Documentation, headers: ResponseHeaders[B])(implicit tupler: Tupler.Aux[A, B, R]): Response[R]
    Definition Classes
    Responses
  83. def optQsWithDefault[A](name: String, default: A, docs: Documentation = None)(implicit value: QueryStringParam[A]): QueryString[WithDefault[A]]
    Definition Classes
    Urls → Urls
  84. def optRequestHeader(name: String, docs: Documentation): RequestHeaders[Option[String]]
    Definition Classes
    EndpointsWithCustomErrors → Requests
  85. def optResponseHeader(name: String, docs: Documentation = None): ResponseHeaders[Option[String]]
    Definition Classes
    EndpointsWithCustomErrors → Responses
  86. implicit def optionalQueryStringParam[A](implicit param: QueryStringParam[A]): QueryStringParam[Option[A]]
    Definition Classes
    Urls → Urls
  87. final def patch[UrlP, BodyP, HeadersP, UrlAndBodyPTupled, Out](url: Url[UrlP], entity: RequestEntity[BodyP], docs: Documentation, headers: RequestHeaders[HeadersP])(implicit tuplerUB: Tupler.Aux[UrlP, BodyP, UrlAndBodyPTupled], tuplerUBH: Tupler.Aux[UrlAndBodyPTupled, HeadersP, Out]): Request[Out]
    Definition Classes
    Requests
  88. val path: Path[Unit]
    Definition Classes
    Urls
  89. implicit lazy val pathPartialInvariantFunctor: PartialInvariantFunctor[Path]
    Definition Classes
    Urls → Urls
  90. final def post[UrlP, BodyP, HeadersP, UrlAndBodyPTupled, Out](url: Url[UrlP], entity: RequestEntity[BodyP], docs: Documentation, headers: RequestHeaders[HeadersP])(implicit tuplerUB: Tupler.Aux[UrlP, BodyP, UrlAndBodyPTupled], tuplerUBH: Tupler.Aux[UrlAndBodyPTupled, HeadersP, Out]): Request[Out]
    Definition Classes
    Requests
  91. final def put[UrlP, BodyP, HeadersP, UrlAndBodyPTupled, Out](url: Url[UrlP], entity: RequestEntity[BodyP], docs: Documentation, headers: RequestHeaders[HeadersP])(implicit tuplerUB: Tupler.Aux[UrlP, BodyP, UrlAndBodyPTupled], tuplerUBH: Tupler.Aux[UrlAndBodyPTupled, HeadersP, Out]): Request[Out]
    Definition Classes
    Requests
  92. def qs[A](name: String, docs: Documentation)(implicit param: QueryStringParam[A]): QueryString[A]
    Definition Classes
    Urls → Urls
  93. implicit lazy val queryStringParamPartialInvariantFunctor: PartialInvariantFunctor[QueryStringParam]
    Definition Classes
    Urls → Urls
  94. implicit lazy val queryStringPartialInvariantFunctor: PartialInvariantFunctor[QueryString]
    Definition Classes
    Urls → Urls
  95. def remainingSegments(name: String, docs: Documentation): Path[String]
    Definition Classes
    Urls → Urls
  96. implicit def repeatedQueryStringParam[A, CC[X] <: Iterable[X]](implicit param: QueryStringParam[A], factory: Factory[A, CC[A]]): QueryStringParam[CC[A]]
    Definition Classes
    Urls → Urls
  97. def request[A, B, C, AB, Out](method: Method, url: Url[A], entity: RequestEntity[B] = emptyRequest, docs: Documentation = None, headers: RequestHeaders[C] = emptyRequestHeaders)(implicit tuplerAB: Tupler.Aux[A, B, AB], tuplerABC: Tupler.Aux[AB, C, Out]): Request[Out]
    Definition Classes
    EndpointsWithCustomErrors → Requests
  98. implicit lazy val requestEntityPartialInvariantFunctor: PartialInvariantFunctor[RequestEntity]
    Definition Classes
    EndpointsWithCustomErrors → Requests
  99. def requestHeader(name: String, docs: Documentation): RequestHeaders[String]
    Definition Classes
    EndpointsWithCustomErrors → Requests
  100. implicit lazy val requestHeadersPartialInvariantFunctor: PartialInvariantFunctor[RequestHeaders]
    Definition Classes
    EndpointsWithCustomErrors → Requests
  101. implicit lazy val requestHeadersSemigroupal: Semigroupal[RequestHeaders]
    Definition Classes
    EndpointsWithCustomErrors → Requests
  102. implicit def requestPartialInvariantFunctor: PartialInvariantFunctor[Request]
    Definition Classes
    EndpointsWithCustomErrors → Requests
  103. def response[A, B, R](statusCode: StatusCode, entity: ResponseEntity[A], docs: Documentation = None, headers: ResponseHeaders[B] = emptyResponseHeaders)(implicit tupler: Tupler.Aux[A, B, R]): Response[R]
    Definition Classes
    EndpointsWithCustomErrors → Responses
  104. implicit lazy val responseEntityInvariantFunctor: InvariantFunctor[ResponseEntity]
    Definition Classes
    EndpointsWithCustomErrors → Responses
  105. def responseHeader(name: String, docs: Documentation = None): ResponseHeaders[String]
    Definition Classes
    EndpointsWithCustomErrors → Responses
  106. implicit def responseHeadersInvariantFunctor: InvariantFunctor[ResponseHeaders]
    Definition Classes
    EndpointsWithCustomErrors → Responses
  107. implicit def responseHeadersSemigroupal: Semigroupal[ResponseHeaders]
    Definition Classes
    EndpointsWithCustomErrors → Responses
  108. implicit lazy val responseInvariantFunctor: InvariantFunctor[Response]
    Definition Classes
    EndpointsWithCustomErrors → Responses
  109. def segment[A](name: String, docs: Documentation)(implicit s: Segment[A]): Path[A]
    Definition Classes
    Urls → Urls
  110. implicit lazy val segmentPartialInvariantFunctor: PartialInvariantFunctor[Segment]
    Definition Classes
    Urls → Urls
  111. lazy val serverErrorResponse: Response[ServerError]
    Definition Classes
    Errors
  112. def staticPathSegment(segment: String): Path[Unit]
    Definition Classes
    Urls → Urls
  113. implicit lazy val stringQueryString: QueryStringParam[String]
    Definition Classes
    Urls → Urls
  114. implicit def stringSegment: Segment[String]
    Definition Classes
    Urls → Urls
  115. def textRequest: RequestEntity[String]
    Definition Classes
    EndpointsWithCustomErrors → Requests
  116. def textResponse: ResponseEntity[String]
    Definition Classes
    EndpointsWithCustomErrors → Responses
  117. implicit lazy val urlPartialInvariantFunctor: PartialInvariantFunctor[Url]
    Definition Classes
    Urls → Urls
  118. def urlWithQueryString[A, B](path: Path[A], qs: QueryString[B])(implicit tupler: Tupler[A, B]): Url[Out]
    Definition Classes
    Urls → Urls
  119. implicit def uuidQueryString: QueryStringParam[UUID]
    Definition Classes
    Urls
  120. implicit def uuidSegment: Segment[UUID]
    Definition Classes
    Urls
  121. final def wheneverFound[A](responseA: Response[A], notFoundDocs: Documentation): Response[Option[A]]
    Definition Classes
    Responses
  122. object EndpointDocs extends Serializable
    Definition Classes
    EndpointsWithCustomErrors