From 71e72ffe87b5ca5660f123eb9b5ccacc8367944a Mon Sep 17 00:00:00 2001 From: VectorPeak <73048950+VectorPeak@users.noreply.github.com> Date: Fri, 3 Jul 2026 20:20:24 +0800 Subject: [PATCH 1/2] fix(openapi): preserve falsy query parameter values --- .../openapi_spec_parser/rest_api_tool.py | 2 +- .../openapi_spec_parser/test_rest_api_tool.py | 43 +++++++++++++++++++ 2 files changed, 44 insertions(+), 1 deletion(-) diff --git a/src/google/adk/tools/openapi_tool/openapi_spec_parser/rest_api_tool.py b/src/google/adk/tools/openapi_tool/openapi_spec_parser/rest_api_tool.py index 61cb6a37e43..8e9a1ee18cb 100644 --- a/src/google/adk/tools/openapi_tool/openapi_spec_parser/rest_api_tool.py +++ b/src/google/adk/tools/openapi_tool/openapi_spec_parser/rest_api_tool.py @@ -394,7 +394,7 @@ def _prepare_request_params( if param_location == "path": path_params[original_k] = v elif param_location == "query": - if v: + if v is not None and v != "": query_params[original_k] = v elif param_location == "header": header_params[original_k] = v diff --git a/tests/unittests/tools/openapi_tool/openapi_spec_parser/test_rest_api_tool.py b/tests/unittests/tools/openapi_tool/openapi_spec_parser/test_rest_api_tool.py index ad72915e12b..9c22ce001a0 100644 --- a/tests/unittests/tools/openapi_tool/openapi_spec_parser/test_rest_api_tool.py +++ b/tests/unittests/tools/openapi_tool/openapi_spec_parser/test_rest_api_tool.py @@ -1052,6 +1052,49 @@ def test_prepare_request_params_no_credential( assert "param_name" in request_params["params"] assert "empty_param" not in request_params["params"] + def test_prepare_request_params_preserves_falsy_query_parameter_values( + self, + sample_endpoint, + sample_auth_credential, + sample_auth_scheme, + sample_operation, + ): + tool = RestApiTool( + name="test_tool", + description="Test Tool", + endpoint=sample_endpoint, + operation=sample_operation, + auth_credential=sample_auth_credential, + auth_scheme=sample_auth_scheme, + ) + params = [ + ApiParameter( + original_name="include_inactive", + py_name="include_inactive", + param_location="query", + param_schema=OpenAPISchema(type="boolean"), + ), + ApiParameter( + original_name="page", + py_name="page", + param_location="query", + param_schema=OpenAPISchema(type="integer"), + ), + ApiParameter( + original_name="empty_param", + py_name="empty_param", + param_location="query", + param_schema=OpenAPISchema(type="string"), + ), + ] + kwargs = {"include_inactive": False, "page": 0, "empty_param": ""} + + request_params = tool._prepare_request_params(params, kwargs) + + assert request_params["params"]["include_inactive"] is False + assert request_params["params"]["page"] == 0 + assert "empty_param" not in request_params["params"] + @pytest.mark.parametrize( "verify_input, expected_verify_in_call", [ From 1acfe25861539741a266c01acae0b3c57c2b9743 Mon Sep 17 00:00:00 2001 From: VectorPeak <73048950+VectorPeak@users.noreply.github.com> Date: Fri, 3 Jul 2026 21:42:53 +0800 Subject: [PATCH 2/2] fix(cli): refresh import caches before agent validation --- src/google/adk/cli/cli_deploy.py | 1 + 1 file changed, 1 insertion(+) diff --git a/src/google/adk/cli/cli_deploy.py b/src/google/adk/cli/cli_deploy.py index e7fed4a4ef1..ded0a47dc93 100644 --- a/src/google/adk/cli/cli_deploy.py +++ b/src/google/adk/cli/cli_deploy.py @@ -502,6 +502,7 @@ def _validate_agent_import( # Add parent directory to path so imports work correctly if parent_dir not in sys.path: sys.path.insert(0, parent_dir) + importlib.invalidate_caches() try: module = importlib.import_module(f'{module_name}.agent') except ImportError as e: