Skip to content

docs: Add guide on validating Actor input with Pydantic#941

Open
vdusek wants to merge 3 commits into
masterfrom
docs/input-validation-guide
Open

docs: Add guide on validating Actor input with Pydantic#941
vdusek wants to merge 3 commits into
masterfrom
docs/input-validation-guide

Conversation

@vdusek
Copy link
Copy Markdown
Contributor

@vdusek vdusek commented Jun 5, 2026

Adds a guide on validating Actor input with Pydantic, so Actor code works with a typed, guaranteed-valid object instead of reaching into a raw input dictionary. Follows the structure of the existing guides.

  • docs/03_guides/11_pydantic.mdx — the guide: why raw-dict access is fragile, defining an input model (aliases bridging camelCasesnake_case, defaults, constraints, a custom validator, extra='ignore'), validating with model_validate and failing fast on ValidationError, the relationship to the platform input schema, and a few extra features (HttpUrl/EmailStr, model_validator, SecretStr).
  • code/11_pydantic.py — the runnable example Actor (Run on Apify), plus the 11_http_url.py, 11_model_validator.py, and 11_raw_input.py snippets.
  • Cross-links added to the Actor input concepts page and the quick-start guides list.

Verified locally for valid input (passes validation, writes OUTPUT, exit 0) and invalid input (per-field summary keyed by input-schema alias, run ends FAILED). Lint + type-check pass.

@vdusek vdusek added adhoc Ad-hoc unplanned task added during the sprint. t-tooling Issues with this label are in the ownership of the tooling team. labels Jun 5, 2026
@vdusek vdusek self-assigned this Jun 5, 2026
@github-actions github-actions Bot added this to the 142nd sprint - Tooling team milestone Jun 5, 2026
@codecov
Copy link
Copy Markdown

codecov Bot commented Jun 5, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 86.94%. Comparing base (3f25d4a) to head (bd52c61).

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #941      +/-   ##
==========================================
+ Coverage   86.87%   86.94%   +0.06%     
==========================================
  Files          48       48              
  Lines        2942     2942              
==========================================
+ Hits         2556     2558       +2     
+ Misses        386      384       -2     
Flag Coverage Δ
e2e 37.76% <ø> (ø)
integration 59.10% <ø> (ø)
unit 75.69% <ø> (+0.06%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@vdusek vdusek changed the title docs: add guide on validating Actor input with Pydantic docs: Add guide on validating Actor input with Pydantic Jun 5, 2026
@vdusek vdusek requested a review from Mantisus June 5, 2026 18:56
@vdusek vdusek marked this pull request as ready for review June 5, 2026 18:57
@vdusek vdusek requested a review from szaganek as a code owner June 5, 2026 18:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

adhoc Ad-hoc unplanned task added during the sprint. t-tooling Issues with this label are in the ownership of the tooling team.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants