Skip to content

Conversation

aleris
Copy link

@aleris aleris commented Oct 8, 2025

Allow to nest with single _ even when field names contain underscores via .underscore_nesting(true)``. Can be used when field names also have _` with environment overrides.
Can be used as an alternative for double underscore separator '__' for nesting.
Supports deep nesting. Is off by default.

/// let source = Environment::default()
/// .list_separator(",")
/// .with_list_parse_key("my_list");
/// ```
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

unrelated but to clarify documentation which was a bit confusing for me

}

#[test]
fn test_parse_nested_double_separator() {
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

without kebab case conversion, this is to ensure it works in simple mode as a mirror of the next test which enables single underscore nesting

@aleris aleris force-pushed the single_underscore_field_nesting branch 2 times, most recently from f57ee26 to 69b6c74 Compare October 8, 2025 06:13
Allow to nest with single `_` even when field names contain underscores
via `.underscore_nesting(true)``.
Can be used when field names also have `_` with environment
overrides.
Can be used as an alternative for double underscore separator '__'
for nesting.
Supports deep nesting. Is off by default.
@aleris aleris force-pushed the single_underscore_field_nesting branch from 69b6c74 to 5ca270f Compare October 8, 2025 06:16
@epage
Copy link
Contributor

epage commented Oct 8, 2025

Note that our contributing guide asks to start with Issues, rather than PRs. Moving this to a Draft until there is a mutual understanding and agreement on the problem and the solution.

@epage epage marked this pull request as draft October 8, 2025 13:47
@aleris
Copy link
Author

aleris commented Oct 8, 2025

Ah, ok, thanks, will follow up.
Regarding starting with issues, maybe would help to change the language to be more explicit instead of current "it is probably best" and "It might be good" which suggest is rather optional (or I least this is how I read it).
https://github.com/rust-cli/config-rs/blob/main/CONTRIBUTING.md#pull-requests

@aleris
Copy link
Author

aleris commented Oct 8, 2025

added #704

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants