feat: Zod-based Configuration extending Crawlee's new approach#551
Open
feat: Zod-based Configuration extending Crawlee's new approach#551
Conversation
Refactors the Configuration class to use Zod-based field definitions,
extending Crawlee's new Configuration class cleanly without monkey patching.
Key changes:
- Uses `crawleeConfigFields` spread with Apify-specific overrides and additions
- Each field defines schema and env var aliases in one place
- Supports multiple env var aliases per field (e.g., ACTOR_ID, APIFY_ACTOR_ID)
- Removes all monkey patching of CoreConfiguration
- Adds zod as direct dependency
Example field definition:
```ts
actorId: field(z.string().optional(), {
env: ['ACTOR_ID', 'APIFY_ACTOR_ID'],
}),
```
Requires: apify/crawlee#3387
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Uses the new `extendField()` helper from Crawlee to extend base fields with additional env var mappings without repeating the CRAWLEE_* ones. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Updates to use CrawleeConfiguration.extendField() static method instead of standalone extendField import. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Refactors the Configuration class to use Zod-based field definitions, extending Crawlee's new Configuration class cleanly without monkey patching.
crawleeConfigFieldsspread with Apify-specific overrides and additionsACTOR_ID,APIFY_ACTOR_ID)Before (with monkey patching)
After (clean extension)
Dependencies
Requires: apify/crawlee#3387
Test plan
🤖 Generated with Claude Code