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.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 understanding the repository structure and the issue at hand. The issue is about OpenAPI path parameters being imported as optional when
requiredis omitted, even though path parameters are required by OpenAPI specification. I need to:- Find the relevant code that handles OpenAPI import
- Fix it so path parameters are treated as required by default
- Add tests for this behavior
Let me start by exploring the repository structure.
Assistant
This looks like a Rust project (Cargo.toml). Let me explore the crates directory to understand the structure better.
Assistant
Let me search for OpenAPI-related code in the repository
Assistant
Let me do one search at a time.
Assistant
Let me look at the key files. First, the OpenAPI import module
Assistant
Now let me look at the operations.rs file where parameters are likely handled
Assistant
I've found the issue. Now let me look at the IR types to understand the data structures better.
Assistant
Let me find the IR file.
Assistant
Let me look at the IR model to see the types.
Assistant
Now I understand the issue. Let me look at the existing tests to understand the test structure
Assistant
Let me look at the projection tests file.
Assistant
Now I have a clear understanding of the issue. The fix is in
crates/coral-spec/src/v4/surfaces/openapi/operations.rsat line whererequireddefaults tofalse. According to the OpenAPI spec, path parameters are always required, so whenrequiredis omitted for path parameters, it should default totrue.Let me make the fix
Assistant
Let me see the full
import_parametersfunction.Assistant
Now I can see the issue clearly. At line 161,
requireddefaults tofalsefor all parameters, but according to OpenAPI spec, path parameters are always required. I need to change the default totruewhen the location isPath.Assistant
Good, the fix is in place. Now let me run the existing tests to make sure nothing is broken.
Assistant
All OpenAPI tests pass. Let me also run the projection tests.
Assistant
All tests pass. Let me run the full test suite for the coral-spec package to make sure everything is good.
Assistant
All 219 tests pass. Now according to the acceptance criteria, I should add focused importer/projection coverage for this behavior. Let me add a test.
Assistant
Let me see the end of the file
Assistant
Now let me add a test for the path parameter required behavior at the end of the file
Assistant
Let me run the tests again to verify the new test passes.
Assistant
The new test passes. Let me run the full test suite once more to confirm everything passes.
Assistant
All 220 tests pass. Let me also verify there are no other places in the codebase where this same issue might exist.
Assistant
Let me also check if there are any other importers or handlers that might have similar issues.
Assistant
Let me check what's at line 39 of schemas.rs
Assistant
Good - the other
unwrap_or(false)instances are fornullableanddeprecatedfields, which are unrelated. Let me verify the final state of my changes.
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.