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 recently; let me find the relevant code.
- Assistant
Now let me look at the existing ref resolution and diagnostics patterns.
- Assistant
Now I'll implement the fix in
responses.rs— resolve each response$refbefore selecting the JSON response: - Assistant
Now add the regression test:
- Assistant
All 206 unit tests plus the doctest pass, and clippy is clean.
Summary
Fix (
crates/coral-spec/src/v4/surfaces/openapi/responses.rs):import_responsenow resolves each response object through the existingresolve_refhelper before handing the responses map toselect_json_response. A new privateresolve_responsesmethod maps eachstatus → responseentry throughresolve_ref, dropping entries whose refs can't be resolved (afterresolve_refemits its diagnostic).- Since
resolve_refclones plain objects and resolves#/...pointers, inline responses behave exactly as before;$refresponses like#/components/responses/Fooare now dereferenced so theircontent.application/json.schemais found and the operation gets a real cardinality instead of falling through to .
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.