Skip to content
TheChatArchiveThe Chat Archive
MiniMaxminimax/minimax-m3· 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. MiniMax Assistant

    Let me start by exploring the repository structure to understand what we're working with.

  3. MiniMax Assistant

    This is the Coral repository. Let me explore the crates directory to find the relevant code

  4. MiniMax Assistant

    me check the test file structure and look for existing tests:

  5. MiniMax Assistant

    me check the git log for recent changes to the openapi schema file:

  6. MiniMax Assistant

    Let me look at the IrTypeShape definitions to understand the available shapes:

  7. MiniMax Assistant

    me look at the existing test patterns and understand the import structure:

  8. MiniMax Assistant

    look at the full openapi_tests.rs file to understand the test patterns:

  9. MiniMax Assistant

    Now I understand the test patterns. Let me also look at the mod.rs to see the imports:

  10. MiniMax Assistant

    Let me first understand the current behavior by writing a reproduction test:

  11. MiniMax Assistant

    me run the existing tests to confirm the environment works:

  12. MiniMax Assistant

    Let me create a temporary test to verify the bug exists:

  13. MiniMax Assistant

    Now let me check what Value::as_bool returns for an Object:

  14. MiniMax Assistant

    Now let me look at the schemas.rs file once more and make the fix:

  15. MiniMax Assistant

    Now let me make the fix to the schemas.rs:

  16. MiniMax Assistant

    The edit replaced the wrong section. Let me check what happened and fix it:

  17. MiniMax Assistant

    revert the change and try again properly:

  18. MiniMax Assistant

    let me make the fix correctly using the replace command:

  19. MiniMax Assistant

    run the temporary test to confirm the fix works:

  20. MiniMax Assistant

    look at recent fixes to see the test pattern they use:

  21. MiniMax Assistant

    Confirmed - the project does add focused tests as part of the fix. Let me look at the test pattern in the recent PR:

  22. MiniMax Assistant

    Good. Now I understand the pattern - add focused tests to the openapi_tests.rs file. Let me remove the temporary test file and add proper tests:Now I understand the pattern. Let me remove the temporary test file and add proper tests to openapi_tests.rs:]<]minimax[>[<tool_call> ]<]minimax[>[]<]minimax[>[rm crates/coral-spec/src/v4/_temp_additional_properties_tests.rs && git checkout crates/coral-spec/src/v4/mod.rs]<]minimax[>[]<]minimax[>[ ]<]minimax[>[</tool_call>

  23. MiniMax Assistant

    Let me run the command:

  24. MiniMax Assistant

    Let me first run all existing tests to make sure my fix didn't break anything:

  25. MiniMax Assistant

    219 tests pass. Let me also run tests in dependent crates to ensure nothing else broke:

  26. MiniMax Assistant

    The integration test failures are unrelated (gRPC cleanup related). Let me verify these failures exist on the base branch:

  27. MiniMax Assistant

    The failures are pre-existing and unrelated to my changes. Let me restore my changes:

  28. MiniMax Assistant

    Now let me add focused tests to the openapi_tests.rs file. I'll add tests that cover:

    1. additionalProperties: false alone (no properties) → closed Object
    2. additionalProperties: false with properties → closed Object with fields
    3. additionalProperties: <schema> (no properties) → typed Map
    4. additionalProperties: true (no properties) → free-form Map
    5. No additionalProperties and no properties → Json (preserve existing behavior)

    Let me look at the end of the file to find a good place to add the tests:Now let me add focused tests to the openapi_tests.rs file:]<]minimax[>[<tool_call> ]<]minimax[>[]<]minimax[>[tail -20 crates/coral-spec/src/v4/openapi_tests.rs]<]minimax[>[]<]minimax[>[ ]<]minimax[>[</tool_call>

  29. MiniMax Assistant

    I need to use the correct tool call format. Let me use bash_terminal:

  30. MiniMax Assistant

    Now I'll add the focused tests at the end of the file. Let me append them:Now I'll add focused tests at the end of the file:]<]minimax[>[<tool_call> ]<]minimax[>[]<]minimax[>[cat >> crates/coral-spec/src/v4/openapi_tests.rs << 'EOF'

    #[test] fn importer_imports_additional_properties_false_alone_as_closed_object() { let manifest = parse_source_manifest_yaml( r" name: additional_properties_closed dsl_version: 4 surfaces:

    • id: rest type: openapi file: /tmp/openapi.yaml base_url: https://api.example.com ", ) .expect("manifest"); let v4 = manifest.as_v4().expect("v4"); let surface = v4.surfaces.first().expect("one surface"); let ir = import_openapi_surface( v4, surface, r" openapi: 3.0.3 paths: /closed: get: operationId: closed/get responses: '200': content: application/json: schema: type: object additionalProperties: false " .as_bytes(), ) .expect("import"); let operation = ir.operations.first().expect("operation"); let ty = ir .types .iter() .find(|ty| ty.id == operation.output.type_ref) .expect("row type"); let IrTypeShape::Object { fields } = &ty.shape else { panic!( "additionalProperties: false should import as a closed object, got {:?}", ty.shape ); }; assert!( fields.is_empty(), "closed object should have no fields when properties are absent, got {fields:?}" ); assert!( !ir.types .iter() .any(|ty| ty.id == format!("{}_value", ty.id.replace("row", ""))), "no synthetic map value type should be created for additionalProperties: false" ); }

    #[test] fn importer_preserves_properties_when_additional_properties_false() { let manifest = parse_source_manifest_yaml( r" name: additional_properties_closed_with_props dsl_version: 4 surfaces:

    • id: rest type: openapi file: /tmp/openapi.yaml base_url: https://api.example.com ", ) .expect("manifest"); let v4 = manifest.as_v4().expect("v4"); let surface = v4.surfaces.first().expect("one surface"); let ir = import_openapi_surface( v4, surface, r" openapi: 3.0.3 paths: /items: get: operationId: items/get responses: '200': content: application/json: schema: type: object additionalProperties: false properties: id: {type: string} name: {type: string} " .as_bytes(), ) .expect("import"); let operation = ir.operations.first().expect("operation"); let ty = ir .types .iter() .find(|ty| ty.id == operation.output.type_ref) .expect("row type"); let IrTypeShape::Object { fields } = &ty.shape else { panic!( "additionalProperties: false with properties should import as a closed object, got {:?}", ty.shape ); }; let names: BTreeMap<&str, &IrField> = fields .iter() .map(|field| (field.name.as_str(), field)) .collect(); assert_eq!(names.len(), 2); assert!(names.contains_key("id")); assert!(names.contains_key("name")); }

    #[test] fn importer_preserves_schema_valued_additional_properties_as_typed_map() { let manifest = parse_source_manifest_yaml( r" name: additional_properties_typed_map dsl_version: 4 surfaces:

    • id: rest type: openapi file: /tmp/openapi.yaml base_url: https://api.example.com ", ) .expect("manifest"); let v4 = manifest.as_v4().expect("v4"); let surface = v4.surfaces.first().expect("one surface"); let ir = import_openapi_surface( v4, surface, r" openapi: 3.0.3 paths: /labels: get: operationId: labels/get responses: '200': content: application/json: schema: type: object additionalProperties: type: string " .as_bytes(), ) .expect("import"); let operation = ir.operations.first().expect("operation"); let ty = ir .types .iter() .find(|ty| ty.id == operation.output.type_ref) .expect("row type"); let IrTypeShape::Map { value_type_ref } = &ty.shape else { panic!( "schema-valued additionalProperties should import as a typed map, got {:?}", ty.shape ); }; let value_type = ir .types .iter() .find(|ty| ty.id == *value_type_ref) .expect("value type"); assert!(matches!( value_type.shape, IrTypeShape::Scalar(IrScalarType::String) )); }

    #[test] fn importer_treats_additional_properties_true_as_free_form_map() { let manifest = parse_source_manifest_yaml( r" name: additional_properties_true dsl_version: 4 surfaces:

    • id: rest type: openapi file: /tmp/openapi.yaml base_url: https://api.example.com ", ) .expect("manifest"); let v4 = manifest.as_v4().expect("v4"); let surface = v4.surfaces.first().expect("one surface"); let ir = import_openapi_surface( v4, surface, r" openapi: 3.0.3 paths: /bag: get: operationId: bag/get responses: '200': content: application/json: schema: type: object additionalProperties: true " .as_bytes(), ) .expect("import"); let operation = ir.operations.first().expect("operation"); let ty = ir .types .iter() .find(|ty| ty.id == operation.output.type_ref) .expect("row type"); assert!( matches!(ty.shape, IrTypeShape::Map { .. }), "additionalProperties: true should remain a map, got {:?}", ty.shape ); } EOF echo "Tests appended"]<]minimax[>[]<]minimax[>[ ]<]minimax[>[</tool_call>
  31. MiniMax Assistant

    Let me try again with proper formatting

  32. MiniMax Assistant

    Now let me run the new tests:

  33. MiniMax Assistant

    All 4 new tests pass! Let me also run all tests to make sure I haven't broken anything else:All 4 new tests pass. Let me also run all the other tests to make sure nothing is broken:]<]minimax[>[<tool_call> ]<]minimax[>[]<]minimax[>[cargo test -p coral-spec 2>&1 | tail -15]<]minimax[>[]<]minimax[>[ ]<]minimax[>[</tool_call>

  34. MiniMax Assistant

    Need to use proper tool call format.

  35. MiniMax Assistant

    All 223 tests pass (219 original + 4 new). Let me also run clippy to make sure the code is clean:All 223 tests pass (219 original + 4 new). Let me also run clippy to ensure code is clean:]<]minimax[>[<tool_call> ]<]minimax[>[]<]minimax[>[cargo clippy -p coral-spec --all-targets -- -D warnings 2>&1 | tail -20]<]minimax[>[]<]minimax[>[ ]<]minimax[>[</tool_call>

  36. MiniMax Assistant

    Clippy passes too. Let me also run rustfmt to ensure formatting is correct:

  37. MiniMax Assistant

    me fix the formatting:

  38. MiniMax Assistant

    let me verify the final state of the file:

  39. MiniMax Assistant

    The fix is in place. Let me also run all tests once more to verify everything still works:Let me run all tests once more to verify everything still works:]<]minimax[>[<tool_call> ]<]minimax[>[]<]minimax[>[cargo test -p coral-spec 2>&1 | grep -E "test result|^running|^test " | tail -20]<]minimax[>[]<]minimax[>[ ]<]minimax[>[</tool_call>

  40. MiniMax Assistant

    All 223 tests pass. Let me check the git status to confirm what changes will be submitted:Let me check the git status to confirm what changes will be submitted:]<]minimax[>[<tool_call> ]<]minimax[>[]<]minimax[>[git status && echo "===" && git diff --stat]<]minimax[>[]<]minimax[>[ ]<]minimax[>[</tool_call>

  41. MiniMax Assistant

    Let me try again with the proper tool call:

  42. MiniMax Assistant

    Now let me also check the new tests:Let me also look at the final test additions:]<]minimax[>[<tool_call> ]<]minimax[>[]<]minimax[>[git diff crates/coral-spec/src/v4/openapi_tests.rs | head -50]<]minimax[>[]<]minimax[>[ ]<]minimax[>[</tool_call>

  43. MiniMax Assistant

    The diffs look correct. Let me also verify the schema fix once more, then think about edge cases and verify the temporary test file is removed:Let me verify the temporary test file is removed and the mod.rs is back to original:]<]minimax[>[<tool_call> ]<]minimax[>[]<]minimax[>[ls crates/coral-spec/src/v4/ | grep -i temp]<]minimax[>[]<]minimax[>[ ]<]minimax[>[</tool_call>

  44. MiniMax Assistant

    Need to retry with proper tool call:

  45. MiniMax Assistant

    Temporary file is removed. Let me also verify the mod.rs is back to original:

  46. MiniMax Assistant

    The mod.rs is back to original. Let me also think about edge cases:

    1. additionalProperties: false alone (without properties) - tested ✓
    2. additionalProperties: false with properties - tested ✓
    3. additionalProperties: true - tested ✓
    4. additionalProperties: <schema> - tested ✓
    5. No additionalProperties and no properties - existing behavior (Json) ✓

    Let me also think about:

    • What about additionalProperties: null? In OpenAPI, this is undefined behavior. The current as_bool() == Some(false) check would return false (since as_bool() returns None for null), and the schema would be treated as a Map. This is consistent with how the original code handled it - the value would be passed to import_schema which would create a type for it.
    • What about a typed map with additionalProperties containing an enum or complex schema? This is already handled by the recursive import_schema call.

    Let me also check whether as_bool() handles null correctly. Looking at serde_json's docs:

    • Value::as_bool returns Some(b) if Value::Bool(b), else None

    So for null, it returns None, which means our Some(false) check fails, and we fall into the else branch. The null value gets passed to import_schema, which will likely create a Json type or empty type. This is the same as the original behavior, so it's fine.

    What about an explicit additionalProperties: false with nullable: true? The nullable field is processed earlier in the schema import, so it should still work correctly.

    Let me also run the full test suite once more to be sure everything is good:Let me also think about edge cases and test with null additionalProperties:]<]minimax[>[<tool_call> ]<]minimax[>[]<]minimax[>[cat > /tmp/edge_case_test.rs << 'EOF' use std::collections::BTreeMap;

    use coral_spec::parse_source_manifest_yaml; use coral_spec::v4::{import_openapi_surface, IrTypeShape};

    fn main() { let manifest = parse_source_manifest_yaml( r" name: edge dsl_version: 4 surfaces:

    • id: rest type: openapi file: /tmp/openapi.yaml base_url: https://api.example.com ", ) .expect("manifest"); let v4 = manifest.as_v4().expect("v4"); let surface = v4.surfaces.first().expect("one surface");

      // Edge case 1: additionalProperties with ref(typedmapwithref)letir=importopenapisurface(v4,surface,r"openapi:3.0.3paths:/by−id:get:operationId:byid/getresponses:′200′:content:application/json:schema:type:objectadditionalProperties:ref (typed map with ref) let ir = import_openapi_surface( v4, surface, r" openapi: 3.0.3 paths: /by-id: get: operationId: byid/get responses: '200': content: application/json: schema: type: object additionalProperties: ref: '#/components/schemas/Item' components: schemas: Item: type: object properties: id: {type: string} " .as_bytes(), ) .expect("import"); let operation = ir.operations.first().expect("operation"); let ty = ir .types .iter() .find(|ty| ty.id == operation.output.type_ref) .expect("type"); println!("[REF MAP] additionalProperties: {{$ref}} -> shape: {:?}", ty.shape);

      // Edge case 2: properties + additionalProperties: false (already tested, but double-check) let ir = import_openapi_surface( v4, surface, r" openapi: 3.0.3 paths: /object-with-properties: get: operationId: objwith/get responses: '200': content: application/json: schema: type: object additionalProperties: false properties: id: {type: string} " .as_bytes(), ) .expect("import"); let operation = ir.operations.first().expect("operation"); let ty = ir .types .iter() .find(|ty| ty.id == operation.output.type_ref) .expect("type"); println!("[OBJ] additionalProperties: false with props -> shape: {:?}", ty.shape);

      // Edge case 3: no type, no properties, no additionalProperties (the Json fallback case) let ir = import_openapi_surface( v4, surface, r" openapi: 3.0.3 paths: /free: get: operationId: free/get responses: '200': content: application/json: schema: {} " .as_bytes(), ) .expect("import"); let operation = ir.operations.first().expect("operation"); let ty = ir .types .iter() .find(|ty| ty.id == operation.output.type_ref) .expect("type"); println!("[FREE] empty schema -> shape: {:?}", ty.shape); } EOF echo "edge case test created"]<]minimax[>[]<]minimax[>[ ]<]minimax[>[</tool_call>

  47. MiniMax Assistant

    Let me create the edge case test as an actual test in the project so I can run it with cargo test:

  48. MiniMax Assistant

    All edge cases are handled correctly:

    1. additionalProperties: {$ref} → typed Map with the referenced type ✓
    2. Empty schema → Json (preserved existing behavior) ✓
    3. additionalProperties: <schema> with properties → Object with fields (preserved existing behavior - properties take precedence) ✓

    Now let me clean up the temporary test files:All edge cases handled correctly:

    1. additionalProperties: {$ref} → typed Map with referenced type ✓
    2. Empty schema → Json (preserved) ✓
    3. additionalProperties: <schema> with properties → Object with fields (preserved) ✓

    Now let me clean up the temporary test files:]<]minimax[>[<tool_call> ]<]minimax[>[]<]minimax[>[rm crates/coral-spec/src/v4/_temp_edge_tests.rs && git checkout crates/coral-spec/src/v4/mod.rs && grep -n "mod _temp|mod openapi_tests" crates/coral-spec/src/v4/mod.rs]<]minimax[>[]<]minimax[>[ ]<]minimax[>[</tool_call>

  49. MiniMax Assistant

    The mod.rs is back to its original state. Let me also verify everything one more time and run the tests:Let me run all the tests one more time and verify the diff is correct:]<]minimax[>[<tool_call> ]<]minimax[>[]<]minimax[>[cargo test -p coral-spec 2>&1 | tail -5]<]minimax[>[]<]minimax[>[ ]<]minimax[>[</tool_call>

  50. MiniMax Assistant

    All 223 tests pass. Let me also run clippy and fmt checks one more time:All 223 tests pass. Let me also run clippy and fmt checks:]<]minimax[>[<tool_call> ]<]minimax[>[]<]minimax[>[cargo clippy -p coral-spec --all-targets -- -D warnings 2>&1 | tail -5 && cargo fmt -p coral-spec -- --check 2>&1 | tail -5]<]minimax[>[]<]minimax[>[ ]<]minimax[>[</tool_call>

  51. MiniMax Assistant

    Everything passes. Let me do a final review of my changes:All checks pass. Let me do a final review:]<]minimax[>[<tool_call> ]<]minimax[>[]<]minimax[>[git status && echo "===" && git diff --stat]<]minimax[>[]<]minimax[>[ ]<]minimax[>[</tool_call>

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