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 the
requiredfield is omitted, even though path parameters are required by the OpenAPI specification. I need to find the relevant code in the repository that handles OpenAPI import and fix this behavior.Let me explore the repository structure first.
Assistant
That's odd, only one Python file? Let me explore more.
Assistant
This is a Rust project. Let me explore the crates directory
Assistant
Let me search for OpenAPI-related code in the codebase
Assistant
Let me look at the OpenAPI import file, which is likely where path parameters are handled
Assistant
Let me read the file with a different approach.
Assistant
Let me look at the operations.rs file which likely handles parameter importing
Assistant
Now I can see the issue. Let me find the
OpenApiParameterLocationenum definition and look at test files to understand the codeAssistant
Let me look at the relevant test files
Assistant
Now I understand the issue. In
operations.rs, line ~139-141, path parameters are treated as optional whenrequiredis omitted:required: parameter_obj .get("required") .and_then(Value::as_bool) .unwrap_or(false),The fix should default
requiredtotruefor path parameters (since they are always required per the OpenAPI spec) andfalsefor others when the field is omitted.Let me first check the exact line numbers and context
Assistant
Let me open the file and look at the relevant section more closely
Assistant
Now I'll make the fix. The change is to default
requiredtotruefor path parameters when therequiredfield is omittedAssistant
Let me open the file properly and use the
editcommand to make the changeAssistant
Let me open the operations.rs file with the open command
Assistant
Now I'll make the edit to fix the required handling for path parameters
Assistant
Good, the edit looks correct. Now let me verify the change is syntactically correct and run the existing
Assistant
Code compiles. Now let me run the existing
Assistant
All 12 openapi tests pass. Let me also run the projection tests
Assistant
All tests pass. Let me also run the full
Assistant
All 219 tests pass. Let me verify the final state of the changed
Assistant
Let me also verify that no other code in the codebase has the same issue pattern
Assistant
Let me check those other two
unwrap_or(false)lines to ensure they're not path-parameter related
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.