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 how response selection and existing
$refresolution work in the v4 importer, then add response ref resolution and a regression test. - Assistant
Implementing response
$refresolution inimport_responsebefore JSON selection, matching how parameters are handled. - Assistant
Both tests passed. Running the full coral-spec test suite and checking lints.
- Assistant
Resolved OpenAPI response
$refs during DSL v4 import.Change
In
import_response, each operation response is now resolved through the existingresolve_refhelper beforeselect_json_responselooks for JSONcontent. This mirrors parameter handling: unresolved refs are skipped and diagnostics are emitted via the same codes (OPENAPI_REF_NOT_FOUND,OPENAPI_EXTERNAL_REF_UNSUPPORTED).let resolved_responses = operation .get("responses") .and_then(Value::as_object) .map(|responses| { let mut resolved = Map::new(); for (status, response) in responses { let Some(response) = self.resolve_ref(response, operation_id, diagnostics) else { continue; }; resolved.insert(status.clone(), response); } resolved }); let Some((status_code, media_type, schema)) = select_json_response(resolved_responses.as_ref())
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.