[
https://issues.apache.org/jira/browse/AVRO-4345?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Ismaël Mejía updated AVRO-4345:
-------------------------------
Description:
h2. Summary
The code generators (Java {{SpecificCompiler}}, C# {{CodeGen}}, C++
{{avrogencpp}})
turn schema-derived values -- record/field/enum names, enum symbols, namespaces,
documentation strings, and other string properties -- into generated source
code.
To produce well-formed output consistently across SDKs, these values should be
validated against the Avro name grammar ({{[A-Za-z_][A-Za-z0-9_]*}}, with dotted
namespaces) at parse time, and safely escaped when emitted, so that unusual or
out-of-spec schema content yields a clear parse error or well-formed generated
code rather than malformed source.
The Java SDK already validates names at parse time and escapes documentation;
this umbrella tracks aligning the other SDKs and closing the remaining
per-language
gaps.
h2. Related per-SDK work
* Java: AVRO-4311 (documentation escaping), AVRO-4313 (annotation values)
* C#: AVRO-4314 (names) + AVRO-4346 (enum symbols and protocol names on the
JSON parse path)
* C++: AVRO-4312 (field names / enum symbols, incl. name-grammar first
character)
Note: the Rust implementation ({{apache-avro-derive}}) generates schemas from
Rust
types rather than code from schemas, so this class does not apply there.
was:
h2. Summary
The code generators (Java {{SpecificCompiler}}, C# {{CodeGen}}, C++
{{avrogencpp}})
turn schema-derived values -- record/field/enum names, enum symbols, namespaces,
documentation strings, and other string properties -- into generated source
code.
To produce well-formed output consistently across SDKs, these values should be
validated against the Avro name grammar ({{[A-Za-z_][A-Za-z0-9_]*}}, with dotted
namespaces) at parse time, and safely escaped when emitted, so that unusual or
out-of-spec schema content yields a clear parse error or well-formed generated
code rather than malformed source.
The Java SDK already validates names at parse time and escapes documentation;
this umbrella tracks aligning the other SDKs and closing the remaining
per-language
gaps.
h2. Related per-SDK work
* Java: AVRO-4053, AVRO-4311, AVRO-4313
* C#: AVRO-4314 (names) + follow-up for enum symbols and protocol names on the
JSON parse path
* C++: AVRO-4312 (field names / enum symbols) + name-grammar first-character
check
Note: the Rust implementation ({{apache-avro-derive}}) now lives in the separate
avro-rs GitHub repository and should be reviewed there.
> Consistently validate schema-derived names and escape values in the code
> generators
> -----------------------------------------------------------------------------------
>
> Key: AVRO-4345
> URL: https://issues.apache.org/jira/browse/AVRO-4345
> Project: Apache Avro
> Issue Type: Improvement
> Components: c++, csharp, java
> Reporter: Ismaël Mejía
> Priority: Major
> Fix For: 1.13.0
>
>
> h2. Summary
> The code generators (Java {{SpecificCompiler}}, C# {{CodeGen}}, C++
> {{avrogencpp}})
> turn schema-derived values -- record/field/enum names, enum symbols,
> namespaces,
> documentation strings, and other string properties -- into generated source
> code.
> To produce well-formed output consistently across SDKs, these values should be
> validated against the Avro name grammar ({{[A-Za-z_][A-Za-z0-9_]*}}, with
> dotted
> namespaces) at parse time, and safely escaped when emitted, so that unusual or
> out-of-spec schema content yields a clear parse error or well-formed generated
> code rather than malformed source.
> The Java SDK already validates names at parse time and escapes documentation;
> this umbrella tracks aligning the other SDKs and closing the remaining
> per-language
> gaps.
> h2. Related per-SDK work
> * Java: AVRO-4311 (documentation escaping), AVRO-4313 (annotation values)
> * C#: AVRO-4314 (names) + AVRO-4346 (enum symbols and protocol names on the
> JSON parse path)
> * C++: AVRO-4312 (field names / enum symbols, incl. name-grammar first
> character)
> Note: the Rust implementation ({{apache-avro-derive}}) generates schemas from
> Rust
> types rather than code from schemas, so this class does not apply there.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)