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 recently split. Let me find the actual code.
- Assistant
Now let me look at the existing tests to follow the pattern.
- Assistant
Now add the regression test:
- Assistant
All v4 tests pass, including the two new ones. Now run the full crate test suite plus clippy/fmt:
- Assistant
Done. The fix and verification:
Change
crates/coral-spec/src/v4/surfaces/openapi/responses.rs—select_json_responsewas a free function that readcontentdirectly off each response object, so a200: {$ref: '#/components/responses/Foo'}looked like a response with no JSON content and the importer fell through toOutputCardinality::None.It's now a method on
OpenApiImporterthat calls the existingresolve_refon each 2xx response object before looking forcontent(responses.rs:106-138). This means:- Local refs like
#/components/responses/Fooare resolved, so the response's /schema is found and the operation gets its real cardinality.
- Local refs like
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.