Kriskras99 commented on issue #476:
URL: https://github.com/apache/avro-rs/issues/476#issuecomment-3932901849

   The patch for this is trivial:
   ```diff
   --- a/avro/src/schema/record/field.rs
   +++ b/avro/src/schema/record/field.rs
   @@ -81,12 +81,8 @@ impl RecordField {
    
            validate_record_field_name(&name)?;
    
   -        // TODO: "type" = "<record name>"
   -        let schema = parser.parse_complex(
   -            field,
   -            &enclosing_record.namespace,
   -            RecordSchemaParseLocation::FromField,
   -        )?;
   +        let ty = field.get("type").ok_or(Details::GetRecordFieldTypeField)?;
   +        let schema = parser.parse(ty, &enclosing_record.namespace)?;
    
            let default = field.get("default").cloned();
            Self::resolve_default_value(
   ```
   But this breaks 26 tests, all because they use a complex type directly in a 
field:
   ```json
   {
       "type": "record",
       "fields": [
           {            
               "name": "this_issue",
               "type": "enum",
               "symbols": ["INSERT", "UPDATE"]
           },
           {            
               "name": "direct_map",
               "type": "map",
               "values": "long"
           },
           {            
               "name": "direct_array",
               "type": "array",
               "items": "long"
           },
           {            
               "name": "direct_fixed",
               "type": "fixed",
               "size": 16
           }
       ]
   }
   ```
   The problem is the most pressing for `enum` and `fixed` as they currently 
always share their type name with the field name.
   @martin-g what do you think? I think this is the right thing to do.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to