From 581f68bd62d03a5164989b94ea7d8f7e3120a5e7 Mon Sep 17 00:00:00 2001
From: Alexander Schlemmer <a.schlemmer@indiscale.com>
Date: Fri, 29 Nov 2024 09:11:58 +0100
Subject: [PATCH] DOC(validator): improved docstr of helper function

---
 src/caoscrawler/validator.py | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/src/caoscrawler/validator.py b/src/caoscrawler/validator.py
index bb21a611..3051f4c4 100644
--- a/src/caoscrawler/validator.py
+++ b/src/caoscrawler/validator.py
@@ -67,7 +67,17 @@ def load_json_schema_from_datamodel_yaml(filename: str) -> list:
 
 
 def representer_ordereddict(dumper, data):
-    # yaml.add_representer(OrderedDict, caoscrawler.validator.representer_ordereddict)
+    """
+    Helper function to be able to represent the converted json schema objects correctly as yaml.
+    This representer essentially replaced OrderedDict objects with simple dict objects.
+
+    Since Python 3.7 dicts are ordered by default, see e.g.: https://softwaremaniacs.org/blog/2020/02/05/dicts-ordered/en/
+
+    Example how to use the representer:
+    ```python
+    yaml.add_representer(OrderedDict, caoscrawler.validator.representer_ordereddict)
+    ```
+    """
     return dumper.represent_data(dict(data))
 
 
-- 
GitLab