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:
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.
Interface
No new interfaces are introduced.
- Assistant
I'll inspect the OpenAPI import code and how other
$refs are resolved so we can apply the same pattern to responses. - Assistant
Implementing response
$refresolution inselect_json_response, then adding a regression test. - Assistant
Resolved response
$refs during DSL v4 OpenAPI import by moving JSON response selection ontoOpenApiImporterand resolving each response through the existingresolve_refhelper before looking forcontent.Change
In
responses.rs,select_json_responseis now a method onOpenApiImporterthat:- Calls
resolve_refon each 2xx response before checking forapplication/jsoncontent - Skips responses whose refs can't be resolved (with the same
OPENAPI_REF_NOT_FOUND/OPENAPI_EXTERNAL_REF_UNSUPPORTEDdiagnostics used elsewhere) - Returns an owned schema
Value(needed because resolved refs are cloned from the document)
Tests
Added two regression tests in
openapi_tests.rs:importer_resolves_response_refs_before_selecting_json_content— a200response referencing#/components/responses/FooproducesOutputCardinality::Listand a published projectionimporter_warns_for_unresolved_response_refs— a missing response ref emitsOPENAPI_REF_NOT_FOUNDand falls back to
- Calls
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.