Skip to content
TheChatArchiveThe Chat Archive
xiaomi/mimo-v2.5-pro· unknownHugging Face ibragim-bad/swe_rebench_07_2026_trajectories

ISSUE DESCRIPTION Respect additionalProperties false during v4 OpenAPI schema import…

  1. User

    ISSUE DESCRIPTION

    Respect additionalProperties false during v4 OpenAPI schema import This tracks unresolved feedback identified by cubic on PR #1149: https://github.com/withcoral/coral/pull/1149#discussion_r3347190658

    Context: This appears to be pre-existing DSL v4 behavior surfaced by the refactor review, not a regression from the module split.

    Problem: The schema importer treats the presence of additionalProperties as map-like, so additionalProperties: false can be imported as a free-form map instead of a closed object.

    Acceptance criteria: Handle boolean additionalProperties: false as a closed object, preserve schema-valued additionalProperties behavior, and add focused schema import 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 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. Assistant

    I'll start by exploring the repository to understand its structure and locate the relevant code for OpenAPI schema import. Let's first get an overview.

  3. Assistant

    Let me explore the repository structure more broadly.

  4. Assistant

    Let me search more broadly.

  5. Assistant

    This is a Rust project with Cargo.toml. Let me look at the crates directory for relevant code.

  6. Assistant

    Let me search for files related to OpenAPI schema import.

  7. Assistant

    Let me explore the relevant files. First, let's look at the schemas.rs file since it seems most relevant.

  8. Assistant

    Now I can see the issue! In the import_schema method, there's a check for additionalProperties that treats any presence of additionalProperties as a map-like structure. However, when additionalProperties: false is set in OpenAPI, it means the object should be closed (no additional properties allowed), not a free-form map. Let me look at the test files to understand the expected behavior better.

  9. Assistant

    Let me search for tests related to OpenAPI import.

  10. Assistant

    Let me look at the openapi tests to understand the test structure.

  11. Assistant

    Let me examine the IR types to understand IrTypeShape::Map vs IrTypeShape::Object.

  12. Assistant

    Now let me look at the specific section of the import_schema method that handles additionalProperties. I need to understand how it currently works.

  13. Assistant

    Let me see the rest of the file.

  14. Assistant

    Now I understand the issue! The problem is in lines 102-114 where additionalProperties is handled. When additionalProperties: false is present, the code tries to import false as a schema and creates a Map type, but additionalProperties: false should be treated as a closed object (no additional properties allowed).

    Let me first create a test script to reproduce the issue and understand the current behavior:

  15. Assistant

    Let me run the existing tests to see the current state:

  16. Assistant

    Now let me implement the fix. I need to modify the handling of additionalProperties in the schemas.rs file to handle boolean false as a closed object:

  17. Assistant

    Need to open the file first, then edit.

  18. Assistant

    The file should exist since we saw its contents earlier. Let me try from the repository root.

  19. Assistant

    Now let me scroll down to see lines 89-114 more clearly.

  20. Assistant

    Now I need to replace lines 89-114 with the fixed version. The issue is that additionalProperties: false is treated as a map, but it should be treated as a closed object. Let me create the replacement.

  21. Assistant

    I see there's an extra } on line 135. I need to remove the duplicate closing brace.

  22. Assistant

    There's still an extra } on line 135. Let me remove it by replacing lines 134-136:

  23. Assistant

    Good! Now I need to simplify the logic when properties exist. The current code has redundant logic. Let me fix lines 90-110:

  24. Assistant

    I see there's a syntax error. There's an extra } on line 102 and the else branches are not properly connected. Let me fix this by replacing lines 89-126:

  25. Assistant

    Good! Now let me verify the code compiles:

  26. Assistant

    Good! The code compiles. Now let me run the existing tests to make sure I didn't break anything:

  27. Assistant

    The current working directory is already /coral/crates/coral-spec. Let me run the test from the root.

  28. Assistant

    All existing tests pass. Now I need to add test coverage for the additionalProperties: false behavior as requested in the acceptance criteria. Let me find and add to the openapi tests file:

  29. Assistant

    Let me first verify my understanding by creating a temporary test to see how the current behavior handles additionalProperties: false:

  30. Assistant

    Now I need to add test coverage for the additionalProperties: false behavior. Let me add a focused test to the openapi_tests.rs file:

  31. Assistant

    I need to add a test for the additionalProperties: false behavior. Let me scroll to the end of the file to see where to add it:

  32. Assistant

    Now let me add a test for the additionalProperties: false behavior:

  33. Assistant

    I see there's a duplicate line on line 666. Let me fix that:

  34. Assistant

    There's still a duplicate } on line 667. Let me fix that:

  35. Assistant

    Good! Now let me run the tests to make sure everything compiles and the new tests pass:

  36. Assistant

    The test failed because I'm looking for items/get but the operation id is likely normalized. Let me check what the operation id becomes after normalization. Looking at the existing tests, they use operationId: items/list but the operation is stored as itemslist (without the slash). Let me check.

  37. Assistant

    Let me check how operation ids are stored:

  38. Assistant

    Let me check how the operation id is set in the import code:

  39. Assistant

    Let me check how the operation id is constructed in the import code:

  40. Assistant

    Let me check what operation ids are actually generated by printing them out:

  41. Assistant

    The operationId is being normalized (likely lowercased and special chars removed). Let me check by looking at how the existing tests use operationId:

  42. Assistant

    Let me check how the test that uses operationId: items/get accesses the operation:

  43. Assistant

    Let me check how the normalize_identifier function works:

  44. Assistant

    Let me look at how the operation id is set:

  45. Assistant

    Let me look at how operation IDs are being created in the importer:

  46. Assistant

    Let me check how the test for trees/get accesses the operation:

  47. Assistant

    I see the issue! The test expects operationId: items/get to be normalized. Let me check how the normalize_identifier function works and see what the actual normalized ID is:

  48. Assistant

    I see. The normalize_identifier function converts non-alphanumeric characters to underscores and lowercases everything. So items/get would become items_get. Let me fix my test to use the correct normalized IDs:

  49. Assistant

    I see there's duplicate code. Let me clean up the test:

  50. Assistant

    Good! Now let me run the tests again:

  51. Assistant

    Excellent! All tests pass. Now let me run the full test suite to make sure I didn't break anything:

  52. Assistant

    All tests pass! Now let me also check if there are any other crates that might be affected by this change. Let me check the MCP tools file:

  53. Assistant

    These are test fixtures in the MCP tools file that use additionalProperties: false. They're not related to the OpenAPI importer - they're just test data. Let me verify by looking at a snippet:

  54. Assistant

    Let me look at the MCP tools file to understand the context:

  55. Assistant

    These are MCP tool definitions, not related to the OpenAPI importer. Let me now run the full test suite for the entire repository to make sure I haven't broken anything else:

  56. Assistant

    The two failing tests are in the coral-app crate and are about config write failures and cleanup failures - they seem unrelated to my changes. Let me check if these tests were already failing before my changes:

  57. Assistant

    Let me check if these tests were already failing before my changes:

  58. Assistant

    Now let me run the failing tests without my changes:

  59. Assistant

    Good, these tests were already failing before my changes. Let me restore my changes:

  60. Assistant

    Good, the failing tests are pre-existing and not related to my changes. Now let me verify my changes are correct by looking at the diff:

  61. Assistant

    Perfect! The diff shows that my changes are minimal and focused. I added a new else if branch that checks if additionalProperties is false and returns an empty Object in that case. This correctly handles the case where additionalProperties: false is used without properties.

    Now let me check the diff for the test file:

  62. Assistant

    Perfect! The test diff looks good. I've added two new tests:

    1. importer_respects_additional_properties_false_as_closed_object - Tests that additionalProperties: false is handled correctly as a closed object
    2. importer_preserves_schema_valued_additional_properties_as_map - Tests that schema-valued additionalProperties is still handled as a Map

    Now let me run the openapi tests one more time to make sure everything passes:

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