ISSUE DESCRIPTION Resolve OpenAPI $ref response objects during DSL v4 import Problem DSL…
- User
ISSUE DESCRIPTION
Resolve OpenAPI $ref response objects during DSL v4 import
Problem
DSL v4 OpenAPI import currently misses valid response objects that are expressed as
$refs.import_responsecallsselect_json_response, andselect_json_responselooks forcontentdirectly on each response object without first resolving$ref.Code references:
crates/coral-spec/src/v4/mod.rs:972crates/coral-spec/src/v4/mod.rs:1290
A valid OpenAPI shape like this is treated as if the operation has no JSON response:
responses: '200': $ref: '#/components/responses/Foo' components: responses: Foo: content: application/json: schema: type: array items: type: objectImpact
The importer falls through to
OutputCardinality::None, which causes otherwise valid read operations to be hidden/dropped from the generated projection catalog. This can make major portions of a real OpenAPI descriptor disappear from DSL v4 sources.Acceptance criteria
- Response
$refs under operation responses are resolved before selecting JSON responses. - Missing or external response refs produce diagnostics consistent with existing schema/parameter ref diagnostics.
- A regression test covers a
200response that references#/components/responses/...and verifies the projection is published.
ADDITIONAL ADVICE
Since you are given a git repository, you can use git commands to simplify your work. For example, if you made a mistake and want to revert your changes, you can use
git checkout <file>to restore the file to its original state. You can also reset all changes in the repository usinggit reset --hardcommand. Additionally, you can usegit stashandgit stash popto temporarily save your changes and restore them later. Finally, you can see the changes that you've made (which will be submitted when you callsubmit) usinggit statusorgit diffcommands. However you don't need to usegit addorgit commitbefore submitting your changes. In fact,submitonly submits currently unstaged changes because it usesgit diffto get the changes that need to be submitted.CHECKLIST
Before submitting your solution, please go over the following checklist and make sure you've done everything:
- Assistant
I’ll trace the v4 response import and existing
$refresolution patterns, then implement response-reference resolution with matching diagnostics. I’ll run focused tests (and a temporary reproduction if needed), inspect the diff, and submit only after verification. - Assistant
The initial source excerpt did not render, so I’m locating the exact functions and nearby reference-resolution helpers with repository search before editing.
- Assistant
The importer already has a centralized
resolve_refthat emits the required external and missing-reference diagnostics. I’ll make JSON-response selection an importer method, resolve each successful-status response entry before readingcontent, and preserve owned values so the resolved response can safely be returned. This also leaves schema$refhandling unchanged and allows its existing diagnostics to apply afterward. - Assistant
The implementation is now in place. The formatter reported only a syntactic line-wrap difference, so I’ll format the file and run the v4 OpenAPI tests. I’ll also use a temporary standalone test invocation through the existing test suite rather than modifying repository tests.
- Assistant
Compilation caught the expected ownership adjustment: after changing the selected schema from a borrowed value to an owned
Value, the existing schema resolver call must borrow it. I’ll make that one-line correction and rerun the focused tests. - Assistant
The focused OpenAPI suite passes (7 tests), and formatting/diff checks are clean. The fix resolves response objects before inspecting media content, while unresolved local/external refs now flow through the same diagnostic codes as parameters and schemas. I’ll run the full
coral-spectest suite and inspect the final diff for unintended changes.
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.