Skip to content
TheChatArchiveThe Chat Archive
QwenQwen/Qwen3.5-35B-A3B· alibabaHugging Face ibragim-bad/swe_rebench_07_2026_trajectories

ISSUE DESCRIPTION Treat OpenAPI path parameters as required in v4 import This tracks…

  1. 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 required is 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 required field, 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 using git reset --hard command. Additionally, you can use git stash and git stash pop to temporarily save your changes and restore them later. Finally, you can see the changes that you've made (which will be submitted when you call submit) using git status or git diff commands. However you don't need to use git add or git commit before submitting your changes. In fact, submit only submits currently unstaged changes because it uses git diff to 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-$

  2. Qwen Assistant

    Let me start by exploring the repository structure to understand the codebase and find the relevant code related to OpenAPI path parameters import in v4.

  3. Qwen Assistant

    This appears to be a Rust project. Let me look at the PR reference mentioned in the issue to understand the context better, and search for relevant code related to OpenAPI import and path parameters.

    <tool_call> <function=bash_terminal> <parameter=command> grep -r "OpenAPI" --include="*.rs" | head -50 </tool_call>

  4. Qwen Assistant

    The previous grep command wasn't executed properly. Let me try again with the correct format.

  5. Qwen Assistant

    Let me look at the OpenAPI import file and the PR discussion mentioned in the issue. The key file seems to be crates/coral-spec/src/v4/surfaces/openapi/import.rs.

    <tool_call> <function=open> <parameter=file> /coral/crates/coral-spec/src/v4/surfaces/openapi/import.rs </tool_call>

  6. Qwen Assistant

    I need to use the correct tool format. Let me open the file properly.

  7. Qwen Assistant

    I see the import.rs file but it seems incomplete. Let me search for where path parameters are being handled and the required field is being checked.

    <tool_call> <function=bash_terminal> <parameter=command> grep -r "required" --include="*.rs" /coral/crates/coral-spec/src/v4/surfaces/openapi/ </tool_call>

  8. Qwen Assistant

    Let me run the grep command properly.

  9. Qwen Assistant

    Now let me look at the operations.rs file where the path parameters are being processed and the required field is being used.

  10. Qwen Assistant

    Now I can see the issue. In the import_parameters function, when importing parameters, the code checks for required field:

    required: parameter_obj
        .get("required")
        .and_then(Value::as_bool)
        .unwrap_or(false),
    

    The problem is that when required is omitted, it defaults to false (via unwrap_or(false)). However, according to OpenAPI specification, path parameters are always required even if the required field is omitted. The fix should check if the parameter location is "path" and if so, always set required to true regardless of whether the required field is present.

    Let me look at the tests to understand the expected behavior better and see if there are any existing tests for path parameters.

    <tool_call> <function=bash_terminal> <parameter=command> grep -r "path" --include="*.rs" /coral/crates/coral-spec/src/v4/projection_tests.rs | head -30 </tool_call>

  11. Qwen Assistant

    I need to use bash_terminal correctly.

  12. Qwen Assistant

    Let me look at the projection_tests.rs file to see what kind of tests exist for the OpenAPI importer, especially for path parameters without the required field.

  13. Qwen Assistant

    I notice that in all the tests, the path parameters have required: true explicitly set. But the issue is about when required is omitted - it should still be treated as required for path parameters.

    Let me look for the GitHub OpenAPI fixture to understand the actual data format better.

    <tool_call> <function=bash_terminal> <parameter=command> cat /coral/crates/coral-spec/src/v4/test_support.rs 2>/dev/null || find /coral -name "test_support*" -type f </tool_call>

  14. Qwen Assistant

    Let me run the command properly using bash_terminal.

  15. Qwen Assistant

    The user is asking me to use bash_terminal correctly. Looking at my previous responses, I see I was using bash_terminal correctly. The issue was that the search was returning output but not being presented as a valid response to me.

    Let me now focus on the task at hand. I need to:

    1. Understand the issue - path parameters in OpenAPI should be required even when required is omitted
    2. Find where the code handles this
    3. Make the fix
    4. Verify the fix

    Let me look at the operations.rs file to understand where the fix needs to be made.

  16. Qwen Assistant

    Now I understand the issue. Looking at the import_parameters function in operations.rs, the code currently defaults required to false when the field is omitted:

    required: parameter_obj
        .get("required")
        .and_then(Value::as_bool)
        .unwrap_or(false),
    

    According to OpenAPI specification, path parameters should be required even when the required field is omitted. The fix should check if the parameter location is "path" and, if required is omitted, default to true for path parameters but false for others.

    Let me make the fix:

  17. Qwen Assistant

    I need to find the specific line where path parameters are being processed and modify the logic to treat them as required by default.

    <tool_call> <function=bash_terminal> <parameter=command> sed -n '150,170p' /coral/crates/coral-spec/src/v4/surfaces/openapi/operations.rs </tool_call>

  18. Qwen Assistant

    I need to use bash_terminal to run the command.

  19. Qwen Assistant

    Now I can see the exact location. The issue is at line 158-161 where required is being set. For path parameters, if required is omitted, it should default to true instead of false.

    The fix is to change the logic to:

    • If location is "path" and required is not explicitly set, default to true
    • For other locations, keep the existing behavior (default to false if required is not set)

    Let me also check if there's a constant or enum for OpenApiParameterLocation:

    <tool_call> <function=bash_terminal> <parameter=command> grep -r "OpenApiParameterLocation" /coral/crates/coral-spec/src/v4/ir/ | head -20 </tool_call>

  20. Qwen Assistant

    I need to search for the OpenApiParameterLocation definition using bash_terminal.

  21. Qwen Assistant

    Let me see the definition of OpenApiParameterLocation:

    <tool_call> <function=bash_terminal> <parameter=command> grep -A 10 "pub enum OpenApiParameterLocation" /coral/crates/coral-spec/src/v4/ir/model.rs </tool_call>

  22. Qwen Assistant

    Let me run the grep command properly.

  23. Qwen Assistant

    Now I understand the issue and can make the fix. The problem is in the import_parameters function in operations.rs. When required is omitted for a path parameter, it should default to true instead of false, as per OpenAPI specification.

    Let me apply the fix:

  24. Qwen Assistant

    Now I understand the issue. The code currently defaults required to false for all parameters when the required field is omitted. However, according to OpenAPI specification, path parameters are required by default even when the required field is omitted.

    Let me make the fix to handle path parameters as required by default:

  25. Qwen Assistant

    I need to verify the fix was applied correctly. Let me check the file to see if the change was made properly.

    <tool_call> <function=bash_terminal> <parameter=command> sed -n '156,164p' /coral/crates/coral-spec/src/v4/surfaces/openapi/operations.rs </tool_call>

  26. Qwen Assistant

    I need to use the bash_terminal tool correctly. Let me verify the change was applied.

  27. Qwen Assistant

    I see the sed command affected more than intended. The import_request_body function also got the change, but that's not correct - only the parameter required field should default to true for path parameters. Let me revert the unintended change:

  28. Qwen Assistant

    Let me check the current state and fix it properly:

  29. Qwen Assistant

    I see the sed command made unintended changes. Let me reset the file and apply the fix properly:

  30. Qwen Assistant

    Let me verify the file is back to its original state and then apply the fix correctly:

    <tool_call> <function=bash_terminal> <parameter=command> cat /coral/crates/coral-spec/src/v4/surfaces/openapi/operations.rs | grep -n "unwrap_or" </tool_call>

  31. Qwen Assistant

    The sed command is not being executed properly. Let me try a different approach.

  32. Qwen Assistant

    Good, the file is back to its original state. Now I need to apply the fix correctly. Looking at the output, line 161 is the required field for parameters which is the one I need to change. The fix should be:

    • Line 161: Change .unwrap_or(false) to .unwrap_or(location == OpenApiParameterLocation::Path)

    Let me use the edit command to make this change properly:

    <tool_call> <function=bash_terminal> <parameter=command> cat -n /coral/crates/coral-spec/src/v4/surfaces/openapi/operations.rs | sed -n '155,170p' </tool_call>

  33. Qwen Assistant

    I need to run the command properly to see the exact lines.

  34. Qwen Assistant

    Now I can see the exact lines. I need to change line 161 to default to true for path parameters. Let me use the edit command:

  35. Qwen Assistant

    The edit was successful. Let me verify the change was applied correctly:

  36. Qwen Assistant

    The fix was applied correctly. Now let me verify the code compiles:

  37. Qwen Assistant

    The compilation is in progress. Let me wait for it to finish:

  38. Qwen Assistant

    Now let me run the existing tests to make sure my fix doesn't break anything:

    <tool_call> <function=bash_terminal> <parameter=command> cd /coral && cargo test --package coral-spec 2>&1 | tail -50 </tool_call>

  39. Qwen Assistant

    I need to run the command properly using bash_terminal. Let me run the tests.

  40. Qwen Assistant

    The tests pass. Now let me also run the specific OpenAPI tests to ensure the fix works correctly. Let me also look at the issue description to see if there's a test coverage requirement. The issue mentions:

    Import path parameters as required regardless of an omitted required field, preserve explicit behavior for non-path parameters, and add focused importer/projection coverage.

    So I need to add tests to cover:

    1. Path parameters without explicit required should be treated as required
    2. Non-path parameters with omitted required should still be treated as optional

    Let me first look for existing tests related to the importer and projection tests.

    <tool_call> <function=bash_terminal> <parameter=command> grep -r "path.required" /coral/crates/coral-spec/src/v4/ --include=".rs" | head -20 </tool_call>

  41. Qwen Assistant

    I need to search for path parameter tests using bash_terminal correctly.

  42. Qwen Assistant

    I see that all existing tests explicitly set required: true for path parameters. I need to add a test that verifies path parameters without the required field are still treated as required. Let me look for openapi_tests.rs which seems to have tests specifically for the OpenAPI importer:

    <tool_call> <function=bash_terminal> <parameter=command> cat /coral/crates/coral-spec/src/v4/openapi_tests.rs </tool_call>

  43. Qwen Assistant

    I need to run the cat command to see the openapi_tests.rs file.

  44. Qwen Assistant

    Now I have a good understanding of the test file structure. I need to add a test that verifies:

    1. Path parameters without explicit required field are treated as required
    2. Non-path parameters without explicit required field are treated as optional (false)

    Let me first check how to properly add a test that checks the required field on IrOperationInput. Let me search for how the existing tests check the required field:

    <tool_call> <function=bash_terminal> <parameter=command> grep -n "required" /coral/crates/coral-spec/src/v4/openapi_tests.rs </tool_call>

  45. Qwen Assistant

    I need to search for "required" in the openapi_tests.rs file using bash_terminal correctly.

  46. Qwen Assistant

    The issue mentions that I need to add focused importer/projection coverage tests for path parameters. Let me look at how the tests check the required field on IrOperationInput. I'll search for how required is accessed in tests:

    <tool_call> <function=bash_terminal> <parameter=command> grep -r ".required" /coral/crates/coral-spec/src/v4/ --include="*.rs" | head -20 </tool_call>

  47. Qwen Assistant

    I need to search for .required in the codebase. Let me use bash_terminal to search properly.

  48. Qwen Assistant

    Now I can see how required is used in the codebase. The key place is derive.rs where it's used to determine if inputs are required for SQL. I need to add tests that verify:

    1. Path parameters without required field are treated as required
    2. Non-path parameters without required field are treated as optional

    Let me look at the IrOperationInput structure to understand what fields are available:

    <tool_call> <function=bash_terminal> <parameter=command> grep -A 10 "pub struct IrOperationInput" /coral/crates/coral-spec/src/v4/ir/model.rs </tool_call>

  49. Qwen Assistant

    I need to use bash_terminal to run this grep command to see the IrOperationInput structure.

  50. Qwen Assistant

    Now I understand the structure. The IrOperationInput has a required field that I need to verify. Let me add a test that verifies:

    1. Path parameters without explicit required field are treated as required (true)
    2. Non-path parameters without explicit required field are treated as optional (false)

    Let me also check where the tests are located and how they're organized:

    <tool_call> <function=bash_terminal> <parameter=command> ls -la /coral/crates/coral-spec/src/v4/ </tool_call>

  51. Qwen Assistant

    I need to use bash_terminal to run the ls command to list the v4 directory contents.

  52. Qwen Assistant

    Now I can see the file structure. I need to add a test to verify the path parameters are treated as required when required is omitted. Let me look at the end of openapi_tests.rs to see where I can add the new test:

    <tool_call> <function=bash_terminal> <parameter=command> tail -50 /coral/crates/coral-spec/src/v4/openapi_tests.rs </tool_call>

  53. Qwen Assistant

    The user is asking me to run a command. Looking at the current file which is /coral/crates/coral-spec/src/v4/surfaces/openapi/operations.rs, and the task at hand, I need to check the end of the openapi_tests.rs file to see where I should add the new test. Let me run the tail command using bash_terminal.

  54. Qwen Assistant

    Now I need to add a test to verify that path parameters are treated as required when the required field is omitted. Let me add this test to the openapi_tests.rs file:

  55. Qwen Assistant

    Now let me verify the tests were added correctly and run them to make sure my fix works:

  56. Qwen Assistant

    The first test passed. Let me run all three new tests to verify the fix is working correctly:

  57. Qwen Assistant

    I need to use the correct syntax for filtering multiple tests. Let me try with a pattern match.

  58. Qwen Assistant

    All three new tests passed. Now let me run all the tests to ensure the fix doesn't break any existing functionality:

  59. Qwen Assistant

    All 222 tests pass. Now let me also run the projection tests to make sure the fix works correctly in the full projection generation workflow:

  60. Qwen Assistant

    All tests pass. Let me now verify the exact change I made and ensure it's correct:

    <tool_call> <function=bash_terminal> <parameter=command> cd /coral && git diff crates/coral-spec/src/v4/surfaces/openapi/operations.rs </tool_call>

  61. Qwen Assistant

    The user is asking me to run a command. I need to use bash_terminal to show the git diff for the operations.rs file.

  62. Qwen Assistant

    Let me also check the diff for the test file:

  63. Qwen Assistant

    Now let me also verify the tests work with a broader test run to ensure nothing is broken. Let me run the full test suite for coral-spec:

    <tool_call> <function=bash_terminal> <parameter=command> cd /coral && cargo test --package coral-spec 2>&1 | head -50 </tool_call>

  64. Qwen Assistant

    The user wants me to run a command using bash_terminal. Let me run the full test suite for coral-spec to verify everything is working.

  65. Qwen Assistant

    The tests are running. Let me wait for them to complete to ensure everything passes.

  66. Qwen Assistant

    All 222 tests pass and the doc tests pass. Now let me summarize what I've done and make sure I've addressed all the requirements from the issue.

    Summary

    The issue was:

    • OpenAPI path parameters are imported as optional when required is omitted, even though path parameters are required by OpenAPI specification.
    • This can misclassify required path inputs as optional SQL filters.

    Fix Applied

    1. Modified crates/coral-spec/src/v4/surfaces/openapi/operations.rs:

      • Changed line 161 from .unwrap_or(false) to .unwrap_or(location == OpenApiParameterLocation::Path)
      • This ensures that path parameters default to required: true when the required field is omitted, while non-path parameters (query, header, cookie) default to required: false.
    2. Added tests in crates/coral-spec/src/v4/openapi_tests.rs:

      • importer_treats_path_parameters_as_required_by_default: Tests that path parameters without explicit required field are treated as required, while query and header parameters without explicit required are treated as optional.
      • importer_preserves_explicit_required_false_for_path_parameters: Tests that explicit required: false is preserved for path parameters (even though this is invalid OpenAPI).
      • importer_preserves_explicit_required_true_for_query_parameters: Tests that explicit required: true is preserved for query parameters.

    All 222 tests pass. The fix addresses the acceptance criteria:

    • ✅ Import path parameters as required regardless of an omitted required field
    • ✅ Preserve explicit behavior for non-path parameters
    • ✅ Added focused importer/projection coverage with tests

    Let me verify the changes one more time before submitting. </tool_call>

  67. Qwen Assistant

    The user wants me to verify the changes before submitting. Let me run a final check to make sure all changes are in place and tests pass.

  68. Qwen Assistant

    Let me verify the changes are correct by looking at the diffs again:

Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.