aboutsummaryrefslogtreecommitdiff
path: root/autogpts/autogpt/autogpt/core/utils/json_schema.py
diff options
context:
space:
mode:
Diffstat (limited to 'autogpts/autogpt/autogpt/core/utils/json_schema.py')
-rw-r--r--autogpts/autogpt/autogpt/core/utils/json_schema.py16
1 files changed, 3 insertions, 13 deletions
diff --git a/autogpts/autogpt/autogpt/core/utils/json_schema.py b/autogpts/autogpt/autogpt/core/utils/json_schema.py
index 743d70d58..c9f9026e0 100644
--- a/autogpts/autogpt/autogpt/core/utils/json_schema.py
+++ b/autogpts/autogpt/autogpt/core/utils/json_schema.py
@@ -1,5 +1,4 @@
import enum
-import json
from logging import Logger
from textwrap import indent
from typing import Literal, Optional
@@ -96,24 +95,15 @@ class JSONSchema(BaseModel):
schema (JSONSchema): The JSONSchema to validate against.
Returns:
- tuple: A tuple where the first element is a boolean indicating whether the object is valid or not,
- and the second element is a list of errors found in the object, or None if the object is valid.
+ tuple: A tuple where the first element is a boolean indicating whether the
+ object is valid or not, and the second element is a list of errors found
+ in the object, or None if the object is valid.
"""
validator = Draft7Validator(self.to_dict())
if errors := sorted(validator.iter_errors(object), key=lambda e: e.path):
- for error in errors:
- logger.debug(f"JSON Validation Error: {error}")
-
- logger.error(json.dumps(object, indent=4))
- logger.error("The following issues were found:")
-
- for error in errors:
- logger.error(f"Error: {error.message}")
return False, errors
- logger.debug("The JSON object is valid.")
-
return True, None
def to_typescript_object_interface(self, interface_name: str = "") -> str: