Skip to content

Commit 80b6fc0

Browse files
vdusekclaude
andcommitted
fix: Fix BeforeValidator treating 0 as falsy in configuration fields
`lambda val: val or None` coerces `0` and `Decimal(0)` to `None`, making it impossible to set `max_paid_dataset_items=0` or `max_total_charge_usd=0`. Use explicit empty-string check instead, consistent with the existing `timeout_at` validator. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 13b1fea commit 80b6fc0

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/apify/_configuration.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -295,7 +295,7 @@ class Configuration(CrawleeConfiguration):
295295
alias='actor_max_paid_dataset_items',
296296
description='For paid-per-result Actors, the user-set limit on returned results. Do not exceed this limit',
297297
),
298-
BeforeValidator(lambda val: val or None),
298+
BeforeValidator(lambda val: val if val != '' else None),
299299
] = None
300300

301301
max_total_charge_usd: Annotated[
@@ -304,7 +304,7 @@ class Configuration(CrawleeConfiguration):
304304
alias='actor_max_total_charge_usd',
305305
description='For pay-per-event Actors, the user-set limit on total charges. Do not exceed this limit',
306306
),
307-
BeforeValidator(lambda val: val or None),
307+
BeforeValidator(lambda val: val if val != '' else None),
308308
] = None
309309

310310
test_pay_per_event: Annotated[

0 commit comments

Comments
 (0)