Просмотр исходного кода

fix(library-tags): declare response_model=None on the 204 DELETE route

Under `from __future__ import annotations` the `-> None` return annotation
reaches FastAPI as the string "None", which resolves to NoneType -- truthy,
so APIRoute asserts a 204 may carry no response body and the app fails to
import. fastapi >= 0.116 guards against this; the 0.109-0.115 releases
requirements.txt still allows do not.
maziggy 2 месяцев назад
Родитель
Сommit
e1e2c12d25
2 измененных файлов с 6 добавлено и 1 удалено
  1. 0 0
      CHANGELOG.md
  2. 6 1
      backend/app/api/routes/library_tags.py

Разница между файлами не показана из-за своего большого размера
+ 0 - 0
CHANGELOG.md


+ 6 - 1
backend/app/api/routes/library_tags.py

@@ -186,7 +186,12 @@ async def update_tag(
     )
 
 
-@router.delete("/{tag_id}", status_code=204)
+# response_model=None is load-bearing under `from __future__ import annotations`:
+# the `-> None` return annotation reaches FastAPI as the string "None", which it
+# resolves to NoneType — a truthy class — and then asserts a 204 may carry no
+# response body. fastapi >= 0.116 special-cases NoneType; on the 0.109-0.115
+# releases requirements.txt still allows, the app fails at import without this.
+@router.delete("/{tag_id}", status_code=204, response_model=None)
 async def delete_tag(
     tag_id: int,
     db: AsyncSession = Depends(get_db),

Некоторые файлы не были показаны из-за большого количества измененных файлов