Skip to content

[Feature request] Nullable properties in generated code #327

Closed Answered by dstelljes
petrkoutnycz asked this question in Q&A
Discussion options

You must be logged in to vote

You can use the --nullable-references flag (https://engineering.chrobinson.com/dotnet-avro/cli/generate/#options):

dotnet avro generate --nullable-references <<EOF
{
    "type": "record",
    "name": "Example",
    "fields": [
        {
            "name": "Nullable",
            "type": ["null", "string"]
        }
    ]
}
EOF
public class Example
{
    public string? Nullable { get; set; }
}

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Answer selected by petrkoutnycz
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants
Converted from issue

This discussion was converted from issue #326 on December 05, 2024 20:21.