Skip to content

fix(openapi): emit the body argument for a schema-less request body - #907

Merged
AmaadMartin merged 1 commit into
google:mainfrom
AmaadMartin:fix/openapi-schemaless-request-body-argument
Sep 16, 2026
Merged

AmaadMartin merged 1 commit into
google:mainfrom
AmaadMartin:fix/openapi-schemaless-request-body-argument

Conversation

@adk-foundry-bot

@adk-foundry-bot adk-foundry-bot commented Sep 15, 2026 •

Copy link
Copy Markdown
Collaborator

This pull request will be merged automatically

Scheduled merge: 2026-09-16 21:25 UTC (about 24h from opening).

It was selected by [ADK Foundry] because the merge critic approved
the change, it is small, it touches no sensitive path, and CI is
green. No human has reviewed it.

To stop it: close this pull request, add the status/on-hold
label, or leave a review comment. Any of the three cancels the
merge; pushing a commit restarts the clock. Nothing is merged while
a question is open.

Approving does not stop it. An approval, or a comment that says
only lgtm, lets the merge run on schedule. Add any other text and
the merge stops.

Staged from fork PR #1027.

Link to Issue or Description of Change

1. Link to an existing issue (if applicable):

N/A

2. Or, if no issue exists, describe the change:

Problem:

An OpenAPI media type object may omit schema, as in content: {'application/json': {}}. OperationParser.processRequestBody() skips the request body in that case. The generated tool then advertises no body argument, so RestApiTool cannot send a payload. adk-python reads the same spec as an unconstrained body and advertises a body argument for it.

Solution:

The missing schema now defaults to {}. That value falls into the existing untyped arm, which names the parameter body. This matches _process_request_body in adk-python. I keep the empty schema rather than a synthesized {type: 'object'}, because the second form adds a constraint the spec does not state.

A $ref request body and a $ref media type schema behave as before.

Testing Plan

Unit Tests:

  • I have added or updated unit tests for my change.
  • All unit tests pass locally.

Four new tests, no existing test edited:

  • operation_parser_test.ts: a schema-less media type yields one body parameter with an empty paramSchema.
  • operation_parser_test.ts: getJsonSchema().properties has body, so the model can see the argument.
  • operation_parser_test.ts: an empty content object still yields zero parameters.
  • rest_api_tool_test.ts: the parsed parameter drives prepareRequestParams and prepareRequestBody, and the payload goes out as JSON.

I reverted the source change and re-ran both files. Three of the four new tests failed, so they hold the new behavior.

npx vitest run --project unit:core \
  core/test/tools/openapi_tool/operation_parser_test.ts \
  core/test/tools/openapi_tool/rest_api_tool_test.ts   # 58 passed
npm run ts:check                                       # clean
npx eslint <the three changed files>                   # clean
npx prettier --check <the three changed files>         # clean

Manual End-to-End (E2E) Tests:

The change touches no network, credential, or model surface. The prepareRequestParams to prepareRequestBody test stands in for an E2E run, because it proves the parsed parameter reaches the request.

Checklist

  • I have read the CONTRIBUTING.md document.
  • I have performed a self-review of my own code.
  • I have commented my code, particularly in hard-to-understand areas.
  • I have added tests that prove my fix is effective or that my feature works.
  • New and existing unit tests pass locally with my changes.

An OpenAPI media type object may omit `schema`. That describes an
unconstrained payload, not the absence of one, so the generated tool must
still accept a body. OperationParser dropped the parameter entirely, and
RestApiTool could never send a body for such an operation.

Default the missing schema to `{}`, which routes the request body into the
existing untyped arm and matches adk-python's `_process_request_body`.
@AmaadMartin AmaadMartin added the automerge: scheduled Foundry will merge this automatically; close it to stop that label Sep 15, 2026
@AmaadMartin

Copy link
Copy Markdown
Collaborator

Merging in about 6h unless someone objects. Close this PR, add status/on-hold, or comment to stop it. Approving, or commenting only lgtm, lets it merge. No human has reviewed this change.

@AmaadMartin

Copy link
Copy Markdown
Collaborator

Merging in about 1h unless someone objects. Close this PR, add status/on-hold, or comment to stop it. Approving, or commenting only lgtm, lets it merge. No human has reviewed this change.

@adk-foundry-approver adk-foundry-approver left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved automatically by ADK Foundry. No human has read this change.

This approval attests only that the change passed the gates below, all
enforced in code:

  • the merge critic read the diff and approved it (93.9% precision measured
    against 107 upstream pull requests with known maintainer outcomes)
  • ? changed lines across ? file(s), inside the 200/5 ceiling
  • no auth, credential, security, release or dependency-manifest path touched
  • required checks green, re-verified immediately before this approval
  • opened 25h ago and visible as automerge: scheduled throughout,
    with no objection from anyone

To stop this merging, close the pull request or add status/on-hold. To stop
the mechanism entirely, revoke this account's access; delivery continues and
nothing merges.

@AmaadMartin
AmaadMartin merged commit aad4b8a into google:main Sep 16, 2026
15 checks passed
@AmaadMartin AmaadMartin added automerge: merged Merged automatically by Foundry after its 24h review window expired with no objection and removed automerge: scheduled Foundry will merge this automatically; close it to stop that labels Sep 16, 2026
@kalenkevich kalenkevich mentioned this pull request Sep 16, 2026
prasanna8585 pushed a commit to prasanna8585/adk-js that referenced this pull request Nov 10, 2026
…ogle#907)

An OpenAPI media type object may omit `schema`. That describes an
unconstrained payload, not the absence of one, so the generated tool must
still accept a body. OperationParser dropped the parameter entirely, and
RestApiTool could never send a body for such an operation.

Default the missing schema to `{}`, which routes the request body into the
existing untyped arm and matches adk-python's `_process_request_body`.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

automerge: merged Merged automatically by Foundry after its 24h review window expired with no objection

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants