mirror of
https://github.com/fastapi/fastapi.git
synced 2026-03-05 07:26:33 -05:00
🐛 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:
committed by
GitHub
parent
74b4c3c9a1
commit
8f99a2b734
@@ -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]
|
||||
|
||||
Reference in New Issue
Block a user