[ 
https://issues.apache.org/jira/browse/AVRO-1725?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15057963#comment-15057963
 ] 

Martin Kleppmann commented on AVRO-1725:
----------------------------------------

[The spec|http://avro.apache.org/docs/1.7.7/spec.html#Enums] only says that 
symbols of an enum must be unique; it doesn't say that they have to conform to 
any particular naming pattern (unlike the names of types). I noticed this while 
looking at the C implementation (which allows arbitrary strings as symbols).

I guess for compatibility with Java code generation it might be appropriate to 
restrict enum symbols in the same way as type names are restricted, but if we 
do so, we should update the spec accordingly.

> Enum schema exhibits same restriction to enum symbols as to names
> -----------------------------------------------------------------
>
>                 Key: AVRO-1725
>                 URL: https://issues.apache.org/jira/browse/AVRO-1725
>             Project: Avro
>          Issue Type: Bug
>          Components: java
>    Affects Versions: 1.7.7
>            Reporter: Nikita Makeev
>
> EnumSchema class in org.apache.avro.Schema has the following code:
> for (String symbol : symbols)
>         if (ordinals.put(validateName(symbol), i++) != null)
> which validates enum symbols using validateName() which makes impossible to 
> use symbols that are not conforming to standard for real names. 
> That prohibits using of symbols like "" (empty string) or anything starting 
> with number which does not seem to be intended.
> I guess this place requires either some another type of validation or no 
> validation at all. Can provide a patch for both cases.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to