[
https://issues.apache.org/jira/browse/AVRO-3968?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17834679#comment-17834679
]
Oscar Westra van Holthe - Kind commented on AVRO-3968:
------------------------------------------------------
Though I appreciate the request for an {{@AvroNamespace}} annotation, I'd
prefer to extend the applicability of the {{@AvroName}} annotation to include
classes.
This would work as follows:
# {{@AvroName("fieldName")}} on a field would name the field only (this is the
current situation)
# {{@AvroName(value="fieldName", namespace="my.space")}} on a field would
trigger an error: fields have no namespace
# Using {{@AvroName}} on a class that does not become a named type would
trigger an error
# {{@AvroName("simpleOrFullName")}} for a named type would set its name,
optionally with namespace
# {{@AvroName(value="simpleName", namespace="my.space")}} for a named type
would set its name and namespace
# {{@AvroName(namespace="my.space")}} for a named type would set only the
namespace and let the name be inferred
Would this work for you as well? Or would an {{@AvroTypeName}} be a better
annotation for types?
> 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)