11from __future__ import annotations
22
3+ import warnings
34from typing import TYPE_CHECKING , Any , Literal
45
56from pydantic import TypeAdapter
@@ -575,9 +576,10 @@ def validate_input(
575576 self ,
576577 run_input : Any = None ,
577578 * ,
578- build_tag : str | None = None ,
579+ build : str | None = None ,
579580 content_type : str | None = None ,
580581 timeout : Timeout = 'short' ,
582+ build_tag : str | None = None ,
581583 ) -> bool :
582584 """Validate an input for the Actor that defines an input schema.
583585
@@ -586,21 +588,33 @@ def validate_input(
586588 including an `io.IOBase` stream such as an open file, an iterable of byte chunks, or a streamed
587589 `HttpResponse`, which are uploaded in chunks without being held in memory. Streaming is experimental,
588590 and its behavior may change in future versions.
589- build_tag: The Actor's build tag.
591+ build: The Actor build to validate the input against. It can be either a build tag or build number. By
592+ default, the build specified in the default run configuration for the Actor (typically latest) is used.
590593 content_type: The content type of the input.
591594 timeout: Timeout for the API HTTP request.
595+ build_tag: Deprecated alias of `build`. Will be removed in v4.
592596
593597 Returns:
594598 True if the input is valid, else raise an exception with validation error details.
595599 """
600+ if build_tag is not None :
601+ warnings .warn (
602+ 'The `build_tag` argument is deprecated and will be removed in v4. Use `build` instead.' ,
603+ DeprecationWarning ,
604+ stacklevel = 3 ,
605+ )
606+ if build is not None :
607+ raise ValueError ('Pass only one of `build` and `build_tag`.' )
608+ build = build_tag
609+
596610 run_input , content_type = encode_key_value_store_record_value (run_input , content_type = content_type )
597611
598612 self ._http_client .call (
599613 url = self ._build_url ('validate-input' ),
600614 method = 'POST' ,
601615 headers = {'content-type' : content_type },
602616 data = run_input ,
603- params = self ._build_params (build = build_tag ),
617+ params = self ._build_params (build = build ),
604618 timeout = timeout ,
605619 )
606620
@@ -1118,9 +1132,10 @@ async def validate_input(
11181132 self ,
11191133 run_input : Any = None ,
11201134 * ,
1121- build_tag : str | None = None ,
1135+ build : str | None = None ,
11221136 content_type : str | None = None ,
11231137 timeout : Timeout = 'short' ,
1138+ build_tag : str | None = None ,
11241139 ) -> bool :
11251140 """Validate an input for the Actor that defines an input schema.
11261141
@@ -1129,21 +1144,33 @@ async def validate_input(
11291144 including an `io.IOBase` stream such as an open file, an iterable of byte chunks, or a streamed
11301145 `HttpResponse`, which are uploaded in chunks without being held in memory. Streaming is experimental,
11311146 and its behavior may change in future versions.
1132- build_tag: The Actor's build tag.
1147+ build: The Actor build to validate the input against. It can be either a build tag or build number. By
1148+ default, the build specified in the default run configuration for the Actor (typically latest) is used.
11331149 content_type: The content type of the input.
11341150 timeout: Timeout for the API HTTP request.
1151+ build_tag: Deprecated alias of `build`. Will be removed in v4.
11351152
11361153 Returns:
11371154 True if the input is valid, else raise an exception with validation error details.
11381155 """
1156+ if build_tag is not None :
1157+ warnings .warn (
1158+ 'The `build_tag` argument is deprecated and will be removed in v4. Use `build` instead.' ,
1159+ DeprecationWarning ,
1160+ stacklevel = 3 ,
1161+ )
1162+ if build is not None :
1163+ raise ValueError ('Pass only one of `build` and `build_tag`.' )
1164+ build = build_tag
1165+
11391166 run_input , content_type = encode_key_value_store_record_value (run_input , content_type = content_type )
11401167
11411168 await self ._http_client .call (
11421169 url = self ._build_url ('validate-input' ),
11431170 method = 'POST' ,
11441171 headers = {'content-type' : content_type },
11451172 data = run_input ,
1146- params = self ._build_params (build = build_tag ),
1173+ params = self ._build_params (build = build ),
11471174 timeout = timeout ,
11481175 )
11491176
0 commit comments