iemejia opened a new pull request, #3949:
URL: https://github.com/apache/avro/pull/3949

   ## What
   
   AVRO-4314 added Avro name-grammar validation for record/fixed/enum names, 
field names and aliases, and message names. This closes two parse-time paths it 
left unvalidated, which are then emitted verbatim as identifiers by the C# code 
generator:
   
   1. **Enum symbols read from JSON** — `EnumSchema.NewInstance` only checked 
for duplicates and never called `ValidateSymbolName` (that ran only on the 
programmatic `Create()` path). An out-of-spec symbol (leading digit, space, 
punctuation, …) was carried through and spliced as an enum member identifier by 
the generator.
   2. **Protocol names** — `Protocol.Parse` never validated the protocol name, 
which is emitted as generated class names.
   
   ## Fix
   
   - `EnumSchema.NewInstance`: call `ValidateSymbolName` on each symbol, 
surfacing a `SchemaParseException` with the JSON path (consistent with the 
neighbouring duplicate-symbol error).
   - `Protocol.Parse`: validate the protocol name via 
`SchemaName.ValidateName(name, "protocol")`, surfacing a 
`ProtocolParseException` (consistent with how message-name validation is 
surfaced in `Message.Parse`).
   
   ## Tests
   
   Adds `TestBasic` cases for out-of-spec enum symbols (leading digit / space / 
hyphen) and a `TestInvalidProtocolName` case set (leading digit / space / 
injection-style name). Full C# suite passes (**1533 tests**, 0 failures).
   
   JIRA: https://issues.apache.org/jira/browse/AVRO-4346


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to