You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@avro.apache.org by "Ryan Skraba (Jira)" <ji...@apache.org> on 2023/05/10 17:32:00 UTC

[jira] [Resolved] (AVRO-3644) [JAVA] Support java.util.Optional in reflect package

     [ https://issues.apache.org/jira/browse/AVRO-3644?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Ryan Skraba resolved AVRO-3644.
-------------------------------
    Resolution: Fixed

> [JAVA] Support java.util.Optional in reflect package
> ----------------------------------------------------
>
>                 Key: AVRO-3644
>                 URL: https://issues.apache.org/jira/browse/AVRO-3644
>             Project: Apache Avro
>          Issue Type: Improvement
>          Components: java
>            Reporter: Daniel Heinrich
>            Assignee: Daniel Heinrich
>            Priority: Trivial
>              Labels: pull-request-available
>             Fix For: 1.12.0
>
>          Time Spent: 0.5h
>  Remaining Estimate: 0h
>
> java.util.Optional can currently not be used at all when using reflection based schemas.
> _org.apache.avro.reflect.ReflectData#getSchema_ will currently produce the following type for fields using Optional:
> {"type":"record","name":"Optional","namespace":"java.util","fields":[]}
> The generated schema is completly unusable (it does not contain any data). I would like to propose to map Optional fields as if they were not using Optional and would be annotated with @Nullable. So resulting in the following type:
> ["null","something"]



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