Skip to content

No option to exclude keys from case conversion #625

Open
@moldhouse

Description

@moldhouse

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"]);

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions