Skip to content

Fezziwig is a library for compile time generation of Circe encoders/decoders for Scrooge-generated classes representing Thrift objects.

License

Notifications You must be signed in to change notification settings

guardian/fezziwig

Repository files navigation

Fezziwig

fezziwig Scala version support Release

Fezziwig, named for the character from A Christmas Carol, is a library for compile time generation of Circe encoders/decoders for Scrooge-generated classes representing Thrift objects.

Installation

libraryDependencies ++= Seq(
  "com.gu" %% "fezziwig" % "2.0.0"
)

Usage

To use the library, import the macros and use circe’s semiauto derivation. (Automatic derivation is no longer supported, as of v2.0.0.)

import io.circe.generic.semiauto.__
import com.gu.fezziwig.CirceScroogeMacros._
import com.gu.fezziwig.CirceScroogeWhiteboxMacros._

implicit val exampleStructEncoder: Encoder[ExampleStruct] = deriveEncoder
implicit val exampleStructDecoder: Decoder[ExampleStruct] = deriveDecoder

The generated decoders support accumulation of errors, e.g.

val result = exampleStructDecoder.accumulating(json.hcursor)

About

Fezziwig is a library for compile time generation of Circe encoders/decoders for Scrooge-generated classes representing Thrift objects.

Topics

Resources

License

Code of conduct

Stars

Watchers

Forks

Packages

No packages published