Uploaded image for project: 'Apache Avro'
  1. Apache Avro
  2. AVRO-2750

Support for enum defaults in c#

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Resolved
    • Minor
    • Resolution: Fixed
    • 1.9.2
    • 1.10.1
    • csharp
    • None
    • Added support for enum defaults in the C# bindings.

    Description

      C# needs to support default enum values as referenced in the 1.9.2 version of the Avro specification.

      For example:

      {
        "type": "enum",
        "name": "Test",
        "symbols": [
          "Unknown",
          "A",
          "B"
        ],
        "default": "Unknown"
      }
      

      With the schema provided above, the "Unknown" token should be the value when a value is passed that is not listed in the symbols.

       

      Requirements:

      1. The default token must exist in the list of symbols when parsing the schema.
      2. When setting the value of the GenericEnum, check if the default is set, and if it is use it if the desired value is not in the symbol map.
      3. Codegen should assign the default symbol to the field by default
      4. The existing behavior should not change if a default is not specified

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              mkellogg Matthew Kellogg
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: