diff --git a/application/single_app/config.py b/application/single_app/config.py index d5ba49b6..989731f4 100644 --- a/application/single_app/config.py +++ b/application/single_app/config.py @@ -88,7 +88,7 @@ EXECUTOR_TYPE = 'thread' EXECUTOR_MAX_WORKERS = 30 SESSION_TYPE = 'filesystem' -VERSION = "0.237.011" +VERSION = "0.237.049" SECRET_KEY = os.getenv('SECRET_KEY', 'dev-secret-key-change-in-production') diff --git a/application/single_app/json_schema_validation.py b/application/single_app/json_schema_validation.py index c7c58a3c..6e98159b 100644 --- a/application/single_app/json_schema_validation.py +++ b/application/single_app/json_schema_validation.py @@ -3,7 +3,7 @@ import os import json from functools import lru_cache -from jsonschema import validate, ValidationError, Draft7Validator, Draft6Validator +from jsonschema import validate, ValidationError, Draft7Validator, Draft6Validator, RefResolver SCHEMA_DIR = os.path.join(os.path.dirname(__file__), 'static', 'json', 'schemas') @@ -16,7 +16,10 @@ def load_schema(schema_name): def validate_agent(agent): schema = load_schema('agent.schema.json') - validator = Draft7Validator(schema['definitions']['Agent']) + if schema.get("$ref") and schema.get("definitions"): + validator = Draft7Validator(schema, resolver=RefResolver.from_schema(schema)) + else: + validator = Draft7Validator(schema) errors = sorted(validator.iter_errors(agent), key=lambda e: e.path) if errors: return '; '.join([e.message for e in errors]) diff --git a/docs/explanation/fixes/AGENT_SCHEMA_REF_RESOLUTION_FIX.md b/docs/explanation/fixes/AGENT_SCHEMA_REF_RESOLUTION_FIX.md new file mode 100644 index 00000000..7abc9863 --- /dev/null +++ b/docs/explanation/fixes/AGENT_SCHEMA_REF_RESOLUTION_FIX.md @@ -0,0 +1,32 @@ +# Agent Schema Ref Resolution Fix (v0.237.049) + +## Issue Description +Agent validation failed with `PointerToNowhere: '/definitions/OtherSettings'` when validating agents that include `other_settings`. + +## Root Cause Analysis +The validator was pointed at the `Agent` sub-schema, which stripped shared `definitions` and broke `$ref` resolution. + +## Version Implemented +Fixed/Implemented in version: **0.237.049** + +## Technical Details +### Files Modified +- application/single_app/json_schema_validation.py +- application/single_app/config.py +- functional_tests/test_agent_schema_ref_resolution.py + +### Code Changes Summary +- Validate agents using the root schema and include a schema resolver. +- Incremented the application version. + +### Testing Approach +- Functional test asserts the root schema and resolver are used. + +## Impact Analysis +- Agent schema `$ref` resolution works as intended. + +## Validation +- Functional test: functional_tests/test_agent_schema_ref_resolution.py + +## Reference to Config Version Update +- Version updated in application/single_app/config.py to **0.237.049**.