Giter Club home page Giter Club logo

fezziwig's Introduction

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)

fezziwig's People

Contributors

apakulov avatar davidfurey avatar divs-b avatar emdash-ie avatar fweddi avatar gu-scala-library-release[bot] avatar jfsoul avatar johnduffell avatar mchv avatar novembertang avatar paulmr avatar philmcmahon avatar rowannekabalan avatar rtyley avatar tomrf1 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

fezziwig's Issues

Check references to master

The master branch of this repository has been migrated to main using the master-to-main tool.

Some files in the repository contain the word master. Please check the following files and update where required:

Update other build configuration

The master branch of this repository has been migrated to main using the master-to-main tool.

Please check any build related configuration and update as required:

  • TeamCity - See the required steps in the migrating.md document
  • Change snyk github integration(s) - it uses the default branch, but you will need to delete and reimport the project+file as this is the only way to refresh the default branch at present.
  • Any other externally configured analysis tooling your team is using e.g. travis CI

It's probably a good idea to merge test PR to main once this is complete, to make sure that everything is working as expected. 🙂

Support thrift maps

The map type is not currently supported. In content-api-models we have custom encoders/decoders to work around this.

Ordinarily circe is able to provide encoders/decoders for scala maps. But I haven't been able to get this library's macros to infer implicits.

The macros use shapeless' Lazy to find implicit encoders/decoders for nested types where the compiler has given up due to implicit divergence. But for maps even this fails, presumably because it has two type parameters. There must be some shapeless magic we can do to fix this.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.