Skip to content

Commit 4e2bec0

Browse files
committed
fix: Collapse alias schemas so request method keeps the HttpMethod type
1 parent a91adb2 commit 4e2bec0

2 files changed

Lines changed: 7 additions & 12 deletions

File tree

pyproject.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -222,6 +222,9 @@ use_field_description = true
222222
use_union_operator = true
223223
capitalise_enum_members = true
224224
collapse_root_models = true
225+
# Folds a schema that only aliases another one (a `$ref` plus a description) into the referenced model, so a
226+
# bundler hoisting such an alias into its own component can't turn an enum-typed field into a `RootModel` wrapper.
227+
collapse_root_models_name_strategy = "child"
225228
set_default_enum_member = true
226229
use_annotated = true
227230
wrap_string_literal = true

src/apify_client/_models.py

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1474,7 +1474,7 @@ class HeadRequest(BaseModel):
14741474
"""
14751475
The URL of the request.
14761476
"""
1477-
method: RequestMethod | None = None
1477+
method: HttpMethod | None = None
14781478
retry_count: Annotated[int | None, Field(examples=[0])] = None
14791479
"""
14801480
The number of times this request has been retried.
@@ -1893,7 +1893,7 @@ class LockedHeadRequest(BaseModel):
18931893
"""
18941894
The URL of the request.
18951895
"""
1896-
method: RequestMethod | None = None
1896+
method: HttpMethod | None = None
18971897
retry_count: Annotated[int | None, Field(examples=[0])] = None
18981898
"""
18991899
The number of times this request has been retried.
@@ -2433,7 +2433,7 @@ class RequestBase(BaseModel):
24332433
"""
24342434
The URL of the request.
24352435
"""
2436-
method: RequestMethod | None = None
2436+
method: HttpMethod | None = None
24372437
retry_count: Annotated[int | None, Field(examples=[0])] = None
24382438
"""
24392439
The number of times this request has been retried.
@@ -2501,7 +2501,7 @@ class RequestDraft(BaseModel):
25012501
"""
25022502
The URL of the request.
25032503
"""
2504-
method: RequestMethod | None = None
2504+
method: HttpMethod | None = None
25052505

25062506

25072507
@docs_group('Models')
@@ -2565,14 +2565,6 @@ class RequestLockInfo(BaseModel):
25652565
"""
25662566

25672567

2568-
@docs_group('Models')
2569-
class RequestMethod(RootModel[HttpMethod]):
2570-
root: HttpMethod
2571-
"""
2572-
The HTTP method of the request.
2573-
"""
2574-
2575-
25762568
@docs_group('Models')
25772569
class RequestQueue(BaseModel):
25782570
"""A request queue object containing metadata and statistics."""

0 commit comments

Comments
 (0)