Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

No option to exclude keys from case conversion #625

Open
moldhouse opened this issue Dec 23, 2024 · 1 comment
Open

No option to exclude keys from case conversion #625

moldhouse opened this issue Dec 23, 2024 · 1 comment

Comments

@moldhouse
Copy link

Currently, it is not possible to specify a list of keys that should be excluded from case conversion.

In my case, this makes it hard to build a config from an Environment and a File, where some identifiers in the file are kebab-case, while other parameters are snake_case.

For example, I want a kebab-case key and a snake_case configuration:

# TOML configuration
[foo.kebab-case-key]
snake_case_configuration = "bar"
# Environment configuration
FOO__KEBAB_CASE_KEY__SNAKE_CASE_CONFIGURATION=bar

While there is a method convert_case, it is applied to all collected keys. For this example, a possible solution would be something like:

Environment::default().convert_case_exclude_keys(Case::Kebab, ["snake_case_configuration"]);
@epage
Copy link
Contributor

epage commented Jan 28, 2025

I'm sorry for the delay; I'm still working on catching up from the holidays

To make this easier to process and avoid confusing, could you write this up like a bug report with a reproduction case, showing the actual behavior and reporting what the expected behavior is?

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

No branches or pull requests

2 participants