ISSUE DESCRIPTION Treat OpenAPI path parameters as required in v4 import This tracks…
- User
ISSUE DESCRIPTION
Treat OpenAPI path parameters as required in v4 import This tracks unresolved feedback identified by cubic on PR #1149: https://github.com/withcoral/coral/pull/1149#discussion_r3347190640
Context: This appears to be pre-existing DSL v4 behavior surfaced by the refactor review, not a regression from the module split.
Problem: OpenAPI path parameters are imported as optional when
requiredis omitted, even though path parameters are required by OpenAPI. This can misclassify required path inputs as optional SQL filters.Acceptance criteria: Import path parameters as required regardless of an omitted
requiredfield, preserve explicit behavior for non-path parameters, and add focused importer/projection coverage.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.CHECKLIST
Before submitting your solution, please go over the following checklist and make sure you've done everything:
- If an error was reported in the issue description, I have successfully reproduced it.
- If an error was reported in the issue description, I have confirmed that my fix resolves the error.
- I have thought about edge cases and made sure my fix handles them as well.
- I have run existing tests in the repository that might have been affected by the change I made and confirmed that they pass. I want you to list every bullet from this checklist and write your reasoning for why you think you did it or didn't need to.
- Assistant
I'll start by exploring the repository structure to understand the codebase and locate relevant files for the OpenAPI import issue. Let's first get an overview.
- Assistant
This seems to be a larger repository with Rust crates and a UI. The issue mentions OpenAPI path parameters being imported as optional when
requiredis omitted. This likely relates to an OpenAPI importer. Let's search for relevant files containing "openapi" or "import". - Assistant
Let's examine the OpenAPI import file to understand how path parameters are currently handled.
- Assistant
Let me see the full file and the operations file.
- Assistant
Now let me look at the operations.rs file where parameters are likely imported:
- Assistant
Let me continue reading to see how parameters are imported.
- Assistant
Now I see the issue! Looking at lines 158-161, the
requiredfield defaults tofalsewhen therequiredfield is missing from the OpenAPI parameter object. However, according to the OpenAPI specification, path parameters (within: path) are always required. The fix should be to make path parameters required by default while preserving explicit behavior for non-path parameters.Let me first examine the
OpenApiParameterLocationenum to understand the types: - Assistant
Let me examine the IR model to understand the types:
- Assistant
Let me find the OpenApiParameterLocation enum.
- Assistant
Now I see the
OpenApiParameterLocationenum has aPathvariant (line 109-115). The issue is clear: inoperations.rsline 158-161, therequiredfield defaults tofalsewhen therequiredfield is omitted. For path parameters, we should default totrueinstead.Let me check the existing tests to understand the expected behavior:
- Assistant
Let me search for tests related to path parameters to understand the existing behavior:
- Assistant
Let me also check the projection tests since the issue mentions "projection coverage":
- Assistant
Let me check the test_support module to see the github_openapi fixture and understand the test data:
- Assistant
Let me check how the projection uses the
requiredfield: - Assistant
Let me examine the projection derivation logic to see how
requiredaffects SQL exposure: - Assistant
Let me continue reading the derive.rs file to see the
projection_input_sql_exposurefunction: - Assistant
Now I understand the issue clearly. Let me look at the existing tests and then create a fix. First, let me check if there are any tests that test path parameters without explicit
requiredfield: - Assistant
Now let me run the existing tests to see if they pass:
- Assistant
Now let me run the projection tests:
- Assistant
I need to be in the right directory. Let me check the current directory.
- Assistant
Now I have a clear understanding of the issue. Let me summarize:
- In
operations.rs(lines 158-161), path parameters default torequired: falsewhen therequiredfield is omitted. - Per OpenAPI spec, path parameters MUST be required.
- The
requiredflag affects projection generation: it can make projectionsHiddenif a required input can't be exposed in SQL.
Let me fix the issue in
operations.rs: - In
- Assistant
The edit removed the
requiredfield entirely! Let me fix this properly: - Assistant
Good, I've updated the logic. Now I need to verify that the
OpenApiParameterLocationenum is in scope: - Assistant
Let me check the imports at the top of the file:
- Assistant
Good,
OpenApiParameterLocationis already imported. Now let me compile and run the tests to verify the fix works: - Assistant
Good, the existing tests pass. Now let me run the projection tests:
- Assistant
Excellent, all existing tests pass. Now I need to add focused test coverage as per the acceptance criteria. Let me create a comprehensive test to verify the behavior. First, let me check the structure of the test files to understand where to add tests:
- Assistant
Now let me add a focused test to verify the fix. I'll add a test that checks path parameters without explicit
requiredfield are imported as required: - Assistant
Now let me run the new tests to verify they pass:
- Assistant
Now let me run the second test:
- Assistant
Now I need to add projection coverage as well. Let me add a projection test that verifies path parameters are correctly handled:
- Assistant
Let me run the new projection test:
- Assistant
Excellent! All tests pass. Now let me also run all the tests in the module to make sure nothing is broken:
- Assistant
Let me also run the projection tests to make sure everything is fine:
- Assistant
Perfect! All tests pass. Let me also run a broader test to make sure I haven't broken anything else:
- Assistant
Perfect! All 222 tests pass. Now let me also check if there are any other crates that might be affected by this change:
- Assistant
Let me also check if there are any other crates in the repository that might be affected:
- Assistant
Let me check if the coral-app crate uses the
requiredfield: - Assistant
Let me run tests for the whole workspace to make sure nothing is broken:
- Assistant
There are 2 failing tests in the grpc tests, but they don't seem to be related to my changes (they're about cleanup and rollback failures). Let me check if these tests were already failing before my changes:
- Assistant
Let me check if those failing tests are related to my changes by running them individually:
- Assistant
This test is failing regardless of my changes, which suggests it's a pre-existing issue. Let me verify by reverting my changes temporarily and running the test:
- Assistant
Now let me run the failing test without my changes:
- Assistant
The test was already failing before my changes, so it's a pre-existing issue. Let me restore my changes:
- Assistant
Now let me run the coral-spec tests again to make sure everything is still passing:
- Assistant
Perfect! All 222 tests in coral-spec pass. Now let me also check if the test_support.rs fixture should be updated to remove explicit
required: truefor path parameters to better test the fix: - Assistant
Let me check if there are other test fixtures that might need updating:
- Assistant
Let me also run a broader test to make sure I haven't introduced any new issues:
- Assistant
Perfect! All tests pass. Let me verify the changes I made by looking at the diff:
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.