Skip to content

fix(modeling): resolve in-document JSON Schema $ref paths before Pydantic model creation - #85

Open
syf2211 wants to merge 1 commit into
grll:mainfrom
syf2211:fix/resolve-json-schema-refs-75
Open

fix(modeling): resolve in-document JSON Schema $ref paths before Pydantic model creation#85
syf2211 wants to merge 1 commit into
grll:mainfrom
syf2211:fix/resolve-json-schema-refs-75

Conversation

@syf2211

@syf2211 syf2211 commented Jun 27, 2026

Copy link
Copy Markdown

Summary

Resolve in-document JSON Schema $ref pointers (including #/properties/... paths) before building Pydantic models for CrewAI tools.

Motivation

Fixes #75

resolve_refs_and_remove_defs only inlined #/$defs/... references. Schemas that reference sibling properties (e.g. #/properties/requestResponse/properties/request) were passed through unchanged, causing KeyError when model_json_schema() ran in CrewAIAdapter._generate_description.

Changes

  • Replace the hand-rolled $defs-only resolver with jsonref.replace_refs(..., proxies=False) and strip top-level $defs
  • Add regression test covering property-path $ref schemas from the issue report

Tests

python3 -m pytest tests/utils/test_modeling.py -v

2 passed.

Notes

  • Uses the existing jsonref dependency already used by other adapters (langchain, smolagents, google-genai)
  • composer-2.5 review: APPROVE, low risk

…ntic model creation

Use jsonref.replace_refs with proxies=False so property-path refs like
#/properties/.../request are inlined before create_model_from_json_schema runs.

Fixes grll#75
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Invalid Pydantic model generated

1 participant