Ismaël Mejía created AVRO-4312:
----------------------------------
Summary: [c++][csharp] Validate names and symbols against the Avro
name grammar at parse time
Key: AVRO-4312
URL: https://issues.apache.org/jira/browse/AVRO-4312
Project: Apache Avro
Issue Type: Bug
Components: csharp, c++
Reporter: Ismaël Mejía
The Avro specification requires record/enum/fixed names, field names, enum
symbols, and protocol message names to match `[A-Za-z_][A-Za-z0-9_]*` (with
dotted namespaces). The Java SDK enforces this during parsing, but the C# and
C++ SDKs do not validate all of these.
In the C# SDK only enum symbols are validated (EnumSchema); record/fixed/enum
names, namespaces, field names, and protocol message names are accepted
verbatim (SchemaName, Field, Message). Because the C# code generator splices
some of these values directly into generated source (for example protocol
message names into a `case "..."` label and field names into Get/Put switch
bodies via CodeSnippetExpression), an out-of-spec name produces malformed or
unexpected generated C# code.
In the C++ SDK, type names and namespaces are validated (Name::check), but
field names and enum symbols are not; they are emitted as C++ identifiers after
only reserved-word decoration, so out-of-spec values produce malformed
identifiers.
Proposal: validate names, field names, enum symbols, and message names against
the Avro name grammar during schema/protocol parsing in both SDKs, matching the
Java SDK behavior, and add tests covering rejection of out-of-spec values.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)