Skip to main content

null_to_empty

Function null_to_empty 

Source
pub fn null_to_empty<'de, D>(deserializer: D) -> Result<String, D::Error>
where D: Deserializer<'de>,
Available on crate feature serde only.
Expand description

Deserialize a String a forge CLI may send as JSON null for an empty optional value: null -> empty string, same as an absent key. #[serde(default)] alone covers only an absent key; a present null would fail the whole-object parse. Use as #[serde(deserialize_with = "vcs_cli_support::json::null_to_empty")].