diff --git a/README.md b/README.md index 9703dc2..f1685be 100644 --- a/README.md +++ b/README.md @@ -23,7 +23,7 @@ database: user: $DATABASE_USER timeout: $DATABASE_TIMEOUT? environment: development -is-debug: true +is_debug: true ``` `config.py` diff --git a/pyproject.toml b/pyproject.toml index 895d05b..5ebaea4 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "pyamldantic" -version = "1.1.0" +version = "1.2.0" description = "Validate and serialize YAML config files with Pydantic, with support for environment variables." readme = "README.md" authors = [ diff --git a/src/pyamldantic/config.py b/src/pyamldantic/config.py index b3fb542..0226fb0 100644 --- a/src/pyamldantic/config.py +++ b/src/pyamldantic/config.py @@ -47,7 +47,6 @@ def load(cls, path: str, *, schema: type[T]) -> T: except ScannerError as e: raise InvalidYAMLError(path, e) from None - cls._normalize_keys(data) cls._set_env_vars(data) try: @@ -58,23 +57,6 @@ def load(cls, path: str, *, schema: type[T]) -> T: # Private methods - @classmethod - def _normalize_keys(cls, data: dict[str, Any]) -> None: - """ - Replace dashes in keys with underscores. - - :param data: The data to process - :type data: dict[str, Any] - """ - for k in list(data.keys()): - new_key = k.replace("-", "_") - - if new_key != k: - data[new_key] = data.pop(k) - - if isinstance(data[new_key], dict): - cls._normalize_keys(data[new_key]) - @classmethod def _set_env_vars(cls, data: dict[str, Any]) -> None: """ diff --git a/tests/fixtures/config.yaml b/tests/fixtures/config.yaml index 8f00f87..537a05e 100644 --- a/tests/fixtures/config.yaml +++ b/tests/fixtures/config.yaml @@ -6,4 +6,4 @@ database: user: $DATABASE_USER timeout: $DATABASE_TIMEOUT? environment: testing -is-debug: true +is_debug: true diff --git a/uv.lock b/uv.lock index 7b45201..6e18ed5 100644 --- a/uv.lock +++ b/uv.lock @@ -165,7 +165,7 @@ wheels = [ [[package]] name = "pyamldantic" -version = "1.1.0" +version = "1.2.0" source = { editable = "." } dependencies = [ { name = "pydantic" },