# TypeError: 路径操作中的 'function' 对象不可调用

- **ID:** `python/fastapi-typeerror-path-operation-not-callable`
- **领域:** python
- **类别:** type_error
- **验证级别:** ai_generated
- **修复率:** 80%

## 根因

装饰器使用时不带括号，例如 @app.get 而不是 @app.get()。

## 版本兼容性

| 版本 | 状态 | 引入 | 弃用 |
|------|------|------|------|
| 3.x | active | — | — |

## 解决方案

1. **Use decorator with parentheses and path** (95% 成功率)
   ```
   @app.get('/items')
async def get_items():
    return []
   ```
2. **Check for missing parentheses in custom decorators** (90% 成功率)
   ```
   def my_decorator(func):
    return func
# Use: @my_decorator
def my_func(): pass
   ```

## 无效尝试

- **Adding parentheses but not passing path** — Still missing required argument. (60% 失败率)
- **Using class-based view incorrectly** — May conflict with function-based approach. (50% 失败率)
