mirror of
https://github.com/PrefectHQ/fastmcp.git
synced 2026-10-16 18:03:19 +02:00
`dereference_refs` checks the size of a schema before inlining it. That check walked the raw schema, so a pointer such as `#/$defs/Alias/properties/value`, where `Alias` is only a `$ref` to another definition, could not be resolved and the schema was returned with its `$ref`s in place, even though it is small and `jsonref` inlines it correctly. The pointer walk now continues through local `$ref` nodes the way `jsonref` does, with a limit on how many references one lookup follows, so alias chains resolve, cycles and dangling references still keep the compact form, and the check stays bounded.
```python
schema = {
"type": "object",
"properties": {"v": {"$ref": "#/$defs/Alias/properties/value"}},
"$defs": {
"Alias": {"$ref": "#/$defs/Actual"},
"Actual": {"type": "object", "properties": {"value": {"type": "string"}}},
},
}
dereference_refs(schema)["properties"]["v"] # {"type": "string"}
```
Co-authored-by: Bill Easton <williamseaston@gmail.com>
Co-authored-by: Claude <noreply@anthropic.com>
|
||
|---|---|---|
| .. | ||
| json_schema_type | ||
| openapi | ||
| __init__.py | ||
| test_async_utils.py | ||
| test_auth.py | ||
| test_cli.py | ||
| test_components.py | ||
| test_docstring_parsing.py | ||
| test_http.py | ||
| test_inspect.py | ||
| test_inspect_icons.py | ||
| test_json_schema.py | ||
| test_json_schema_expansion.py | ||
| test_logging.py | ||
| test_skills.py | ||
| test_tests.py | ||
| test_timeout.py | ||
| test_token_cache.py | ||
| test_typeadapter.py | ||
| test_types.py | ||
| test_version_check.py | ||