Skip to content

Commit bd9f9d1

Browse files
committed
fix(Schema): refactore schema dict
1 parent 4cc559e commit bd9f9d1

1 file changed

Lines changed: 15 additions & 0 deletions

File tree

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
import os
2+
import glob
3+
import json
4+
5+
type SchemaDict = dict[str, str]
6+
7+
8+
def get_schemas_dict(path: str) -> dict[str, SchemaDict]:
9+
schemas_dict: dict[str, SchemaDict] = {}
10+
for json_file in glob.glob(os.path.join(path, "*.json")):
11+
filename = os.path.basename(json_file)
12+
with open(os.path.join(path, json_file), "r") as file:
13+
file_content = json.load(file)
14+
schemas_dict[os.path.splitext(filename)[0]] = file_content
15+
return schemas_dict

0 commit comments

Comments
 (0)