Git Product home page Git Product logo

Comments (4)

julianpeeters avatar julianpeeters commented on September 26, 2024

Yes.

I see

public static final org.apache.avro.Schema SCHEMA$ = new org.apache.avro.Schema.Parser().parse(" ... 

With respect to naming, do you prefer schema to SCHEMA$?

With respect to timing, maybe tonight.

I don't mean to steal your fun! The fix for issue #1 gets us almost all the way there. The hard parts were:

  1. what does a companion object definition look like when it is extracted/decomposed into its AST (err, into the quasiquote representation of its AST)
  2. where to splice in such a definition

This ought to do the trick, pattern match in an annotated class and emit an updated class and companion object:

q"""$mods class $name[..$tparams](..$first)(...$rest) extends ..$newParents { $self => ..$newBody };
              object ${newTermName(name.toString)} { $newVal }""" 

from avro-scala-macro-annotations.

zcox avatar zcox commented on September 26, 2024

@julianpeeters awesome, glad this can be fixed! I'm pretty much indifferent on naming of the companion object schema field, although the Scala style guide says "Constant names should be in upper camel case" so maybe it should be named Schema?

from avro-scala-macro-annotations.

julianpeeters avatar julianpeeters commented on September 26, 2024

Sorry for any trouble this has caused you.

Does version 0.7 solve your issues? (Now up at Sontatype, syncing with Maven Central soon)

Was kinda locked into using "SCHEMA$" already, so without a strong objection, there it is, '$' in the name and all 🎱

from avro-scala-macro-annotations.

zcox avatar zcox commented on September 26, 2024

Just tested this out in 0.7 with the kafka schema registry - works great! Thanks a bunch for fixing this so quickly! 💯

from avro-scala-macro-annotations.

Related Issues (20)

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.