AvroVulcan

dev.constructive.eo.avro.vulcan.AvroVulcan
object AvroVulcan

vulcan → eo bridge: derive an AvroCodec from a vulcan.Codec (issue #73).

Every typed entry point in eo-avro — codecPrism[A], AvroPrism.field / widenPath*, AvroTraversal, the AvroJson diagonals — is keyed on eo's own AvroCodec evidence. A codebase whose codecs are vulcan gets in through this bridge instead of hand-writing the same four-line adapter per use site:

import dev.constructive.eo.avro.vulcan.given   // every vulcan.Codec[A] now serves as AvroCodec[A]

val p = codecPrism[ClickInfo].field(_.entities) // summons through the bridge

or, named and explicit, given AvroCodec[ClickInfo] = AvroVulcan.codec.

Error mapping — vulcan is Either-typed where eo is total or Throwable-typed:

  • schema is resolved ONCE at construction and throws vulcan's own AvroError.throwable if invalid — fail fast: an invalid schema is a codec-definition bug, not a per-record condition, and eo treats schemas as static.
  • encode throws on error for the same reason (eo's encode(a: A): Any is total; an encode failure under a matching schema is a definition bug).
  • decode errors surface as Left via AvroError.throwable, matching AvroCodec's structured-failure convention.

vulcan rides on cats-eo-avro as an Optional dependency (the AvroJson / circe pattern): this sub-package's API surface names vulcan.Codec, so any caller already depends on vulcan directly — Optional keeps it off downstream classpaths, and avro-only users never load these classfiles.

Attributes

Source
AvroVulcan.scala
Graph
Supertypes
class Object
trait Matchable
class Any
Self type
AvroVulcan.type

Members list

Value members

Concrete methods

def codec[A](using c: Codec[A]): AvroCodec[A]

Bridge the in-scope vulcan.Codec[A] into an AvroCodec[A]. Throws at construction if the vulcan schema is invalid (see the object docs for the full error mapping).

Bridge the in-scope vulcan.Codec[A] into an AvroCodec[A]. Throws at construction if the vulcan schema is invalid (see the object docs for the full error mapping).

Attributes

Source
AvroVulcan.scala