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.

    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. Assistant

    I'll start by exploring the repository to understand the codebase and locate the relevant files for the issue. Let's first get an overview.

  3. Assistant

    Let me understand the repo structure better. This seems to be a monorepo. Let me look at the issue more closely. The issue is about OpenAPI schema import - specifically handling additionalProperties: false in v4 OpenAPI schema import. Let me search for relevant files.

  4. Assistant

    Great, I found the relevant Rust files. Let me examine the schemas.rs file first as it likely contains the logic for handling additionalProperties. Let me also look at the import.rs file to understand the import process.

  5. Assistant

    Let me look at the schemas.rs file more closely to understand the issue.

  6. Assistant

    Now I can see the issue! In the import_schema method, around line 90-97, there's a check for additionalProperties. The code currently does:

    } 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 that additionalProperties can be:

    1. A boolean (true or false) - in OpenAPI 3.0, additionalProperties: false means the object cannot have any properties beyond those defined in properties
    2. A schema object - in this case, it defines the type for additional properties (map-like behavior)

    When additionalProperties: false, the current code will try to import false as a schema, which will likely fail and return "json". This makes it look like a free-form map instead of a closed object.

    The fix should:

    1. If additionalProperties is a boolean false, treat the object as a closed object (no additional properties allowed) - this means we should NOT create a Map, but instead create an Object with only the explicitly defined properties
    2. If additionalProperties is a boolean true, treat it as a free-form map (or Object with no defined properties)
    3. If additionalProperties is a schema object, treat it as a Map with the specified value type

    Let me also check if there are any tests for this functionality.

  7. Assistant

    Let me check the openapi_tests.rs to see if there are existing tests for additionalProperties.

  8. Assistant

    No matches. Let me check the test files.

  9. Assistant

    Now I understand the issue. Let me also look at the IrTypeShape to understand the type definitions:

  10. Assistant

    Let me look at the IrTypeShape enum to understand the available types.

  11. Assistant

    Now I understand the issue. Let me look at the exact code that needs to be fixed:

  12. Assistant

    Let me see more context:

  13. Assistant

    Now I need to understand the issue. The current code at line 102-112 handles additionalProperties:

    } 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: when additionalProperties: false, it's a boolean value. The code treats it as a schema to import. Since false is not a valid schema object with a type, import_schema will likely return None (or create some weird Json type), and the object will be imported as a Map instead of a closed object.

    According to OpenAPI spec:

    • additionalProperties: false means no additional properties are allowed (closed object)
    • additionalProperties: true means any additional properties are allowed (open/free-form object, which could be represented as a Map<string, any>)
    • additionalProperties: {schema} means additional properties must conform to the schema (Map<string, schema>)

    The fix should:

    1. Check if additionalProperties is a boolean
    2. If false, treat as a closed object with no additional properties (same as having no additionalProperties)
    3. If true, treat as a free-form object/map (could use IrTypeShape::Map with json value type)
    4. If it's a schema (object), keep the current behavior

    Let me also check the test file for any existing tests related to additionalProperties.

    Let me check the structure of the test file:

  14. Assistant

    Now I understand the issue clearly. Let me look at the existing tests and understand the code flow better:

  15. Assistant

    Good, all tests pass. Now let me write a reproducer script to understand the current behavior:

  16. Assistant

    Now let me understand the current behavior with the problematic case. Let me write a quick test:

  17. Assistant

    Now I understand the issue clearly. The problem is in the import_schema function in schemas.rs:

    • When additionalProperties: false (boolean), the code still enters the else if let Some(additional) branch
    • It tries to pass false (a boolean) to import_schema as if it were a schema object
    • This causes it to be imported as a Map instead of a closed object

    The fix:

    1. Check if additionalProperties is a boolean value
    2. If false: treat as a closed object (empty if no properties, same as if additionalProperties was absent)
    3. If true: treat as a free-form map (use IrTypeShape::Map with json value type)
    4. If it's a schema object: keep current behavior (Map with that value type)

    Also need to handle the case where properties exists alongside additionalProperties: false (already handled since properties takes precedence).

    Let me now implement the fix:

  18. Assistant

    Now I need to fix the else if let Some(additional) branch to check if the value is a boolean. When additionalProperties: false, we should treat it as a closed object (IrTypeShape::Json with no map behavior). When it's true, we could treat it as a free-form map. Let me make the fix:

  19. Assistant

    Now I understand the issue. The code at lines 102-114 treats additionalProperties as a schema to import, but when it's false (a boolean), it should be treated as a closed object (no additional properties allowed), not as a free-form map.

    Let me make the fix:

  20. Assistant

    Let me open the file first.

  21. Assistant

    Now let me scroll down to see the full section around additionalProperties:

  22. Assistant

    Now I understand the issue clearly. Let me edit the file to fix the additionalProperties handling:

  23. Assistant

    Good, the edit is applied. Now let me run the existing tests to make sure I didn't break anything:

  24. Assistant

    All existing tests pass. Now I need to add focused tests for the additionalProperties: false behavior. Let me look at the test file structure to understand how to add tests properly.

  25. Assistant

    Let me scroll to the end of the test file to add tests there.

  26. Assistant

    Now I need to add tests at the end of the file. Let me add a test for the additionalProperties: false behavior. First, let me understand how to check what the imported type looks like. Let me check what types are used in existing tests to understand the pattern.

  27. Assistant

    Now I'll add the tests. I need to add tests for:

    1. additionalProperties: false without properties → closed object (IrTypeShape::Object with empty fields)
    2. additionalProperties: false with properties → closed object with those properties
    3. additionalProperties: true → free-form map (IrTypeShape::Map)
    4. additionalProperties: {type: string} → typed map (existing behavior, should still work)

    Let me add the tests:

  28. Assistant

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

  29. Assistant

    I see there's still a duplicate line. Let me look at lines 664-668:

  30. Assistant

    I see there are issues - a duplicate line and an extra closing brace. Let me fix:

  31. Assistant

    Good, now let me run the tests to make sure they pass:

  32. Assistant

    The tests are failing because the types are not being found by their expected IDs. Let me check how types are imported. The issue is likely with how type IDs are generated from $ref references. Let me check the type IDs that are actually generated.

  33. Assistant

    Let me check how type IDs are generated from $ref references:

  34. Assistant

    Let me check how the type ID is derived from the ref:

  35. Assistant

    Let me check what normalize_identifier does:

  36. Assistant

    Let me check the normalize_identifier function.

  37. Assistant

    Now I understand! normalize_identifier converts to lowercase: "ClosedObject" becomes "closedobject", "SemiClosed" becomes "semi_closed", etc. Let me fix the tests:

  38. Assistant

    Let me use the --file option correctly.

  39. Assistant

    I see the edit created a duplicate. Let me fix the file properly:

  40. Assistant

    Good. Now let me fix the other tests that have similar issues with type IDs:

  41. Assistant

    I see there's a duplicate .expect("import"); on line 762. Let me fix that and also fix the remaining type IDs:

  42. Assistant

    Good, the duplicate is fixed. Now I need to fix the third test to use the correct type ID. Let me check what TypedMap would normalize to:

  43. Assistant

    Now let me run the tests again:

  44. Assistant

    The types aren't being found because the schema reference isn't being triggered. Let me add some debug output to understand what's happening:

  45. Assistant

    Let me check how the existing tests reference schemas and look at the import flow:

  46. Assistant

    Let me check how the import process works - specifically how $ref to component schemas are resolved:

  47. Assistant

    Let me look at how resolve_ref works to understand how schemas are resolved:

  48. Assistant

    Let me understand the issue with the tests. The problem is that when using $ref, the type_id is derived differently. Let me fix the tests to inline the schemas instead of using $ref:

  49. Assistant

    I see the test file is broken now - let me check lines 714-715:

  50. Assistant

    I see the first test is missing a closing brace. Let me fix:

  51. Assistant

    I see the assertion is malformed. Let me fix the first test properly:

  52. Assistant

    Now I need to add the missing #[test] attribute before the second test:

  53. Assistant

    Now I need to fix the second test similarly. Let me update it to use inline schemas too:

  54. Assistant

    Good. Now let me fix the third test too. Let me see the remaining part:

  55. Assistant

    The third test has the same issue with $ref. Let me fix it to use inline schema:

  56. Assistant

    Good, now let me run the tests again:

  57. Assistant

    All 15 tests pass! Now let me run the full test suite for the coral-spec crate to make sure nothing else is broken:

  58. Assistant

    All 222 tests pass! Let me verify my changes one more time by looking at the final state of the schemas.rs file:

  59. Assistant

    Perfect! Let me verify the final state of my changes:

  60. Assistant

    Now let me check the diff to make sure everything looks good:

  61. Assistant

    Perfect! All changes look good. Let me run the full test suite one more time to make sure everything is still passing:

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