package circe
Ordering
- Grouped
- Alphabetic
Visibility
- Public
- Protected
Type Members
- trait CirceCodec[A] extends AnyRef
Combines both an io.circe.Encoder and a io.circe.Decoder into a single type class.
Combines both an io.circe.Encoder and a io.circe.Decoder into a single type class.
You don’t need to define instances by yourself as they can be derived from an existing pair of an io.circe.Encoder and a io.circe.Decoder.
- See also
https://github.com/travisbrown/circe/issues/301
- trait JsonEntitiesFromCodecs extends algebra.JsonEntitiesFromCodecs
Partial interpreter for endpoints4s.algebra.JsonEntitiesFromCodecs that only fixes the
JsonCodec[A]
type to a CirceCodec.Partial interpreter for endpoints4s.algebra.JsonEntitiesFromCodecs that only fixes the
JsonCodec[A]
type to a CirceCodec.The
jsonRequest
andjsonResponse
operations have to be implemented by a more specialized interpreter.Typical usage:
/* shared MyDto.scala */ case class MyDto(i: Int, s: String) object MyDto { import io.circe.{Encoder, Decoder} import io.circe.generic.semiauto.{deriveEncoder, deriveDecoder} implicit val encoder: Encoder[MyDto] = deriveEncoder implicit val decoder: Decoder[MyDto] = deriveDecoder }
/* shared endpoint definition */ trait MyEndpoints extends algebra.Endpoints with algebra.circe.JsonEntitiesFromCodec { val myEndpoint = endpoint(get(path), jsonResponse[MyDto]) }
/* client MyEndpointsClient.scala */ object MyEndpointsClient extends MyEndpoints with xhr.JsonEntitiesFromCodec with xhr.faithful.Endpoints MyEndpointsClient.myEndpoint().map(myDto => println(myDto.i))
/* server MyEndpointsServer.scala */ object MyEndpointsServer extends MyEndpoints with play.server.JsonEntitiesFromCodec { val routes = routesFromEndpoints( myEndpoint.implementedBy(_ => MyDto(42, "foo")) ) }
Value Members
- object CirceCodec