🐛 Avoid accessing non-existing "$ref" key for Pydantic v2 compat remapping (#14361)

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
This commit is contained in:
Sofie Van Landeghem
2025-12-02 09:34:13 +05:30
committed by GitHub
parent 74b4c3c9a1
commit 8f99a2b734
2 changed files with 93 additions and 1 deletions

View File

@@ -304,7 +304,7 @@ def _remap_definitions_and_field_mappings(
old_name_to_new_name_map = {}
for field_key, schema in field_mapping.items():
model = field_key[0].type_
if model not in model_name_map:
if model not in model_name_map or "$ref" not in schema:
continue
new_name = model_name_map[model]
old_name = schema["$ref"].split("/")[-1]