diff --git a/src/google/adk/tools/openapi_tool/openapi_spec_parser/operation_parser.py b/src/google/adk/tools/openapi_tool/openapi_spec_parser/operation_parser.py index 930e05c..a7bed0f 100644 --- a/src/google/adk/tools/openapi_tool/openapi_spec_parser/operation_parser.py +++ b/src/google/adk/tools/openapi_tool/openapi_spec_parser/operation_parser.py @@ -83,7 +83,8 @@ class OperationParser: schema.description = ( description if not schema.description else schema.description ) - required = param.required + # param.required can be None + required = param.required if param.required is not None else False self.params.append( ApiParameter( diff --git a/tests/unittests/tools/openapi_tool/openapi_spec_parser/test_operation_parser.py b/tests/unittests/tools/openapi_tool/openapi_spec_parser/test_operation_parser.py index 0c774f6..653590e 100644 --- a/tests/unittests/tools/openapi_tool/openapi_spec_parser/test_operation_parser.py +++ b/tests/unittests/tools/openapi_tool/openapi_spec_parser/test_operation_parser.py @@ -347,8 +347,8 @@ def test_get_json_schema(sample_operation): assert json_schema['type'] == 'object' assert 'param1' in json_schema['properties'] assert 'prop1' in json_schema['properties'] - assert 'param1' in json_schema['required'] - assert 'prop1' in json_schema['required'] + # By default nothing is required unless explicitly stated + assert 'required' not in json_schema or json_schema['required'] == [] def test_get_signature_parameters(sample_operation):