Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/google/adk/cli/cli_deploy.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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",
[
Expand Down