# PydanticDeprecatedSince20: `__fields__` is deprecated; use `model_fields` instead. Deprecated in Pydantic V2.0 to be removed in V3.0.

- **ID:** `python/pydantic-v2-model-fields-deprecated`
- **Domain:** python
- **Category:** runtime_error
- **Verification:** ai_generated
- **Fix Rate:** 80%

## Root Cause

Code written for Pydantic v1 accesses model.__fields__ or .dict()/.json() which are deprecated in v2 in favor of model_fields, model_dump(), model_dump_json().

## Version Compatibility

| Version | Status | Introduced | Deprecated |
|---------|--------|------------|------------|
| 2.x | active | — | — |

## Workarounds

1. **** (95% success)
   ```
   Replace attribute access:

# v1
for name, field in User.__fields__.items(): ...
# v2
for name, field in User.model_fields.items(): ...
   ```
2. **** (95% success)
   ```
   Replace serialization methods:

obj.dict()      -> obj.model_dump()
obj.json()      -> obj.model_dump_json()
obj.parse_obj(d) -> obj.model_validate(d)
   ```

## Dead Ends

- **** — Hides the deprecation but the code still breaks when upgrading to v3 or when stderr is treated as failure in CI. (65% fail)
- **** — Conflicts with libraries (FastAPI 0.100+, LangChain) that require v2, causing install errors. (75% fail)
