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 structure to understand the codebase and locate the relevant files related to OpenAPI schema import and additionalProperties. Let's first get an overview.

  3. Assistant

    Let me get a better understanding of the repository structure and find OpenAPI schema import related code.

  4. Assistant

    No TypeScript files with "additionalProperties". Let me search more broadly.

  5. Assistant

    Great! Found two relevant Rust files. Let me examine them. First, let's look at the OpenAPI schema import file.

  6. Assistant

    Let me examine the schemas.rs file first since it's the most relevant one.

  7. Assistant

    Let me check the IR types to understand the available type shapes:

  8. Assistant

    Let me look at the IR model to see what IrTypeShape looks like.

  9. Assistant

    Let me check the existing tests to understand the expected behavior:

  10. Assistant

    Let me run the existing tests to see if they pass:

  11. Assistant

    Let me run the tests again and capture the output:

  12. Assistant

    Let me examine the PR discussion mentioned in the issue to understand the context better:

  13. Assistant

    Now I understand the issue! Let me look at the specific problematic code section more carefully:

  14. Assistant

    Let me continue reading the file.

  15. Assistant

    Now I understand the issue. Let me first create a reproduction script to confirm the bug:

  16. Assistant

    Let me also check what the mcp/src/surface/tools.rs file looks like, and then the import.rs file:

  17. Assistant

    Now I understand the issue. Looking at the import_schema method in schemas.rs, around lines 102-114:

    } else if let Some(additional) = resolved.get("additionalProperties") {
        let value_type_ref = self
            .import_schema(
                additional,
                &format!("{type_id}_value"),
                operation_id,
                diagnostics,
            )
            .unwrap_or_else(|| "json".to_string());
        IrTypeShape::Map { value_type_ref }
    }
    

    The problem is clear: when additionalProperties: false (a boolean), the code tries to treat it as a schema to import. In OpenAPI:

    • additionalProperties: false → closed object (no additional properties allowed)
    • additionalProperties: true → free-form map (any additional properties allowed)
    • additionalProperties: {schema} → map with value type matching the schema

    Let me first write a reproduction test to confirm the bug:

  18. Assistant

    Let me look at how the existing tests are structured:

  19. Assistant

    Now I understand the issue completely. Let me trace through the logic:

    1. When additionalProperties: false (boolean), the code at line 102 enters the else if let Some(additional) branch
    2. It tries to import false (a boolean Value) as a schema
    3. The import_schema call treats false as a bare schema with no type, so it defaults to "object" and produces IrTypeShape::Json
    4. The parent object then gets IrTypeShape::Map { value_type_ref: "json" } — a free-form map — when it should be a closed object

    The fix: check if additionalProperties is a boolean first, and handle accordingly:

    • false → closed object (just IrTypeShape::Object with the existing properties, or IrTypeShape::Json if none)
    • true → free-form map
    • schema object → keep current behavior

    Let me also check if there's an object with both properties AND additionalProperties:

  20. Assistant

    Now let me write a reproduction script to confirm the bug:

  21. Assistant

    Let me create a proper reproduction test to confirm the issue:

  22. Assistant

    Let me look at the import module:

  23. Assistant

    Now I understand the issue clearly. Let me trace the logic:

    When additionalProperties: false (boolean):

    1. Line 102: else if let Some(additional) = resolved.get("additionalProperties") → enters this branch since false is a value
    2. Lines 103-111: calls self.import_schema(additional, ...) where additional = false (a boolean Value)
    3. The import_schema processes false as a schema:
      • resolved = false (no $ref)
      • Type check: false.get("type") returns None → falls to unwrap_or("object") → treats as "object"
      • No properties → no additionalProperties → falls through to IrTypeShape::Json
    4. Back in the caller: value_type_ref = some JSON type id, and the whole object becomes IrTypeShape::Map

    This is wrong: additionalProperties: false should be a closed object (no additional properties allowed), not a free-form map.

    Similarly, additionalProperties: true should be treated as a free-form map.

    Let me now fix the schema import logic:

  24. Assistant

    Now I understand the issue. Let me implement the fix. The problem is in the else if let Some(additional) branch around line 102. When additionalProperties is a boolean false, it should be treated as a closed object, not as a map. When it's true, it should be a free-form map. When it's a schema object, the current behavior is correct.

    I also need to handle the case where an object has BOTH properties AND additionalProperties: false — the current code already handles this because it checks for properties first (line 90).

  25. Assistant

    Now I'll implement the fix. The issue is at lines 102-114 in schemas.rs. When additionalProperties is a boolean false, it should be treated as a closed object (same as no additionalProperties). When it's true, it should be a free-form map. When it's a schema object, keep current behavior.

  26. Assistant

    Good! Now let me run the existing tests to make sure nothing is broken:

  27. Assistant

    All existing tests pass. Now let me add a focused test for the additionalProperties: false behavior. Let me find the end of the test file:

  28. Assistant

    Now let me add a test for additionalProperties: false:

  29. Assistant

    Let me run the tests to see if my changes work:

  30. Assistant

    The test has a lookup issue. Let me debug to see what operation IDs are produced:

  31. Assistant

    The issue is that the operationId closed/get becomes normalized. Let me check the actual operation IDs by looking at what the import does with them:

  32. Assistant

    Let me add debug output to find the actual operation IDs:

  33. Assistant

    Let me modify the test to add debug output temporarily:

  34. Assistant

    I need to look at how operation IDs are actually handled. Looking at the test output, the operationId is "closed/get" with a slash. Let me check what normalize_identifier does to operationIds. Let me look at the operations.rs file.

  35. Assistant

    I can see the issue. The operation IDs are normalized (e.g., "closed/get" becomes "closed_get"), and the type IDs include "_row" suffix. Let me fix my test:

  36. Assistant

    Now let me remove the debug output and fix the test:

  37. Assistant

    I see there's a duplicate. Let me fix the file:

  38. Assistant

    Good. Now let me run the tests:

  39. Assistant

    Let me run the second test too:

  40. Assistant

    Let me run all openapi tests:

  41. Assistant

    All 14 tests pass (12 existing + 2 new). Let me also run the full coral-spec test suite to ensure nothing else is broken:

  42. Assistant

    All 221 tests pass. Let me verify the final state of my changes:

  43. Assistant

    Let me also run the broader test suite to ensure nothing else is broken:

  44. Assistant

    The 2 failing tests are in a different package (coral-app) and are unrelated to our changes. Let me verify they were already failing before our changes:

  45. Assistant

    Good - these tests were already failing before my changes (pre-existing failures). Let me restore my changes:

  46. Assistant

    Good - the failing tests are pre-existing and unrelated to our changes. Let me verify the final changes:

  47. Assistant

    The changes look good. Let me also consider one edge case: what if there's an object with both properties AND additionalProperties: false? Looking at the code flow:

    1. Line 90 checks for properties first — this branch is taken
    2. If properties exist, it creates an Object with those fields
    3. The additionalProperties: false is effectively ignored for this case

    But wait - in OpenAPI, objects with only properties are open by default (can have additional properties). Only additionalProperties: false makes them closed. Let me check if we need to handle that case too. Let me look at the existing behavior for objects with properties:

  48. Assistant

    Good - the code already handles the properties + additionalProperties: false case correctly by prioritizing properties. My test covers all the key cases:

    1. additionalProperties: false with no properties → Json (closed object)
    2. additionalProperties: false with properties → Object (already handled by existing code)
    3. additionalProperties: true → Map with json value (free-form map)
    4. additionalProperties: {schema} → Map with typed value (existing behavior preserved)

    Let me run the final comprehensive test:

  49. Assistant

    All 221 tests pass. Let me now complete the checklist:

    CHECKLIST

    1. ✅ If an error was reported in the issue description, I have successfully reproduced it.

      • I traced through the code in schemas.rs lines 102-111 and confirmed that additionalProperties: false (a boolean) was incorrectly being passed to import_schema(), which treated it as a schema object and produced IrTypeShape::Map (a free-form map) instead of a closed object.
    2. ✅ If an error was reported in the issue description, I have confirmed that my fix resolves the error.

      • My fix adds three-way handling for additionalProperties:
        • false (boolean) → IrTypeShape::Json (closed object, same as no additionalProperties)
        • true (boolean) → IrTypeShape::Map { value_type_ref: "json" } (free-form map)
        • schema object → IrTypeShape::Map { value_type_ref: ... } (typed map, preserved existing behavior)
      • Both new tests confirm the correct behavior.
    3. ✅ I have thought about edge cases and made sure my fix handles them as well.

      • additionalProperties: false with no properties → Json (closed object)
      • additionalProperties: false with properties → Object (already handled by existing code that checks properties first)
      • additionalProperties: true → Map with Json value type (free-form map)
      • additionalProperties: {schema} → Map with schema value type (existing behavior preserved)
      • allOf objects (don't need additionalProperties handling in current code)
    4. ✅ I have run existing tests in the repository that might have been affected by the change I made and confirmed that they pass.

      • All 221 tests in coral-spec package pass, including the 12 existing openapi_tests and the 2 new tests I added.
      • The 2 failing tests in coral-app are pre-existing failures unrelated to my changes (verified by running them on the original code).

    Now I'll submit the changes:

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