On wed 11 okt. 2023 17:24, Gustavo Monarin <gustavomona...@gmail.com> wrote:

> Sometimes is usefull to give a contextual information to a field.
>
> Other protocols like protobuf support annotations through what they call
> Option <https://protobuf.dev/programming-guides/proto3/#customoptions>
> which allows the following customization (uuid field annotation):
>
>
> ```
> message FarmerRegisteredEvent {
>
>   string uuid = 1[(pi2schema.subject_identifier) = true];
>
>   oneof personalData {
>     ContactInfo contactInfo = 2;
>     pi2schema.EncryptedPersonalData encryptedPersonalData = 6;
>   }
>
>   google.protobuf.Timestamp registeredAt = 4;
>   string referrer = 5;
>
> }
> ```
>
> Would it be possible to add such metadata information in an avro schema?
>
Yes. On schemata, fields and messages, you an add any property other than
the standard ones (like 'name', 'doc', etc.) with any json value as value.

As far as Avro is concerned these are ignored, but you can use them in your
code.

Sometimes you want more though, and for that there are logical types and
(for Java code generation) the 'javaAnnotation' property.

Kind regards,
Oscar

-- 
Oscar Westra van Holthe - Kind <os...@westravanholthe.nl>

Reply via email to