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 the smallest consistent fix. I’ll run the focused test suite (and add no repository tests, per instructions), using temporary reproduction checks if needed, and inspect the final diff before submission. - Assistant
The first inspection command failed before producing output, so I’m checking the repository layout and exact file names before continuing.
- Assistant
The current importer already has the required local/external reference diagnostics in
resolve_ref, but response selection happens before that helper is called. I’ll make selection an importer method, resolve each successful 2xx response object before inspectingcontent, and return owned schema values so resolved document nodes can be used safely. Unresolvable response candidates will be skipped while retaining their diagnostics, allowing another valid response (if present) to be selected. - Assistant
The code change is in place and preserves existing schema
$refhandling. Response references now flow through the same diagnostic path as parameters and schemas; the resolved response’s JSON schema is then passed through the existing schema resolver. I’m running formatting and the coral-spec tests now, then I’ll perform a direct temporary import check for the exact YAML shape. - Assistant
Compilation caught one ownership adjustment from changing the selector’s return type from a borrowed schema to an owned
Value. I’ll borrow that owned value when invoking the existing resolver, then rerun the focused tests. - Assistant
All 204
coral-speclibrary tests pass, andgit diff --checkreports no whitespace errors. The existing unresolved-schema diagnostic test remains green. The exact reported shape is handled as follows:#/components/responses/Fooresolves to the response object, itsapplication/jsonschema is selected, and the schema then resolves/imports normally, yielding a non-Noneoutput suitable for projection publication. I’m submitting the focused implementation.
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.