Skip to main content

deser_trd_market_string_allow_empty

Function deser_trd_market_string_allow_empty 

Source
fn deser_trd_market_string_allow_empty<'de, D>(
    deserializer: D,
) -> Result<String, D::Error>
where D: Deserializer<'de>,
Expand description

v1.4.90 P0-E: CancelAllOrderReq.market 用,接 int OR string 但允许 missing / null / 空字符串 (#[serde(default)] 兜底). 空字符串 → 直接返空, runtime validate() 报“market is required“错; 非空 string/int 走标准 deser_trd_market_as_string 路径.

为什么不复用 deser_trd_market_as_string: 后者要求非空且必须是合法 enum, 但本字段保留 #[serde(default)] 让 schema 兼容 missing field, 且 runtime 自定义 error message (“market is required”).