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 Objecttrait Matchableclass Any