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
Let me start by exploring the repository structure to understand what we're working with.
Assistant
Let me explore the v4 module structure since the issue mentions the refactor from PR #1149.
Assistant
Now I can see the issue clearly. Let me look at the IR model and check the existing tests.
Assistant
Now let me look at the projections to understand how this might affect them.
Assistant
me look at PR #1149 which is the refactor mentioned in the issue.
Assistant
Let me look at projection_tests.rs to understand the existing test patterns:
Assistant
Now let me look at how the path parameter is currently imported and the issue clearly. Let me check the existing test that exercises this:
Assistant
Now let me look at the existing test file to find a place to add a focused test:
Assistant
Now let me look at the existing mod.rs to understand the public API and re-exports:
Assistant
Now let me look at the projection/model.rs file:
Assistant
let me first reproduce the issue with a quick test:
Assistant
Let me run the existing tests first to make sure everything passes before changes:
Assistant
Now let me write a test to reproduce the bug:
Assistant
Let me create a different approach using a Cargo test binary:
Assistant
The integration test approach is more complex. Let me delete it and use the inline approach with a unit test directly:
Assistant
Let me use a different approach - add a temporary test inside the existing test file:
Assistant
I've confirmed the bug. Let me apply the fix to the importer:
Assistant
Now I'll apply the fix. Per the OpenAPI 3.0 spec, path parameters must always be
required: true. When the field is omitted, we should default totruefor path parameters and preserve explicit values for non-path parameters:Assistant
Now I'll apply the fix:
Assistant
see I made a mistake with the edit. Let me fix it:
Assistant
I see the issue - the edit duplicated code. Let me revert and try again:
Assistant
Good, the file is back to its original state. Let me now make the fix properly. I'll use the
replacecommand to make a targeted edit:Assistant
Let me use
replacewith the full block:Assistant
Now let me apply the edit properly using line-based edit:
Assistant
Now I need to add the
openapi_parameter_defaults_requiredhelper function. Let me find a good place at the bottom of the file:Assistant
Now let me add the helper function at the bottom of the file:
Assistant
Now let me verify the file compiles:
Assistant
Now let me verify the fix by running the temp test I added earlier:
Assistant
The fix works. Now let me remove the temporary test and add proper test coverage:
Assistant
Let me remove the temporary test:
Assistant
Now let me look at the structure of the existing tests to add proper test coverage:
Assistant
Now let me add a focused importer test for the path parameter requirement behavior. I'll add it after the existing
importer_preserves_non_string_parameter_defaultstest:Assistant
Let me check where the file ends:
Assistant
Now let me add focused test coverage. I'll add the importer test in
openapi_tests.rsand a projection test inprojection_tests.rs. First, let me add the importer test:Assistant
Now let me run these new tests to make sure they pass:
Assistant
I need to fix the tuple destructuring. Let me fix the test:
Assistant
see - my edit was applied to the wrong file. Let me revert and fix this properly:
Assistant
Now let me re-apply the fix to operations.rs and the test edits to the right file:
Assistant
Good, the test file is in its original state with the test added at the end. Now let me fix the broken tuple type:
Assistant
see there's a duplicate line. Let me check the file carefully and remove the duplicate:
Assistant
see the issue. The edit tool replaced the original block but kept some original content. Let me check more carefully:
Assistant
see the issue - my edit accidentally removed the
let operation = ...declaration. Let me revert and try again:Assistant
Now let me re-add the tests with proper structure:
Assistant
Now let me re-apply the fix to operations.rs:
Assistant
Let me look at the file at line 161 and apply the edit properly
Assistant
Now let me apply the fix to operations.rs:
Assistant
Now let me add the helper function at the end:
Assistant
Now let me run the tests:
Assistant
I see - BTreeMap expects (K, V) pairs but I'm passing 3-element tuples. Let me fix the test:
Assistant
Let me refactor the test to use a Vec and find the entry directly:
Assistant
Now let me run the tests again:
Assistant
edit removed
let operation = ir.operations.first().... Let me check the file:Assistant
Yes, the
let operationline got removed. Let me add it back:Assistant
Now let me run the tests:
Assistant
All tests pass. Now let me also add a focused projection test:
Assistant
All tests pass. Now let me run the entire coral-spec test suite to make sure nothing else is broken:
Assistant
All 222 tests pass. Now let me also run the broader test suite to make sure nothing is broken:
Assistant
Let me check if those failures are related to my changes:
Assistant
This test failure is unrelated to my changes. Let me verify by checking against the original code:
Assistant
The test failure is pre-existing and unrelated to my changes. Let me check my changes are still in place:
Assistant
All my changes look good. Let me run the tests once more to make sure everything is good:
Assistant
All 25 v4 tests pass. Now let me run the full test suite for coral-spec:
Assistant
Now let me also test the other relevant crates (coral-app, coral-cli, coral-engine) to make sure nothing is broken there:
Assistant
Let me also run the full build to ensure no compile errors:
Assistant
All compiles successfully. Let me also check that clippy is happy:
Assistant
Clippy is happy too. Let me also do a final review of the change to ensure everything is good:
Assistant
Now let me also verify that my changes handle all the edge cases by running the v4 tests once more:
Assistant
All 3 new tests pass. Let me also confirm the broader integration with the projection generation. Let me look at how the projection's
requiredis used downstream to confirm the fix has the desired effect:Assistant
This confirms my analysis. With the fix, the Singleton outputs with path parameters will be properly classified as TableFunctions instead of being misclassified as a regular table with optional filters.
Let me run the entire v4 test suite once more to confirm everything is in order:
Assistant
All 25 v4 tests pass. Let me also check that the
format!macros are properly formatted with cargo fmt:Assistant
Formatting is good. Let me now look at the file once more to make sure everything is correct:
Assistant
Let me also check the workspace tests to be sure:
Assistant
All tests pass. Let me do a final verification:
Assistant
Let me also verify by checking the final state of changes:
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.