Skip to content
TheChatArchiveThe Chat Archive
composer-2.5· unknownHugging Face ibragim-bad/swe_rebench_07_2026_trajectories

Resolve OpenAPI $ref response objects during DSL v4 import Problem DSL v4 OpenAPI import…

  1. 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_response calls select_json_response, and select_json_response looks for content directly on each response object without first resolving $ref.

    Code references:

    • crates/coral-spec/src/v4/mod.rs:972
    • crates/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: object
    

    Impact

    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 200 response that references #/components/responses/... and verifies the projection is published.

    Interface

    No new interfaces are introduced.

  2. Assistant

    I'll inspect the OpenAPI import path and how existing $ref resolution works for schemas and parameters, then add the same handling for response refs.

  3. Assistant

    Implementing response $ref resolution in select_json_response and adding a regression test.

  4. Assistant

    Merging the duplicate impl blocks, then adding tests.

  5. Assistant

    Resolved response $refs during DSL v4 OpenAPI import so operations with component response references are no longer dropped.

    Change

    select_json_response is now a method on OpenApiImporter that resolves each operation response through resolve_ref before looking for content.application/json. That reuses the same ref handling as parameters and schemas:

    • #/components/responses/... refs resolve to the component response
    • Missing refs emit OPENAPI_REF_NOT_FOUND
    • External refs emit OPENAPI_EXTERNAL_REF_UNSUPPORTED
        fn select_json_response(
            &self,
            operation_id: &str,
            responses: Option<&Map<String, Value>>,
            diagnostics: &mut Vec<Diagnostic>,
        ) -> Option<(u16, String, Value)> {
            let responses = responses?;
            let mut candidates = Vec::new();
            for (status, response) in responses {
                // ...
                let Some(resolved) = self.resolve_ref(response, operation_id, diagnostics) else {
                    continue;
                };
                let Some(content) = resolved.get("content").and_then(Value::as_object) else {
                    continue;
                };
                // ...
            }
            candidates
                .into_iter()
                .min_by_key(|(status, _, _)| (*status != 200, *status))
        }
    

    Tests

    Added two regression tests in openapi_tests.rs:

    1. importer_resolves_response_component_refs — a 200 response referencing #/components/responses/Foo produces OutputCardinality::List and a published table projection
    2. importer_warns_for_missing_response_component_refs — a missing response ref emits OPENAPI_REF_NOT_FOUND and falls back to OutputCardinality::None

    All 9 OpenAPI import tests pass.

Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.