[ 
https://issues.apache.org/jira/browse/AVRO-4062?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Oscar Westra van Holthe - Kind updated AVRO-4062:
-------------------------------------------------
    Fix Version/s:     (was: 1.13.0)

> Idl parsing not recognizing leading underscore for field names
> --------------------------------------------------------------
>
>                 Key: AVRO-4062
>                 URL: https://issues.apache.org/jira/browse/AVRO-4062
>             Project: Apache Avro
>          Issue Type: Bug
>          Components: java
>    Affects Versions: 1.12.0
>            Reporter: Isak Lindbeck
>            Assignee: Oscar Westra van Holthe - Kind
>            Priority: Major
>              Labels: pull-request-available
>             Fix For: 1.12.1
>
>          Time Spent: 1h
>  Remaining Estimate: 0h
>
> With version 1.12.0 the avro-maven-plugin stopped parsing leading underscore 
> for field names. This was not the case for version 1.11.3
> The following error can be observed.
> {code:java}
> line 94:9 token recognition error at: '_'{code}
> This should be allowed according to the specification for field names:
>  * start with [A-Za-z_]
>  * subsequently contain only [A-Za-z0-9_]
> I can reproduce the issue with this test:
> {code:java}
> @Test
> void testParsingLeadingUnderscore() throws IOException {
>     String avdl = """
>         @namespace("com.example.avro.schema")
>         record Example {
>             string _field;
>         }
>         """;
>     var byteStream = new ByteArrayInputStream(avdl.getBytes(UTF_8));
>     IdlFile parse = new IdlReader().parse(byteStream);
>     Schema schema = parse.getNamedSchema("com.example.avro.schema.Example");
>     // Fails since actual field name does not have a leading underscore
>     assertEquals("_field", schema.getFields().get(0).name());
> }{code}



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to