You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@avro.apache.org by si...@vonos.net on 2022/10/12 14:56:46 UTC

Proposed enhancement: configure mapping of AVRO namespace to Java packagename

Hi All,

My employer is (very happily) using avro-maven-plugin in many projects. 
However we would like to be able to control the packagenames for Java 
classes generated from AVRO schemas (ie not just have 
packagename=schemanamespace). I have already implemented this, and it is 
not particularly complicated.

Would it be ok if I raise a ticket, and post the patch?

Thanks & Regards,
Simon

Re: Proposed enhancement: configure mapping of AVRO namespace to Java packagename

Posted by Simon Kitching <si...@willhaben.at>.
Thanks for the reply.


I have created ticket AVRO-3638 and pull-request: https://github.com/apache/avro/pull/1908/commits/daea88043247a161b1b273f52ee20d46f89b8e63


Regarding your comment:


> here's a couple of places in the Java code where we create new instances of records (for example) by looking whether an Avro namespace and name -> Java package and class exist.


Yes, that could be an issue. I haven't noticed any problems when running the patched plugin against our schemas, but of course that doesn't cover all use-cases. Can you suggest how I could find such places in the codebase?


Regards, Simon

________________________________
From: Ryan Skraba <ry...@skraba.com>
Sent: Thursday, October 13, 2022 12:43:54 PM
To: dev@avro.apache.org
Subject: Re: Proposed enhancement: configure mapping of AVRO namespace to Java packagename

This sounds like a neat feature -- there's a couple of places in the
Java code where we create new instances of records (for example) by
looking whether an Avro namespace and name -> Java package and class
exist.  Do you think this might be a complication?

Regardless, having this feature wouldn't affect interoperability
between languages or versions, and it's optional, so I don't think it
would be any problem.

There's some documentation at
https://urldefense.com/v3/__https://avro.apache.org/project/how-to-contribute/__;!!JH4u34rfOXatKw!51fX-M-8V_Nb2QIVlxlQX8ohaPzuyrekOu8oDbxTYx3ONnHWybF8WMCq4wxINbYH2wlvrTz8qO_xW7prL-Hr$ , but yes, please
submit a PR and not a patch :D

All my best, Ryan

On Wed, Oct 12, 2022 at 9:56 PM Martin Grigorov <mg...@apache.org> wrote:
>
> Hi Simon,
>
> On Wed, Oct 12, 2022, 18:17 <si...@vonos.net> wrote:
>
> > Hi All,
> >
> > My employer is (very happily) using avro-maven-plugin in many projects.
> > However we would like to be able to control the packagenames for Java
> > classes generated from AVRO schemas (ie not just have
> > packagename=schemanamespace). I have already implemented this, and it is
> > not particularly complicated.
> >
> > Would it be ok if I raise a ticket, and post the patch?
> >
>
> Sure!
> Please create a Pull Request at GitHub instead of attaching a patch to the
> ticket.
>
> Martin
>
>
> > Thanks & Regards,
> > Simon
> >

Re: Proposed enhancement: configure mapping of AVRO namespace to Java packagename

Posted by Ryan Skraba <ry...@skraba.com>.
This sounds like a neat feature -- there's a couple of places in the
Java code where we create new instances of records (for example) by
looking whether an Avro namespace and name -> Java package and class
exist.  Do you think this might be a complication?

Regardless, having this feature wouldn't affect interoperability
between languages or versions, and it's optional, so I don't think it
would be any problem.

There's some documentation at
https://avro.apache.org/project/how-to-contribute/, but yes, please
submit a PR and not a patch :D

All my best, Ryan

On Wed, Oct 12, 2022 at 9:56 PM Martin Grigorov <mg...@apache.org> wrote:
>
> Hi Simon,
>
> On Wed, Oct 12, 2022, 18:17 <si...@vonos.net> wrote:
>
> > Hi All,
> >
> > My employer is (very happily) using avro-maven-plugin in many projects.
> > However we would like to be able to control the packagenames for Java
> > classes generated from AVRO schemas (ie not just have
> > packagename=schemanamespace). I have already implemented this, and it is
> > not particularly complicated.
> >
> > Would it be ok if I raise a ticket, and post the patch?
> >
>
> Sure!
> Please create a Pull Request at GitHub instead of attaching a patch to the
> ticket.
>
> Martin
>
>
> > Thanks & Regards,
> > Simon
> >

Re: Proposed enhancement: configure mapping of AVRO namespace to Java packagename

Posted by Martin Grigorov <mg...@apache.org>.
Hi Simon,

On Wed, Oct 12, 2022, 18:17 <si...@vonos.net> wrote:

> Hi All,
>
> My employer is (very happily) using avro-maven-plugin in many projects.
> However we would like to be able to control the packagenames for Java
> classes generated from AVRO schemas (ie not just have
> packagename=schemanamespace). I have already implemented this, and it is
> not particularly complicated.
>
> Would it be ok if I raise a ticket, and post the patch?
>

Sure!
Please create a Pull Request at GitHub instead of attaching a patch to the
ticket.

Martin


> Thanks & Regards,
> Simon
>