修复事件跨服务序列化生成空窗口
This commit is contained in:
@@ -53,7 +53,7 @@ pub enum Expr {
|
||||
Operator {
|
||||
name: String,
|
||||
args: Vec<Expr>,
|
||||
#[serde(default)]
|
||||
#[serde(default, skip_serializing_if = "Option::is_none")]
|
||||
window: Option<usize>,
|
||||
},
|
||||
}
|
||||
|
||||
@@ -248,6 +248,11 @@ mod tests {
|
||||
use super::*;
|
||||
use crate::{BenchmarkSnapshot, DailyFactorSnapshot, DailyMarketSnapshot, Instrument};
|
||||
use serde_json::json;
|
||||
#[test]
|
||||
fn normalized_rule_does_not_turn_an_omitted_window_into_explicit_null() {
|
||||
let expression:Expr=serde_json::from_value(json!({"kind":"operator","name":"GT","args":[{"kind":"field","name":"close"},{"kind":"number","value":1}]})).unwrap();
|
||||
assert!(serde_json::to_value(expression).unwrap().get("window").is_none());
|
||||
}
|
||||
fn data(future: bool, reference: bool) -> DataSet {
|
||||
let mut days = vec![
|
||||
NaiveDate::from_ymd_opt(2026, 9, 4).unwrap(),
|
||||
|
||||
Reference in New Issue
Block a user