From dce6ea29d3a530c86986810191ae3090335f35ac Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Thu, 13 Nov 2025 10:56:10 +0000 Subject: [PATCH] =?UTF-8?q?=F0=9F=8E=A8=20[pre-commit.ci]=20Auto=20format?= =?UTF-8?q?=20from=20pre-commit.com=20hooks?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- fastapi/_compat/v2.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/fastapi/_compat/v2.py b/fastapi/_compat/v2.py index af161261d..55c9fcc9b 100644 --- a/fastapi/_compat/v2.py +++ b/fastapi/_compat/v2.py @@ -262,18 +262,18 @@ def _replace_refs( new_schema = deepcopy(schema) for key, value in new_schema.items(): if key == "$ref": - #ref_name = schema["$ref"].split("/")[-1] + # ref_name = schema["$ref"].split("/")[-1] ref_name = schema["$ref"] if isinstance(ref_value, str): # Normal case ref_name = ref_value.split("/")[-1] elif isinstance(ref_value, dict): - # Handle dict case + # Handle dict case ref_name = ref_value.get("title") or "unknown_ref" else: # Unexpected type ref_name = "invalid_ref" - + if ref_name in old_name_to_new_name_map: new_name = old_name_to_new_name_map[ref_name] new_schema["$ref"] = REF_TEMPLATE.format(model=new_name)