Skip to content

Commit

Permalink
Fix validate_json scheme path (Significant-Gravitas#3631)
Browse files Browse the repository at this point in the history
Co-authored-by: Reinier van der Leer <[email protected]>
  • Loading branch information
k-boikov and Pwuts authored May 1, 2023
1 parent a5f8563 commit 0ef6f06
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion autogpt/json_utils/utilities.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
"""Utilities for the json_fixes package."""
import json
import os
import re

from jsonschema import Draft7Validator
Expand Down Expand Up @@ -35,7 +36,8 @@ def validate_json(json_object: object, schema_name: str) -> dict | None:
:param schema_name: str
:type json_object: object
"""
with open(f"autogpt/json_utils/{schema_name}.json", "r") as f:
scheme_file = os.path.join(os.path.dirname(__file__), f"{schema_name}.json")
with open(scheme_file, "r") as f:
schema = json.load(f)
validator = Draft7Validator(schema)

Expand Down

0 comments on commit 0ef6f06

Please sign in to comment.