Skip to content
Snippets Groups Projects
Commit 581f68bd authored by Alexander Schlemmer's avatar Alexander Schlemmer
Browse files

DOC(validator): improved docstr of helper function

parent 62cc17ae
No related branches found
No related tags found
2 merge requests!217TST: Make NamedTemporaryFiles Windows-compatible,!201Validator that checks created records using a json schema
Pipeline #58337 passed
......@@ -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))
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment