avro-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From William McKenzie <wsmck...@cartewright.com>
Subject Explicit Values for Enums
Date Sun, 02 Jun 2013 20:35:52 GMT
I did a few searches on Jira and couldn't find anything it, so apologies if
this has been requested previously.

It seems like it would be useful to allow an explicit value for enumeration
members. I suppose the biggest argument against it would be that might have
to be a breaking change to the schemas, since the current list of values is
just an array of strings, but maybe it could be added as an optional schema
field which would override the implicit sequential numbering.

// Maybe?
{
     "type": "enum",
     "name": "Roles",
     "symbols": [ "Producer", "Consumer" ]
     "values": [ 100, 101 ]
}

// This is just too ugly
{
     "type": "enum",
     "name": "Roles",
     "symbols": [ "Producer=100", "Consumer=101" ]
}

// Alternating strings and values? still pretty ugly.
{
     "type": "enum",
     "name": "Roles",
     "symbols": [ "Producer", 100,  "Consumer", 101 ]
}

~Bill

Mime
View raw message