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.
Repository has been uploaded and your shell is currently at the repository root. Time to solve the issue!
(Current directory: /coral, current file: none) bash-$
Assistant
Let me start by exploring the repository structure to understand the
Assistant
Now I can see the issue. In the
import_parametersfunction, therequiredfield is set toparameter_obj.get("required").and_then(Value::as_bool).unwrap_or(false). This means path parameters are marked as not required by default. According to the OpenAPI spec, path parameters MUST be required.Let me look at the existing tests for this importer to understand the testing pattern:
Assistant
Now let me look at the projection logic to understand how the
requiredfield is used:Assistant
me look at the git log to see relevant context:
Assistant
Let me look at the original v4/mod.rs file to find the relevant portion for path parameters:
Assistant
Now let me create a script to reproduce the issue:
Assistant
Now let me write a reproduction script:
Assistant
Let me now write a proper test to reproduce the issue. First, let me look at the existing test patterns:
Assistant
Let me look at the bottom of the file to see the rest of the tests:
Assistant
Now I have a clear understanding of the issue. Let me check the issue more closely:
Assistant
Now let me check if this was pre-existing behavior by looking at the original v4/mod.rs:
Assistant
Now I understand the issue clearly. Looking at the OpenAPI spec, path parameters MUST be required (their
requiredfield is REQUIRED and its value MUST be true). The current code defaultsrequiredtofalseif the field is missing, even for path parameters.Let me also look at how the tests are organized so I can add proper test coverage:
Assistant
Now I understand the test patterns. Let me look at the projection_tests for understanding how path parameters should be projected:
Assistant
Now let me write a small test to reproduce the issue. Let me first build the project and run the existing tests:
Assistant
All tests pass. Now let me write a small reproducer in the test directory to confirm the issue:
Assistant
Let me actually run this as a quick test to confirm the issue exists:
Assistant
Let me put the test inline in projection_tests.rs (without modifying it) to verify the issue:
Assistant
The bug is confirmed. Path parameters are imported as optional (required=false) when the
requiredfield is omitted.Now let me apply the fix:
Assistant
Now let me apply the fix:
Assistant
Let me verify the change:
Assistant
Now let me build to confirm it compiles:
Assistant
All 219 tests pass. Now let me write the focused importer/projection coverage to add to the test files. Let me look at where I should add the test:
Assistant
Now let me verify the fix works correctly by recreating the temporary test:
Assistant
All my tests pass. Let me also verify the existing tests still pass:
Assistant
All 224 tests pass (including my 5 reproduction tests). Let me also run the broader test suite:
Assistant
Let me also run any other tests that might be affected:
Assistant
These failures are in the
coral-apppackage and are not related to my changes. Let me verify by checking if these failures happen even without my changes:Assistant
Good, the failures in
coral-appare pre-existing and unrelated to my changes. Let me also run the engine tests:Assistant
Now let me clean up my temporary test file and verify the final state:
Assistant
The diff is clean. Let me run the full coral-spec tests once more to make sure everything passes:
Assistant
All 219 tests pass. Let me also make sure clippy doesn't complain:
Assistant
Clippy is clean. Let me also verify the formatting:
Assistant
Everything is good. Let me also verify by looking at the final change once more:
Assistant
Let me also run a quick verification test by recreating the repro file temporarily:
Assistant
The fix is working as expected. Let me clean up the temporary test file:
Assistant
Let me also run the test suite one more time to ensure everything is in order:
Assistant
All 219 tests pass. Let me view the final diff once more to confirm the fix:
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.
Identical first prompt
claude-sonnet-5Compare side by side →
claude-sonnet-5Compare side by side →
claude-sonnet-5Compare side by side →
claude-sonnet-5Compare side by side →
claude-sonnet-5Compare side by side →
Qwen/Qwen3.6-35B-A3BCompare side by side →
Qwen/Qwen3.6-35B-A3BCompare side by side →
Qwen/Qwen3.6-35B-A3BCompare side by side →
Qwen/Qwen3.6-35B-A3BCompare side by side →
Qwen/Qwen3.6-35B-A3BCompare side by side →
Qwen/Qwen3.5-35B-A3BCompare side by side →
Qwen/Qwen3.5-35B-A3BCompare side by side →