Added the menu category delete route. Fix: Show blank vouchers in tables Fix: In rare cases, the old settements can stick around. fixed it.
927 B
927 B
name, description
| name | description |
|---|---|
| fastapi-pydantic-v2 | Writes modern FastAPI endpoints using Pydantic v2 syntax and Annotated dependencies. Use whenever generating or refactoring API routes. |
FastAPI & Pydantic v2 Standards
Pydantic v2 Rules
- NEVER use
.dict()or.json(). ALWAYS use.model_dump()and.model_dump_json(). - NEVER use
@validatoror@root_validator. ALWAYS use@field_validatorand@model_validator(mode="before|after"). - NEVER use
schema_extra. Usejson_schema_extrainside themodel_configdict. - Use
pydantic_settings.BaseSettingsfor all environment variable configurations.
FastAPI Rules
- ALWAYS use
typing.Annotatedfor dependency injection (e.g.,db: Annotated[AsyncSession, Depends(get_db)]). - Do not use
deffor endpoints that perform I/O; always useasync def. - Raise
fastapi.HTTPExceptionfor expected client errors instead of returning standard dictionaries.