julianpeeters / avrohugger

Generate Scala case class definitions from Avro schemas
Apache License 2.0
201 stars 120 forks source link

Support for @JsonCreator() #66

Open spdrnl opened 7 years ago

spdrnl commented 7 years ago

Would it be possible to add support for @JsonCreator() in the code generation of specific records? This would allow for example to let Jackson map Json to the generated classes whilst honoring optionals.

The resulting code would look like:


...
import com.fasterxml.jackson.annotation.JsonCreator
...

case class MyPropertyRecord @JsonCreator() (var propertyName: String, var tenantName: String) extends org.apache.avro.specific.SpecificRecordBase {

...
julianpeeters commented 7 years ago

sorry @spdrnl, I wouldn't be able to justify adding a feature to support only one library.

spdrnl commented 7 years ago

Hi Julian, thanks for your reply!

O.k., I understand. The intention was to make it an option that could be switched on for Jackson; not to generate it always. I am still in the process to exactly figure out the necessities, there might be some apart from JsonCreator