# fastapi.exceptions.FastAPIError: 响应字段参数无效！提示：检查 <class 'typing.Any'> 是否为有效的 Pydantic 字段类型。

- **ID:** `python/fastapi-openapi-schema-generation-failed`
- **领域:** python
- **类别:** type_error
- **验证级别:** ai_generated
- **修复率:** 80%

## 根因

路由使用了 Any 或不支持类型的返回注解或 response_model，Pydantic 无法为其构建 schema。

## 版本兼容性

| 版本 | 状态 | 引入 | 弃用 |
|------|------|------|------|
| 0.100+ | active | — | — |

## 解决方案

1. **** (95% 成功率)
   ```
   class ItemOut(BaseModel):
    id: int
    name: str
@app.get('/items', response_model=list[ItemOut])
async def items(): ...
   ```
2. **** (85% 成功率)
   ```
   @app.get('/raw', response_class=JSONResponse)
async def raw() -> dict: ...
   ```

## 无效尝试

- **** — Disables OpenAPI schema; clients lose typed documentation. (60% 失败率)
- **** — Pydantic still rejects Any in response models. (80% 失败率)
