[
https://issues.apache.org/jira/browse/AVRO-4314?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Ismaël Mejía updated AVRO-4314:
-------------------------------
Description:
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# SDK
does 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.
Proposal: validate names, field names, and message names against the Avro name
grammar during schema/protocol parsing in the C# SDK, matching the Java SDK
behavior, and add tests covering rejection of out-of-spec values.
was:
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# SDK
does 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.
Proposal: validate names, field names, and message names against the Avro name
grammar during schema/protocol parsing in the C# SDK, matching the Java SDK
behavior, and add tests covering rejection of out-of-spec values.
Note: this ticket was split from the combined [c++][csharp] issue AVRO-4312;
the C++ part remains tracked there.
> [csharp] Validate names against the Avro name grammar at parse time
> -------------------------------------------------------------------
>
> Key: AVRO-4314
> URL: https://issues.apache.org/jira/browse/AVRO-4314
> Project: Apache Avro
> Issue Type: Bug
> Components: csharp
> Reporter: Ismaël Mejía
> Priority: Major
> Labels: pull-request-available
>
> 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# SDK
> does 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.
> Proposal: validate names, field names, and message names against the Avro
> name grammar during schema/protocol parsing in the C# SDK, 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)