From cbda5452b98fc542b50cdf8b9cfa9227ae2ced0c Mon Sep 17 00:00:00 2001 From: xxchan Date: Mon, 25 Dec 2023 15:16:20 +0800 Subject: [PATCH] add note --- src/connector/src/with_options_test.rs | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/connector/src/with_options_test.rs b/src/connector/src/with_options_test.rs index aabdb215f078c..712521d518dff 100644 --- a/src/connector/src/with_options_test.rs +++ b/src/connector/src/with_options_test.rs @@ -48,6 +48,13 @@ pub fn generate_with_options_yaml_sink() -> String { /// Collect all structs with `#[derive(WithOptions)]` in the `.rs` files in `path` (plus `common.rs`), /// and generate a YAML file. +/// +/// Note: here we assumes the struct is parsed by `serde`. If it's not the case, +/// the generated `yaml` might be inconsistent with the actual parsing logic. +/// TODO: improve the test to check whether serde is used. +/// +/// - For sources, the parsing logic is in `TryFromHashMap`. +/// - For sinks, the parsing logic is in `TryFrom`. fn generate_with_options_yaml_inner(path: &Path) -> String { let mut structs = vec![]; let mut functions = BTreeMap::::new(); @@ -278,6 +285,9 @@ fn extract_serde_properties(field: &Field) -> SerdeProperties { /// // ... /// } /// ``` +/// +/// Note: here we assumes `#[serde(flatten)]` is used for struct fields. If it's not the case, +/// the generated `yaml` might be inconsistent with the actual parsing logic. fn flatten_nested_options(options: BTreeMap) -> BTreeMap { let mut deleted_keys = HashSet::new();