Skip to content

Commit

Permalink
add note
Browse files Browse the repository at this point in the history
  • Loading branch information
xxchan committed Dec 25, 2023
1 parent c84c3e9 commit a4945e4
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/connector/src/with_options_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<SinkParam>`.
fn generate_with_options_yaml_inner(path: &Path) -> String {
let mut structs = vec![];
let mut functions = BTreeMap::<String, FunctionInfo>::new();
Expand Down Expand Up @@ -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<String, StructInfo>) -> BTreeMap<String, StructInfo> {
let mut deleted_keys = HashSet::new();

Expand Down

0 comments on commit a4945e4

Please sign in to comment.