mirror of
https://github.com/encounter/adk-python.git
synced 2026-07-09 18:19:28 -07:00
fix: accommodate for open api schema that do not have any 'properties'
PiperOrigin-RevId: 792028582
This commit is contained in:
committed by
Copybara-Service
parent
f6a022cda3
commit
25b2806301
@@ -120,7 +120,7 @@ def _sanitize_schema_formats_for_gemini(
|
||||
snake_case_schema[field_name] = [
|
||||
_sanitize_schema_formats_for_gemini(value) for value in field_value
|
||||
]
|
||||
elif field_name in dict_schema_field_names:
|
||||
elif field_name in dict_schema_field_names and field_value is not None:
|
||||
snake_case_schema[field_name] = {
|
||||
key: _sanitize_schema_formats_for_gemini(value)
|
||||
for key, value in field_value.items()
|
||||
|
||||
@@ -511,6 +511,14 @@ class TestToGeminiSchema:
|
||||
"type": "object",
|
||||
}
|
||||
|
||||
def test_to_gemini_schema_properties_is_none(self):
|
||||
"""Tests schema conversion when 'properties' field is None."""
|
||||
openapi_schema = {"type": "object", "properties": None}
|
||||
gemini_schema = _to_gemini_schema(openapi_schema)
|
||||
assert isinstance(gemini_schema, Schema)
|
||||
assert gemini_schema.type == Type.OBJECT
|
||||
assert gemini_schema.properties is None
|
||||
|
||||
|
||||
class TestToSnakeCase:
|
||||
|
||||
|
||||
Reference in New Issue
Block a user