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:
- If an error was reported in the issue description, I have successfully reproduced it.
- If an error was reported in the issue description, I have confirmed that my fix resolves the error.
- I have thought about edge cases and made sure my fix handles them as well.
- I have run existing tests in the repository that might have been affected by the change I made and confirmed that they pass. I want you to list every bullet from this checklist and write your reasoning for why you think you did it or didn't need to.
Repository has been uploaded and your shell is currently at the repository root. Time to solve the issue!
(Current directory: /coral, current file: none) bash-$
- Assistant
I’ll first inspect the v4 importer, its existing reference-resolution helpers, and nearby regression tests so the fix follows established diagnostic and testing conventions.
- Assistant
The importer has been split into
surfaces/openapi/responses.rs, so the issue’s line references are stale. I’ll read that module plus schema/parameter resolvers and locate v4 OpenAPI fixture or inline tests. - Assistant
I found a generic
resolve_refalready used for schemas and parameters; reusing it on each response object should automatically provide consistent missing/external diagnostics. I’ll inspect its exact semantics and the existing OpenAPI publication tests before changing signatures/lifetimes. - Assistant
The generic resolver returns owned
Values and emits exactlyOPENAPI_EXTERNAL_REF_UNSUPPORTED/OPENAPI_REF_NOT_FOUND. The clean design is to make response selection an importer method that resolves each eligible 2xx response before readingcontent; unresolved refs are skipped, allowing another valid 2xx candidate while retaining diagnostics. I’ll inspect all current response diagnostics tests and catalog publication rules to ensure expected fallback behavior. - Assistant
I’ll now update response selection to return an owned schema from the resolved response object. This avoids borrowing a temporary resolved
Value, preserves the existing preference for status 200 (then lowest 2xx), and uses the shared resolver so missing/external response references emit the established diagnostic codes. - Assistant
The focused suite passes. To verify the exact reported shape without adding repository tests (explicitly prohibited by the task environment), I’ll use a temporary external Rust crate that depends on
coral-spec, imports the YAML, and asserts both list cardinality and projection publication. This directly reproduces the acceptance scenario against the modified library. - Assistant
The exact internal response-reference scenario now yields
Listand publisheslistfoos, confirming the reported failure is fixed. I’ll run the completecoral-spectest suite and Clippy for the package, then review the final diff for accidental changes.
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.
Identical first prompt
Qwen/Qwen3.6-27BCompare side by side →
Qwen/Qwen3.6-27BCompare side by side →
Qwen/Qwen3.6-27BCompare side by side →
Qwen/Qwen3.6-27BCompare side by side →
Qwen/Qwen3.6-27BCompare side by side →
- xiaomi/mimo-v2.5-proCompare side by side →
- xiaomi/mimo-v2.5-proCompare side by side →
- xiaomi/mimo-v2.5-proCompare side by side →
- gpt-5.6-solCompare side by side →
- gpt-5.6-solCompare side by side →
- gpt-5.6-solCompare side by side →