[ 
https://issues.apache.org/jira/browse/AVRO-3433?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17502733#comment-17502733
 ] 

ASF subversion and git services commented on AVRO-3433:
-------------------------------------------------------

Commit aa22276152802a85cc628c418f304a164d82b3af in avro's branch 
refs/heads/master from Jack Klamer
[ https://gitbox.apache.org/repos/asf?p=avro.git;h=aa22276 ]

[AVRO-3433][rust] Adding in Resolve Fixes and Tests (#1582)

* AVRO-3433: Rust: The canonical form should preserve schema references

Do not resolve Schema::Ref when printing as JSON.
The Java SDK complains that a type is redefined if it is not a Ref the
second time

Signed-off-by: Martin Tzvetanov Grigorov <[email protected]>

* AVRO-3433: Use Name as a key for parsed/resolving/input schemata

This is needed to have the fullname (namespace + '.' + name) for lookups

Signed-off-by: Martin Tzvetanov Grigorov <[email protected]>

* AVRO-3433: adding in resolve fixes and tests

* AVRO-3433: Fix formatting and clippy errors

Signed-off-by: Martin Tzvetanov Grigorov <[email protected]>

* AVRO-3433: Give better names to the new test cases

Signed-off-by: Martin Tzvetanov Grigorov <[email protected]>

* AVRO-3433: Collect all Union schemata in schemas_by_name to be able to 
resolve Schema::Ref's

Signed-off-by: Martin Tzvetanov Grigorov <[email protected]>

* AVRO-3433: Add schema name validation

Signed-off-by: Martin Tzvetanov Grigorov <[email protected]>

* AVRO-3433: Use the regex to capture the namespace and name

Signed-off-by: Martin Tzvetanov Grigorov <[email protected]>

* AVRO-3433: Register all union's schemata in schemas_by_name, so that 
Schema::Ref's can be resolved

Signed-off-by: Martin Tzvetanov Grigorov <[email protected]>

* AVRO-3433: Add in encoding tests

Co-authored-by: Martin Tzvetanov Grigorov <[email protected]>
Co-authored-by: Martin Grigorov <[email protected]>

> Rust: The canonical form should preserve schema references
> ----------------------------------------------------------
>
>                 Key: AVRO-3433
>                 URL: https://issues.apache.org/jira/browse/AVRO-3433
>             Project: Apache Avro
>          Issue Type: Bug
>          Components: rust
>    Affects Versions: 1.12.0
>            Reporter: Martin Tzvetanov Grigorov
>            Assignee: Martin Tzvetanov Grigorov
>            Priority: Major
>              Labels: pull-request-available
>          Time Spent: 5h 10m
>  Remaining Estimate: 0h
>
> Reported at 
> [https://github.com/flavray/avro-rs/issues/182#issuecomment-1059762821]
> =================================
> There still seems to be an issue with {{can't refine}} errors, at least in 
> some non-recursive cases. Take the following example:
> {code:java}
> fn main() {
>     let schema = r#"
>     {
>       "name": "test.test",
>       "type": "record",
>       "fields": [
>         {
>           "name": "bar",
>           "type": { "name": "test.foo", "type": "record", "fields": [{ 
> "name": "id", "type": "long" }] }
>         },
>         { "name": "baz", "type": "test.foo" }
>       ]
>     }
>     "#;
>     let schema = apache_avro::schema::Schema::parse_str(&schema).unwrap();
>     println!("{}", serde_json::to_string(&schema).unwrap());
> } {code}
> This prints the following (the same thing happens if the {{test.foo}} 
> definition is in a separate file):
> {code:java}
> $ target/release/avro-test | jq
> {
>   "type": "record",
>   "name": "test.test",
>   "fields": [
>     {
>       "name": "bar",
>       "type": {
>         "type": "record",
>         "name": "test.foo",
>         "fields": [
>           {
>             "name": "id",
>             "type": "long"
>           }
>         ]
>       }
>     },
>     {
>       "name": "baz",
>       "type": {
>         "type": "record",
>         "name": "test.foo",
>         "fields": [
>           {
>             "name": "id",
>             "type": "long"
>           }
>         ]
>       }
>     }
>   ]
> } {code}
> Which will cause the Java tooling to fail with the 
> {{org.apache.avro.SchemaParseException: Can't redefine: test}} error above.



--
This message was sent by Atlassian Jira
(v8.20.1#820001)

Reply via email to