diff options
author | Victor Näslund <victor@sunet.se> | 2022-11-01 01:55:25 +0100 |
---|---|---|
committer | Victor Näslund <victor@sunet.se> | 2022-11-01 01:55:25 +0100 |
commit | ffb26f4a81a9ca61c4105df037f7e1beb8dc5fb0 (patch) | |
tree | 41094f051edbf300a6cd2c2de8dfb8435bfc18a4 /src/schema.py | |
parent | 1b836e78db2737ba5d1ae43da9828601a5a5c114 (diff) |
initial fresh up
Diffstat (limited to 'src/schema.py')
-rw-r--r-- | src/schema.py | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/src/schema.py b/src/schema.py index fe2b76c..2b479d2 100644 --- a/src/schema.py +++ b/src/schema.py @@ -1,3 +1,4 @@ +from typing import List, Any, Dict import json import sys import traceback @@ -95,15 +96,15 @@ schema = { # fmt:on -def get_index_keys(): - keys = list() +def get_index_keys() -> List[str]: + keys: List[str] = [] for key in schema["properties"]: keys.append(key) return keys -def as_index_list(): - index_list = list() +def as_index_list() -> List[Dict[str, Any]]: + index_list: List[Dict[str, Any]] = [] for key in schema["properties"]: name = f"{key}-json-index" index = { @@ -120,7 +121,7 @@ def as_index_list(): return index_list -def validate_collector_data(json_blob): +def validate_collector_data(json_blob: Dict[str, Any]) -> str: try: jsonschema.validate(json_blob, schema, format_checker=jsonschema.FormatChecker()) except jsonschema.exceptions.ValidationError as e: |