flavray / avro-rs

Avro client library implementation in Rust
MIT License
169 stars 95 forks source link

Cannot parse schema with type cross-referencing #109

Closed praetp closed 4 years ago

praetp commented 4 years ago
    let raw_schema = r#"
    {
        "type": "record",
        "name": "test",
        "fields": [
            {"name": "a", 
             "type": {
                "name": "mytype",
                "type": "enum",
                "symbols": [
                       "SYMBOL_ONE"
                ]             
            }},
            {"name": "b", "type": "mytype"}
        ]
    }
    "#;
    let result = Schema::parse_str(raw_schema);

This panics with ParseSchemaError("Unknown type: mytype"). When I "inline" the type, it works.

If you want I can write a test for it. Not sure if this related to https://github.com/flavray/avro-rs/issues/92.

poros commented 4 years ago

Yes, this one is indeed a duplicate of #92. I am going to close this issue as duplicate in order to keep any future discussion on the same thread.