🔴 Required Information
Describe the Bug:
When OperationParser expands an object request body into function parameters, it does not copy the schema required list into ApiParameter.required. As a result, required request-body properties are omitted from the generated function declaration required list and appear optional to the model.
Steps to Reproduce:
- Parse an operation containing this request-body schema:
type: object
required:
- spaceName
- tmsZoneId
properties:
spaceName:
type: string
tmsZoneId:
type: string
description:
type: string
- Inspect
OperationParser.get_parameters() or get_json_schema().
Expected Behavior:
spaceName and tmsZoneId have required=True and appear in the generated JSON Schema required list. description remains optional.
Observed Behavior:
All three body parameters have required=False:
[("spaceName", False), ("tmsZoneId", False), ("description", False)]
This makes generated tool signatures advertise required API fields as optional, allowing the model to omit them and send invalid requests.
Environment Details:
- ADK Library Version: reproduced with 2.0.0 and current
main at fb55d4a669e35fd9da69bbb951945d1a19792f9f
- Desktop OS: macOS
- Python Version: 3.13.5
Model Information:
- Are you using LiteLLM: N/A
- Which model is being used: N/A; this reproduces directly in the OpenAPI parser
🟡 Optional Information
Regression:
The related fix in #256 propagated required for regular operation parameters, but _process_request_body does not apply the object schema required list when it constructs flattened body parameters.
Additional Context:
For object bodies, the fix can derive required_properties = set(schema.required or []) and pass required=prop_name in required_properties when constructing each ApiParameter. I am preparing a focused PR with a regression test.
Minimal Reproduction Code:
from fastapi.openapi.models import MediaType, Operation, RequestBody, Schema
from google.adk.tools.openapi_tool.openapi_spec_parser.operation_parser import OperationParser
operation = Operation(
operationId="createSpace",
requestBody=RequestBody(
required=True,
content={
"application/json": MediaType(
schema=Schema(
type="object",
required=["spaceName", "tmsZoneId"],
properties={
"spaceName": Schema(type="string"),
"tmsZoneId": Schema(type="string"),
"description": Schema(type="string"),
},
)
)
},
),
)
parser = OperationParser(operation)
print([
(parameter.original_name, parameter.required)
for parameter in parser.get_parameters()
])
How often has this issue occurred?:
🔴 Required Information
Describe the Bug:
When
OperationParserexpands an object request body into function parameters, it does not copy the schemarequiredlist intoApiParameter.required. As a result, required request-body properties are omitted from the generated function declaration required list and appear optional to the model.Steps to Reproduce:
OperationParser.get_parameters()orget_json_schema().Expected Behavior:
spaceNameandtmsZoneIdhaverequired=Trueand appear in the generated JSON Schemarequiredlist.descriptionremains optional.Observed Behavior:
All three body parameters have
required=False:This makes generated tool signatures advertise required API fields as optional, allowing the model to omit them and send invalid requests.
Environment Details:
mainatfb55d4a669e35fd9da69bbb951945d1a19792f9fModel Information:
🟡 Optional Information
Regression:
The related fix in #256 propagated
requiredfor regular operation parameters, but_process_request_bodydoes not apply the object schema required list when it constructs flattened body parameters.Additional Context:
For object bodies, the fix can derive
required_properties = set(schema.required or [])and passrequired=prop_name in required_propertieswhen constructing eachApiParameter. I am preparing a focused PR with a regression test.Minimal Reproduction Code:
How often has this issue occurred?: