Pydantic Migration Guides

Why @validator(each_item=True) needs manual review in Pydantic v2

Understand why validator(each_item=True) stays outside the deterministic migration path.

Start here

The safe first move

Treat validator(each_item=True) as manual review. The replacement depends on how item-level validation should be expressed in the target model.

Stop before automation when: Choosing the right item-level validation expression in v2. Validators that also depend on values, field, or config.

Target shape

# manual review required
# validator(each_item=True) is outside the deterministic porter subset

Repo fit check

Want to know if your repo has this pattern?

Run the matching scanner locally first. Read the free findings and manual alternatives; consider paid cleanup only if supported patterns repeat enough to justify the price.

  • Local scan; no repository upload.
  • Supported findings are separated from manual-review findings.
  • Buy only when the repeated pattern is worth automating.
Run the Pydantic scan first View example report See when to buy
Example scan summary
supported_findings: 38
manual_review_findings: 6
files_uploaded: 0
confidence: reviewable

Why this page exists

Why @validator(each_item=True) needs manual review in Pydantic v2

Simple validators are automatable. each_item=True is not in the current safe subset.

Direct answer

What changes

Treat validator(each_item=True) as manual review. The replacement depends on how item-level validation should be expressed in the target model.

Example

Before and after

Before

from pydantic import BaseModel, validator

class Payload(BaseModel):
    tags: list[str]

    @validator("tags", each_item=True)
    def normalize_tag(cls, value: str) -> str:
        return value.strip()

After

# manual review required
# validator(each_item=True) is outside the deterministic porter subset

Decision path

If this repeats across the repo, open the evaluation pages next.

The cleanup pack is strongest when the repo still uses direct pydantic imports and a clean validator/settings/config subset.

  • The repo has direct pydantic or pydantic.v1 imports, BaseSettings usage, safe Config blocks, or simple validators.
  • The migration pain is repetitive v1-to-v2 cleanup, not a custom semantic rewrite.
  • If the scan output is ambiguous, review its findings and upstream guidance. Do not buy expecting unsupported cases to be resolved.

Typical symptoms

  • The repo still uses each_item=True validators from Pydantic v1.
  • The easy validator renames are mixed with a smaller hard bucket.
  • Teams need a fail-closed report instead of a guessed replacement.

What the product covers

  • Explicit unsupported-validator-each-item findings.
  • Cross-links to the supported @validator to @field_validator page.
  • Repo-fit guidance before running the paid porter.

Manual-review boundary

  • Choosing the right item-level validation expression in v2.
  • Validators that also depend on values, field, or config.
  • Files with other unsupported decorator signatures.

FAQ

Fast answers before you decide

What is the safest fix for validator each_item pydantic v2?

Treat validator(each_item=True) as manual review. The replacement depends on how item-level validation should be expressed in the target model.

Can validator each_item pydantic v2 be automated?

Automate only the supported subset: Explicit unsupported-validator-each-item findings. Cross-links to the supported @validator to @field_validator page. Repo-fit guidance before running the paid porter. Keep these cases in manual review: Choosing the right item-level validation expression in v2. Validators that also depend on values, field, or config. Files with other unsupported decorator signatures.

When should I buy Pydantic v1 to v2 Migration Cleanup Pack?

Use Pydantic v1 to v2 Migration Cleanup Pack only when this pattern repeats across enough files that manual cleanup is still costly. Use the free report and upstream guide to evaluate fit. Buy only if repeated supported edits justify the price; no paid assessment is required.

Purchase fit

Choose the lowest-risk next step.

One matching page is not enough by itself. Run the local scan, then buy only when the same supported pattern appears often enough to matter.

Buy if

  • The repo has direct pydantic or pydantic.v1 imports, BaseSettings usage, safe Config blocks, or simple validators.
  • The migration pain is repetitive v1-to-v2 cleanup, not a custom semantic rewrite.
  • The team accepts manual-review findings for alias-heavy imports and signature-heavy validators.

What the workflow includes

  • Installable local CLI workflow, not a hosted black box.
  • Supported validator, settings, import, and config rewrites.
  • Demo report, public proof, coverage notes, rollback checklist, and buyer terms.

Before checkout

  • Stripe Checkout handles secure payment and receipts.
  • Download your purchased ZIP after payment.
  • Runs locally; no hosted API, repo upload, or production credentials needed.
  • The free report includes the evidence needed to evaluate fit. Paid summary and template add-ons are optional.
  • 14-day refund review for published-scope or delivery mismatches.