Repository navigation
fix(openapi): scan every 2xx media type for the return schema - #917
Merged
AmaadMartin merged 2 commits intoSep 18, 2026
Merged
Conversation
added 2 commits
September 17, 2026 14:07
An OpenAPI response may declare several media types and only some of them carry a schema. The parser read the first media type only, so a return schema declared on a later entry was dropped. adk-python scans the whole content map and stops at the first entry with a schema. Extract processReturnValue into a module-level parseReturnValue so the scan is testable without widening the private returnValue field.
Revert the module-level extraction. The loop fix applies inside the private method, and a public getReturnValue() accessor gives the write-only returnValue field a reader for the tests to assert through.
Collaborator
|
Merging in about 6h unless someone objects. Close this PR, add |
Collaborator
|
Merging in about 1h unless someone objects. Close this PR, add |
adk-foundry-approver
approved these changes
Sep 18, 2026
adk-foundry-approver
left a comment
Collaborator
There was a problem hiding this comment.
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: scheduledthroughout,
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.
Merged
prasanna8585
pushed a commit
to prasanna8585/adk-js
that referenced
this pull request
Nov 10, 2026
…#917) * fix(openapi): scan every 2xx media type for the return schema An OpenAPI response may declare several media types and only some of them carry a schema. The parser read the first media type only, so a return schema declared on a later entry was dropped. adk-python scans the whole content map and stops at the first entry with a schema. Extract processReturnValue into a module-level parseReturnValue so the scan is testable without widening the private returnValue field. * fix(openapi): keep processReturnValue private, add getReturnValue Revert the module-level extraction. The loop fix applies inside the private method, and a public getReturnValue() accessor gives the write-only returnValue field a reader for the tests to assert through.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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 response may declare several media types, and only some of them
carry a
schema.OperationParserread the first media type only, so itdropped a return schema declared on a later entry. A
200response withtext/plainbeforeapplication/jsonparsed to the empty schema{}.adk-python scans the whole content map and stops at the first entry that has a
schema.
Solution:
The scan now continues past a media type that has no schema. I added a public
getReturnValue()accessor, which gives the previously write-onlyreturnValuefield a reader and lets the tests assert through the class. The2xx selection rule, lowest status code wins, is unchanged. One divergence from
adk-python: this port skips a media type whose schema is an unresolved
$ref,a case
OpenApiSpecParser.parse()makes unreachable because it resolvesreferences first.
Wiring
ParsedOperation.returnValueincollectOperationsis out of scope, soOpenApiSpecParserandRestApiToolbehave as before.Testing Plan
Unit Tests:
Four new
it()blocks incore/test/tools/openapi_tool/operation_parser_test.ts. The eleven existingtests are untouched.
Proof the tests can fail: I reverted the loop to the original single-media-type
lookup and re-ran the file. Three of the four new tests failed.
The fourth ("keep an empty return schema when no media type declares a schema")
still passed, as expected: it pins the fallback both versions share.
npm run lintandnpm run format:checkare clean on this commit.Manual End-to-End (E2E) Tests:
Not applicable. The parsed return value has no consumer on the public surface
yet, so there is no user-visible flow to drive by hand. An in-memory
OpenAPIV3.OperationObjectfully determines the behaviour.Checklist