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:
yamlresponses: '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.
Interface
No new interfaces are introduced.
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 use or before submitting your changes. In fact, only submits currently unstaged changes because it uses to get the changes that need to be submitted. - Assistant
I'll start by exploring the repository structure and the referenced code around response
$refhandling in the DSL v4 import path. - Assistant
The v4 module is split across submodules — I'll locate
select_json_responseand related ref-resolution patterns next. - Assistant
I'll read the response import code and how
$refresolution already works for parameters/schemas. - Assistant
Let me read the rest of responses.rs and also look at how parameters resolve refs, and the existing tests.
- Assistant
Next I'll review existing openapi tests and how parameter
$refs are handled so the response fix stays consistent. - Assistant
Let me read the rest of openapi_tests.rs to see the pattern for tests, especially for unresolved responses and projection tests.
- Assistant
I'll review the unresolved response diagnostics test and plan the select_json_response change.
- Assistant
I'll implement response
$refresolution inselect_json_responseand add the regression test. - Assistant
Updating
responses.rsso response objects resolve$refbefore JSON content selection. - Assistant
The edit hit the wrong file — restoring
openapi_tests.rsand applying the change toresponses.rs. - Assistant
Good, now I'll edit the responses.rs file properly.
- Assistant
Next I'll convert
select_json_responseinto a method that resolves response$refs and returns an owned schema. - Assistant
I'll move
select_json_responseinto the importer impl and have it resolve response refs. - Assistant
The
import_responsemethod is missing its closing brace — fixing that now. - Assistant
Adding regression tests for resolved response
$refs and missing/external ref diagnostics. - Assistant
I'll append tests at the end of the file.
- Assistant
Running the openapi tests to verify the fix and new coverage.
- Assistant
All nine openapi tests passed. Running the broader coral-spec v4 suite and format check next.
- Assistant
Formatting the test file to match rustfmt.
- Assistant
The implementation looks solid. Doing a final review of the changed files, then submitting.
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.