# fastapi.exceptions.RequestValidationError: ItemCreate 有 1 个验证错误
body -> name
  字段缺失 (type=value_error.missing)

- **ID:** `python/fastapi-422-field-required-body`
- **领域:** python
- **类别:** data_error
- **验证级别:** ai_generated
- **修复率:** 80%

## 根因

客户端发送的 JSON 请求体缺少 Pydantic 模型声明为必需（无默认值）的字段。

## 版本兼容性

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

## 解决方案

1. **** (92% 成功率)
   ```
   from typing import Optional
class ItemCreate(BaseModel):
    name: Optional[str] = None
   ```
2. **** (95% 成功率)
   ```
   requests.post(url, json={'name': 'x', 'price': 1.0})  # include all required fields
   ```

## 无效尝试

- **** — Response model affects serialization, not request validation. (95% 失败率)
- **** — Validation runs before your middleware can bypass it; also disables all validation. (80% 失败率)
