Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion application/single_app/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -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')

Expand Down
7 changes: 5 additions & 2 deletions application/single_app/json_schema_validation.py
Original file line number Diff line number Diff line change
Expand Up @@ -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')

Expand All @@ -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])
Expand Down
32 changes: 32 additions & 0 deletions docs/explanation/fixes/AGENT_SCHEMA_REF_RESOLUTION_FIX.md
Original file line number Diff line number Diff line change
@@ -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**.
Loading