Resolve OpenAPI $ref response objects during DSL v4 import Problem DSL v4 OpenAPI import…
- User
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.
- Assistant
The module was split since the issue was filed. Let me find the relevant functions.
- Assistant
Now let me look at the resolver and how parameter refs handle diagnostics:
- Assistant
Now let me look at the existing tests to understand the patterns:
- Assistant
Now I'll implement the fix in
responses.rs: - Assistant
Now let me verify it compiles:
- Assistant
Compiles. Now add the regression tests:
- Assistant
All tests pass. Let me run the full crate test suite plus fmt/clippy:
- Assistant
All checks pass: fmt clean, clippy clean, 206 tests passing.
Summary
The issue referenced
crates/coral-spec/src/v4/mod.rs:972/:1290, but that module was split by concern in commit2be31a9— the code now lives incrates/coral-spec/src/v4/surfaces/openapi/responses.rs.Fix (
responses.rs):- Added
OpenApiImporter::resolve_success_responses(responses.rs:100), which walks the operation'sresponsesmap, filters to 2xx statuses, and resolves each response object through the existingresolve_refhelper before anycontentinspection. This means$ref: '#/components/responses/...'entries are now dereferenced. - Reworked
select_json_response(responses.rs:124) to take the pre-resolved list instead of the raw responses map; its selection logic (prefer , else lowest 2xx with an body) is unchanged.
- Added
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.