Skip to content

Commit 46f1286

Browse files
fix: relax required stats fields (compute units, counts) to optional (#947)
- Updates the auto-generated Pydantic models and TypedDicts based on the proposed OpenAPI specification changes. - Based on apify-docs PR [#2763](apify/apify-docs#2763).
1 parent dbd39d0 commit 46f1286

1 file changed

Lines changed: 16 additions & 19 deletions

File tree

‎src/apify_client/_models.py‎

Lines changed: 16 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -544,7 +544,7 @@ class BuildStats(BaseModel):
544544
)
545545
duration_millis: Annotated[int | None, Field(examples=[1000])] = None
546546
run_time_secs: Annotated[float | None, Field(examples=[45.718])] = None
547-
compute_units: Annotated[float, Field(examples=[0.0126994444444444])]
547+
compute_units: Annotated[float | None, Field(examples=[0.0126994444444444])] = None
548548
image_size_bytes: Annotated[int | None, Field(examples=[975770223])] = None
549549

550550

@@ -1021,16 +1021,15 @@ class Datasets(BaseModel):
10211021
populate_by_name=True,
10221022
alias_generator=to_camel,
10231023
)
1024+
__annotations__ = {
1025+
'__pydantic_extra__': dict[str, str],
1026+
}
10241027
default: Annotated[str | None, Field(examples=['wmKPijuyDnPZAPRMk'])] = None
10251028
"""
10261029
ID of the default dataset for this run.
10271030
"""
10281031

10291032

1030-
Datasets.__annotations__['__pydantic_extra__'] = dict[str, str]
1031-
Datasets.model_rebuild(force=True)
1032-
1033-
10341033
@docs_group('Models')
10351034
class DecodeAndVerifyData(BaseModel):
10361035
model_config = ConfigDict(
@@ -1477,8 +1476,8 @@ class KeyValueStoreStats(BaseModel):
14771476
populate_by_name=True,
14781477
alias_generator=to_camel,
14791478
)
1480-
read_count: Annotated[int, Field(examples=[9])]
1481-
write_count: Annotated[int, Field(examples=[3])]
1479+
read_count: Annotated[int | None, Field(examples=[9])] = None
1480+
write_count: Annotated[int | None, Field(examples=[3])] = None
14821481
delete_count: Annotated[int | None, Field(examples=[6])] = None
14831482
list_count: Annotated[int | None, Field(examples=[2])] = None
14841483
s3_storage_bytes: Annotated[int | None, Field(examples=[18])] = None
@@ -1494,16 +1493,15 @@ class KeyValueStores(BaseModel):
14941493
populate_by_name=True,
14951494
alias_generator=to_camel,
14961495
)
1496+
__annotations__ = {
1497+
'__pydantic_extra__': dict[str, str],
1498+
}
14971499
default: Annotated[str | None, Field(examples=['eJNzqsbPiopwJcgGQ'])] = None
14981500
"""
14991501
ID of the default key-value store for this run.
15001502
"""
15011503

15021504

1503-
KeyValueStores.__annotations__['__pydantic_extra__'] = dict[str, str]
1504-
KeyValueStores.model_rebuild(force=True)
1505-
1506-
15071505
@docs_group('Models')
15081506
class Limits(BaseModel):
15091507
model_config = ConfigDict(
@@ -2648,16 +2646,15 @@ class RequestQueues(BaseModel):
26482646
populate_by_name=True,
26492647
alias_generator=to_camel,
26502648
)
2649+
__annotations__ = {
2650+
'__pydantic_extra__': dict[str, str],
2651+
}
26512652
default: Annotated[str | None, Field(examples=['FL35cSF7jrxr3BY39'])] = None
26522653
"""
26532654
ID of the default request queue for this run.
26542655
"""
26552656

26562657

2657-
RequestQueues.__annotations__['__pydantic_extra__'] = dict[str, str]
2658-
RequestQueues.model_rebuild(force=True)
2659-
2660-
26612658
@docs_group('Models')
26622659
class RequestRegistration(BaseModel):
26632660
"""Result of registering a request in the request queue, either by adding a new request or updating an existing one."""
@@ -2933,8 +2930,8 @@ class RunStats(BaseModel):
29332930
input_body_len: Annotated[int | None, Field(examples=[240], ge=0)] = None
29342931
migration_count: Annotated[int | None, Field(examples=[0], ge=0)] = None
29352932
reboot_count: Annotated[int | None, Field(examples=[0], ge=0)] = None
2936-
restart_count: Annotated[int, Field(examples=[0], ge=0)]
2937-
resurrect_count: Annotated[int, Field(examples=[2], ge=0)]
2933+
restart_count: Annotated[int | None, Field(examples=[0], ge=0)] = None
2934+
resurrect_count: Annotated[int | None, Field(examples=[2], ge=0)] = None
29382935
mem_avg_bytes: Annotated[float | None, Field(examples=[267874071.9])] = None
29392936
mem_max_bytes: Annotated[int | None, Field(examples=[404713472], ge=0)] = None
29402937
mem_current_bytes: Annotated[int | None, Field(examples=[0], ge=0)] = None
@@ -2946,7 +2943,7 @@ class RunStats(BaseModel):
29462943
duration_millis: Annotated[int | None, Field(examples=[248472], ge=0)] = None
29472944
run_time_secs: Annotated[float | None, Field(examples=[248.472], ge=0.0)] = None
29482945
metamorph: Annotated[int | None, Field(examples=[0], ge=0)] = None
2949-
compute_units: Annotated[float, Field(examples=[0.13804], ge=0.0)]
2946+
compute_units: Annotated[float | None, Field(examples=[0.13804], ge=0.0)] = None
29502947

29512948

29522949
@docs_group('Models')
@@ -3997,7 +3994,7 @@ class WebhookStats(BaseModel):
39973994
populate_by_name=True,
39983995
alias_generator=to_camel,
39993996
)
4000-
total_dispatches: Annotated[int, Field(examples=[1])]
3997+
total_dispatches: Annotated[int | None, Field(examples=[1])] = None
40013998

40023999

40034000
@docs_group('Models')

0 commit comments

Comments
 (0)