Browse Source

avoid accessing "$ref" if it doesn't exist

pull/14361/head
svlandeg 8 months ago
parent
commit
62f66bb8dd
  1. 2
      fastapi/_compat/v2.py

2
fastapi/_compat/v2.py

@ -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]

Loading…
Cancel
Save