Skip to content

schema: missing field metadata when deserialize #241

@bohutang

Description

@bohutang

Describe the bug
In flight server/client mode, if the server schema is:

let schema = Schema::new(vec![
                Field::new("name", DataType::Utf8, false),
                Field::new("address", DataType::Utf8, false),
                Field::new("priority", DataType::UInt8, false),
            ])

The client will get an error:
status: Internal, message: "missing fieldmetadataat line 1 column 431", details: [], metadata: MetadataMap { headers: {"content-type": "application/grpc", "date": "Fri, 30 Apr 2021 08:43:12 GMT"} }

If we change the server schema(placehold an empty metadta) to:

let metadata: HashMap<String, String> = [("Key".to_string(), "Value".to_string())].iter().cloned().collect();
let schema = Schema::new_with_metadata(vec![
                Field::new("name", DataType::Utf8, false),
                Field::new("address", DataType::Utf8, false),
                Field::new("priority", DataType::UInt8, false),
            ], metadata)

All is ok.

I have removed this line from my local crate, it works too:

#[serde(skip_serializing_if = "HashMap::is_empty")]

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions