Skip to content

support lists #22

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

Merged
merged 2 commits into from
Aug 27, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions ecs_logging/_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,8 @@ def flatten_dict(value):
def normalize_dict(value):
# type: (Dict[str, Any]) -> Dict[str, Any]
"""Expands all dotted names to nested dictionaries"""
if not isinstance(value, dict):
return value
keys = list(value.keys())
for key in keys:
if "." in key:
Expand Down
4 changes: 4 additions & 0 deletions tests/test_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,7 @@ def test_normalize_dict():
assert normalize_dict(
{"a": {"b": 1}, "a.c": {"d.e": {"f": 1}, "d.e.g": [{"f.c": 2}]}}
) == {"a": {"b": 1, "c": {"d": {"e": {"f": 1, "g": [{"f": {"c": 2}}]}}}}}


def test_normalize_dict_with_array():
assert normalize_dict({"a": ["1", "2"]}) == {"a": ["1", "2"]}