Skip to content

serde_with fails on options that are missing #417

@Pzixel

Description

@Pzixel
#[serde_as]
#[derive(Debug, Deserialize)]
pub struct Foo {
    #[serde_as(deserialize_as = "Option<serde_with::Same>")]
    pub a: Option<u32>,
}

let x = serde_json::from_str("{}");

Expected result: deserialized successfully with a: None
Actual result: called Result::unwrap() on an Err value: Error("missing field a")

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions