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
Now let me look at the existing tests to add a regression test consistently.
- Assistant
Now add the regression test:
- Assistant
Done. The issue referenced
v4/mod.rs:972/:1290, but that module was split by concern in a recent refactor (2be31a9) — the code now lives incrates/coral-spec/src/v4/surfaces/openapi/responses.rs.Fix (
responses.rs):- Converted
select_json_responsefrom a free function into a method onOpenApiImporterso it can resolve refs. For each 2xx response it now callsself.resolve_ref(...)before looking forcontent, soresponses: {'200': {$ref: '#/components/responses/Foo'}}is followed intocomponents.responses(responses.rs:116). - Missing refs emit the existing
OPENAPI_REF_NOT_FOUNDdiagnostic and external refs emitOPENAPI_EXTERNAL_REF_UNSUPPORTED— the same codes used for schema and parameter refs, since it reuses the shared in . An unresolvable response ref is skipped (like unresolvable parameters), leaving the fall-through behavior for genuinely absent JSON responses intact.
- Converted
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.