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

[jira] [Updated] (AVRO-3257) IDL: add syntax to create optional fields

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

Ryan Skraba updated AVRO-3257:
------------------------------
    Resolution: Fixed
        Status: Resolved  (was: Patch Available)

Cherry-picked to [branch-1.11|https://github.com/apache/avro/commit/8c33103c24b20aa2b107f1057b4d22b5111fad42].  Thanks again for this improvement!

> IDL: add syntax to create optional fields
> -----------------------------------------
>
>                 Key: AVRO-3257
>                 URL: https://issues.apache.org/jira/browse/AVRO-3257
>             Project: Apache Avro
>          Issue Type: Improvement
>          Components: java, spec
>            Reporter: Oscar Westra van Holthe - Kind
>            Assignee: Oscar Westra van Holthe - Kind
>            Priority: Minor
>              Labels: javacc, pull-request-available
>             Fix For: 1.11.1
>
>          Time Spent: 3h 40m
>  Remaining Estimate: 0h
>
> To define optional values, Avro has the "union with the null type" construction.
> In IDL, this is a rather verbose construct:
> {code}
> union {null, string} optionalName = null;
> {code}
> Wish: add Kotlin style optional types like this:
> {code}
> string? optionalName = null;
> {code}
> The resulting schema should be identical; it's only a syntax change.
> Note: it would be nice (but not required) if the syntax would also work if the default value is not null:
> {code}
> string? optionalName = "Jane Doe";
> {code}



--
This message was sent by Atlassian Jira
(v8.20.1#820001)