[
https://issues.apache.org/jira/browse/AVRO-4347?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18106968#comment-18106968
]
Ismaël Mejía commented on AVRO-4347:
------------------------------------
The C++ name-grammar first-character check is already addressed by the open PR
for AVRO-4312 (apache/avro#3889), which makes {{Name::check()}} require the
simple name to start with a letter or underscore (and validates field names and
enum symbols). This ticket is a duplicate of AVRO-4312; closing in favour of
that work.
> [c++] Name validation permits a leading digit, yielding invalid generated
> identifiers
> -------------------------------------------------------------------------------------
>
> Key: AVRO-4347
> URL: https://issues.apache.org/jira/browse/AVRO-4347
> Project: Apache Avro
> Issue Type: Bug
> Components: c++
> Reporter: Ismaël Mejía
> Priority: Major
> Fix For: 1.13.0
>
>
> {{Name::check()}} in the C++ SDK ({{lang/c++/impl/Node.cc}}) validates the
> namespace and simple-name characters but permits a *leading digit* in the
> simple
> name -- the first-character check does not enforce {{[A-Za-z_]}}. A type named
> e.g. {{9foo}} or {{123}} passes validation and is emitted verbatim as a C++
> identifier ({{struct 9foo { ... \} }}), which does not compile.
> Tighten {{Name::check()}} so the simple name matches the Avro grammar
> {{[A-Za-z_][A-Za-z0-9_]*}}, ensuring generated identifiers are always
> well-formed,
> and add a test. (Related to AVRO-4312, which covers field names and enum
> symbols.)
--
This message was sent by Atlassian Jira
(v8.20.10#820010)