Ismaël Mejía created AVRO-4346:
----------------------------------
Summary: [csharp] Validate enum symbols and protocol names against
the Avro name grammar at parse time
Key: AVRO-4346
URL: https://issues.apache.org/jira/browse/AVRO-4346
Project: Apache Avro
Issue Type: Bug
Components: csharp
Reporter: Ismaël Mejía
Fix For: 1.13.0
AVRO-4314 added Avro name-grammar validation for record/fixed/enum names, field
names and aliases, and message names. Two paths remain unvalidated:
* *Enum symbols read from JSON*: {{EnumSchema.NewInstance}} only checks for
duplicate symbols and does not call {{ValidateSymbolName}} (that runs only on
the programmatic {{Create()}} factory). Symbols are then emitted directly as
enum member identifiers by the generator (around {{CodeGen.cs}}:499), so an
out-of-spec symbol (spaces, punctuation, leading digit, ...) produces
malformed
generated C#.
* *Protocol names*: {{Protocol.Parse}} and the {{Protocol}} constructor never
call {{ValidateName}}; the protocol name is emitted as generated class names
({{CodeGen.cs}}:522 and :603), so an out-of-spec protocol name produces
malformed source.
Validate enum symbols (on the JSON parse path) and protocol names against the
Avro name grammar at parse time, matching the Java SDK, and add tests covering
rejection of out-of-spec values.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)