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

   ## What is the purpose of the change
   
   Record/fixed/enum names, record field names and protocol message names were
   accepted verbatim when parsing, unlike enum symbols which were already
   validated. Because the code generator splices some of these values directly
   into generated C# source (for example protocol message names into a `case`
   label and field names into `Get`/`Put` switch bodies), an out-of-spec name
   produced malformed or unexpected generated code.
   
   This change adds a shared, Unicode-aware name validator (first character a
   letter or `_`, remaining characters letters, digits or `_`) and applies it to
   schema names, field names and message names during parsing.
   
   Notes:
   - The rule is Unicode-aware to preserve the existing support for non-ASCII
     names (e.g. the `TestRecordFieldNames` case).
   - Namespaces are intentionally not validated, because the code generator's
     namespace-mapping feature rewrites them to C#-specific values (such as
     `@return` for reserved words) and re-parses the schema.
   
   ## Verifying this change
   
   This change added tests and can be verified as follows:
   
   - Added negative cases to `Schema/SchemaTests.cs` (invalid record name, 
invalid
     field name, and a field name attempting identifier injection) and
     `Protocol/ProtocolTest.cs` (`TestInvalidMessageName`).
   - Verified locally: the full `Avro.test` suite (1526 tests) passes, including
     the AvroGen code-generation tests.
   
   ## Documentation
   
   - Does this pull request introduce a new feature? no
   - If yes, how is the feature documented? not applicable
   
   
   


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