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

ASF GitHub Bot commented on AVRO-2115:
--------------------------------------

GitHub user elmendavies opened a pull request:

    https://github.com/apache/avro/pull/268

    AVRO-2115

    This patch is to allow defining unions in members when using the reflect 
API (which was supposed to be supported). This is an example (note the @Union 
used in a member):
    
    ```
    class MyDatum {
       @Union({Void.class, String.class, Long.class, Other.class,...})
       Object o;
    }
    ```
    
    There are also a correction and some minor changes in the reflect API docs 
to make it more clear to understand. 


You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/elmendavies/avro AVRO-2115

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/avro/pull/268.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #268
    
----
commit c412267d1d32ab10a929f189cb53cfb3cc619300
Author: Miguel Martinez-Espronceda <[email protected]>
Date:   2017-12-13T10:19:15Z

    AVRO-2115: Control commit.

commit 164ee588cf822588df2c877f07ba03cb1a4a9482
Author: Miguel Martinez-Espronceda <[email protected]>
Date:   2017-12-14T09:12:47Z

    AVRO-2115: Added test for Void in union.

commit 53a9af762acbfdc734a3cadf7d3c6d8736e1ec61
Author: Miguel Martinez-Espronceda <[email protected]>
Date:   2017-12-15T08:39:13Z

    AVRO-2115: Added documentation.

----


> Support @Union in members too
> -----------------------------
>
>                 Key: AVRO-2115
>                 URL: https://issues.apache.org/jira/browse/AVRO-2115
>             Project: Avro
>          Issue Type: Improvement
>            Reporter: Miguel
>            Priority: Minor
>
> Allow defining unions in members:
> {code:java}
> class MyDatum {
>    @Nullable
>    @Union({String.class, Long.class, Other.class,...})
>    Object o;
> }
> {code}
> It can currently be implemented using @AvroSchema like this, but it is seems 
> in my oppinion more verbose and more difficult to maintain:
> {code:java}
> @AvroSchema("[\"null\",\"string\",...")
> {code}



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

Reply via email to