[
https://issues.apache.org/jira/browse/AVRO-4312?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Ismaël Mejía updated AVRO-4312:
-------------------------------
Component/s: (was: csharp)
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, 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 field names and enum symbols against the Avro name grammar
during schema 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 a combined [c++][csharp] issue; the C# part is
now tracked separately.
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# 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.
Summary: [c++] Validate field names and enum symbols against the Avro
name grammar at parse time (was: [c++][csharp] Validate names and symbols
against the Avro name grammar at parse time)
> [c++] Validate field names and enum 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: c++
> Reporter: Ismaël Mejía
> Priority: Major
> Labels: pull-request-available
> Time Spent: 1.5h
> Remaining Estimate: 0h
>
> 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, 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 field names and enum symbols against the Avro name grammar
> during schema 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 a combined [c++][csharp] issue; the C# part
> is now tracked separately.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)