ISSUE DESCRIPTION Resolve OpenAPI $ref response objects during DSL v4 import Problem DSL…
- User
ISSUE DESCRIPTION
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.
ADDITIONAL ADVICE
Since you are given a git repository, you can use git commands to simplify your work. For example, if you made a mistake and want to revert your changes, you can use
git checkout <file>to restore the file to its original state. You can also reset all changes in the repository usinggit reset --hardcommand. Additionally, you can usegit stashandgit stash popto temporarily save your changes and restore them later. Finally, you can see the changes that you've made (which will be submitted when you callsubmit) usinggit statusorgit diffcommands. However you don't need to usegit addorgit commitbefore submitting your changes. In fact,submitonly submits currently unstaged changes because it usesgit diffto get the changes that need to be submitted. Assistant
Now let's look at
resolve_refin import.rs to understand the pattern used for schema/parameter refs.Assistant
Now add the
resolve_responseshelper method to theimplblock:Assistant
Now let's build to check for compile errors.
Assistant
Build succeeds. Now let's check existing tests related to import_response/openapi_tests to add a regression test.
Assistant
Let's check
generate_projection_catalogusage/import andProjectionKindto write a proper regression test.Assistant
Now let's check
operation.diagnosticsfield exists on IrOperation - let's check ir.rs.Assistant
Good. Now let's run the tests.
Assistant
super::*should bringProjectionVisibilitysince it's re-exported in mod.rs. Let's add an assertion on visibility being Published to strengthen the regression test.Assistant
"widgets/list" → "widgets_list" (non-alphanumeric replaced by single underscore). Let's fix the test.
Assistant
All tests pass now. Let's run the full test suite for coral-spec to ensure nothing broke.
Assistant
All 206 tests pass. Let's also run cargo clippy/fmt check for the modified files to ensure code quality.
Assistant
Clippy is clean too. Now let's view the final diff for review.
Assistant
The diff looks clean and focused. Let's double check the second regression test uses
OutputCardinality::None— reflecting fallback behavior whenselect_json_responsefinds no candidates (since the unresolved ref is dropped, no entries remain). That matches current fallback logic inimport_response.Assistant
All v4-related tests pass. Now let's go through the checklist.
Assistant
Let's check if any other crate depends on coral-spec and might be affected (e.g., consuming import_openapi_surface).
Assistant
Since our change only affects internal resolution logic and doesn't change public API signatures, other crates shouldn't be impacted. Let's do a quick workspace build to be thorough.
Assistant
Whole workspace builds successfully. Now let's finalize.
Assistant
Let me verify the fix actually addresses the reported issue by temporarily reverting the core fix and confirming the new regression test fails.
Assistant
Confirmed: without the fix, cardinality is
Noneinstead ofList, exactly reproducing the reported issue. Now restore the fix.Assistant
The fix is confirmed to resolve the issue. Let's run the full test suite one more time before submitting.
Assistant
All tests pass. Let me review the final diff once more.
Assistant
This is a clean, minimal fix. Let me go through the checklist explicitly:
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.