ZTemporalCodec

zio.temporal.json.ZTemporalCodec
See theZTemporalCodec companion object
trait ZTemporalCodec[A]

Evidence that a value of type A can be serialized to / deserialized from JSON for crossing a Temporal boundary (workflow/activity/signal/query arguments and results).

The presence of a ZTemporalCodec[A] is enforced at compile time by zio-temporal's macros wherever a Temporal interaction is performed. This replaces the previous Jackson-based runtime reflection, which silently emitted malformed JSON when Scala-aware modules were not registered.

Provide a ZTemporalCodec[A] by placing a given JsonEncoder[A] + JsonDecoder[A] (or a JsonCodec[A]) in A's companion object. For case classes and sealed traits, the simplest forms are

 final case class Foo(x: Int, y: String) derives ZTemporalCodec

 // or, if you'd rather derive zio-json directly and let the bridges pick it up:
 final case class Foo(x: Int, y: String) derives JsonCodec

which derives zio-json encoder/decoder and wraps them in a ZTemporalCodec.

The typeclass carries (in addition to the encoder and decoder) a java.lang.Class and a java.lang.reflect.Type, so the underlying Temporal Java SDK can dispatch on generic types such as List[Foo] vs. List[Bar].

Attributes

Companion
object
Graph
Supertypes
class Object
trait Matchable
class Any

Members list

Value members

Abstract methods

def decoder: JsonDecoder[A]

Decoder used to deserialize values of A from JSON.

Decoder used to deserialize values of A from JSON.

Attributes

def encoder: JsonEncoder[A]

Encoder used to serialize values of A to JSON.

Encoder used to serialize values of A to JSON.

Attributes

def genericType: Type

Fully-qualified generic type used to index the registry on the decode path. For ground types this equals klass. For generic types it is a ParameterizedType carrying the type-argument tree.

Fully-qualified generic type used to index the registry on the decode path. For ground types this equals klass. For generic types it is a ParameterizedType carrying the type-argument tree.

Attributes

def klass: Class[A]

Runtime class used to index the registry on the encode path (Temporal hands us only v.getClass) and as the value-class argument to Temporal's getResultAsync/query/execute APIs.

Runtime class used to index the registry on the encode path (Temporal hands us only v.getClass) and as the value-class argument to Temporal's getResultAsync/query/execute APIs.

Attributes