[ 
https://issues.apache.org/jira/browse/AVRO-3968?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17834711#comment-17834711
 ] 

Henry Fernandes commented on AVRO-3968:
---------------------------------------

Thanks [~opwvhk]  for your response.

Yes extending @AvroName annotation functionality to also allow to specify the 
namespace would work as well based on your description.

The only consideration over here is regarding the point,

{color:#403294}{{@AvroName(value="fieldName", namespace="my.space")}} on a 
field would trigger an error: fields have no namespace{color}

{color:#172b4d}From what I understand, the expectation here would be to throw a 
runtime exception when users apply this annotation over the field.{color}

{color:#172b4d}Instead if we create a different class level annotation (happy 
to go with @AvroTypeName), it would not even allow users to apply this 
annotation at field level.{color}

{color:#172b4d}It would be better to give compile time error rather than 
runtime error.{color}

> Support for custom @AvroNamespace annotation 
> ---------------------------------------------
>
>                 Key: AVRO-3968
>                 URL: https://issues.apache.org/jira/browse/AVRO-3968
>             Project: Apache Avro
>          Issue Type: Wish
>            Reporter: Henry Fernandes
>            Priority: Major
>
> Currently there are several java annotations like @AvroSchema, @AvroName, 
> @AvroDoc etc that can be used to decorate Java POJO classes which in turn are 
> used when generating avro schema with reflection.
> While @AvroName annotation comes handy for overriding the name of fields, 
> there is no support for overriding the namespace.
>  
> Currently by default the java POJO's package name is used as the namespace. 
> This is a bit restrictive as there can be cases where we may want to generate 
> the schema with a different namespace.
>  
> The ask over here is to provide a @AvroNamespace annotation that can let us 
> override the namespace to what we intend to.
>  
> Happy to contribute with a PR for the same.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to