Quantcast
Channel: Apache Timeline
Viewing all articles
Browse latest Browse all 5648

Explicit Values for Enums

$
0
0
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

Viewing all articles
Browse latest Browse all 5648

Trending Articles