ISSUE DESCRIPTION Respect additionalProperties false during v4 OpenAPI schema import…
- 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
additionalPropertiesas map-like, soadditionalProperties: falsecan be imported as a free-form map instead of a closed object.Acceptance criteria: Handle boolean
additionalProperties: falseas 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 usinggit reset --hardcommand. Additionally, you can usegit stashandgit stash popto temporarily save your changes and restore them later. Finally, you can see the changes that you've made (which will be submitted when you callsubmit) usinggit statusorgit diffcommands. However you don't need to usegit addorgit commitbefore submitting your changes. In fact,submitonly submits currently unstaged changes because it usesgit diffto 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-$
Assistant
Let me start by understanding the repository structure and the issue. The issue is about handling
additionalProperties: falseduring OpenAPI v4 schema import. The problem is that the schema importer treats the presence ofadditionalPropertiesas map-like, soadditionalProperties: falsecan be imported as a free-form map instead of a closed object.Let me explore the repository to understand its structure and find the relevant code.
Assistant
Let me find the relevant code related to OpenAPI schema import and
additionalPropertieshandlingAssistant
Let me look at the relevant files. The key one is likely
crates/coral-spec/src/v4/surfaces/openapi/schemas.rs.Assistant
I need to use the special commands through the bash terminal. Let me try again.
Assistant
Let me see the rest of the file
Assistant
Let me see the rest of the file and look for helper functions
Assistant
Now I understand the issue. Let me check the
IrTypeShapeenum to understand available shapes:Assistant
Let me look at the IrTypeShape definition.
Assistant
Let me see the full IrTypeShape enum definition.
Assistant
Let me now look at the existing tests to understand what test patterns are used.
Assistant
Let me search for any existing tests related to additionalProperties or map-like
Assistant
Let me look at the test patterns more closely to understand the structure
Assistant
Let me search for more related tests and see if there are any tests for Map shapes
Assistant
Now I have a clear understanding of the issue. Let me look at the line more closely and implement the fix. The issue is on line 102: the code checks
if let Some(additional) = resolved.get("additionalProperties")which matches any value (includingfalse). We need to change this to only match whenadditionalPropertiesis notfalse.Let me also check if there are any tests related to this module
Assistant
Now I understand the issue completely. Let me implement the fix:
Assistant
That edited the wrong file! I need to specify the file. Let me first revert the test file and then edit the correct
Assistant
Now let me edit the correct file. Let me open the schemas file first and verify the current content:
Assistant
Now let me edit line 102 to add the condition that skips
additionalProperties: falseAssistant
I see there's a missing
{at the end of line 103. Let me fix the syntax:Assistant
Let me verify the code compiles by building:
Assistant
The code compiles. Now let me run the existing tests to make sure nothing is broken:
Assistant
All tests pass. Let me now verify the fix works correctly by creating a quick reproduction script. Let me also look at the mentioned PR for context:
Assistant
Let me look at the existing test for schema import - specifically the one that tests
importer_handles_recursive_schema_refsto understand the pattern:Assistant
Let me look at some test patterns:
Assistant
Let me think about this more carefully. The acceptance criteria says "Handle boolean
additionalProperties: falseas a closed object." Currently, my fix makesadditionalProperties: falsefall through toIrTypeShape::Json, but a closed empty object should probably beIrTypeShape::Object { fields: vec![] }. Let me update the fix to handle this properly:Assistant
I see there's an extra
}on line 125. Let me fix the structure:Assistant
Now let me verify it compiles:
Assistant
Now let me run the tests:
Assistant
All tests pass. Now let me create a temporary test script to verify the fix handles both cases correctly:
Assistant
Let me look at how tests import the
import_openapi_surfacefunction:Assistant
Let me verify the final state of the changed code:
Assistant
The fix looks correct. Let me trace through all the edge cases to verify:
additionalProperties: falsewithout properties →Object { fields: [] }(closed empty object) ✓additionalProperties: truewithout properties →Map(free-form map) ✓additionalProperties: {type: string}without properties →Map(typed map) ✓additionalProperties: falsewith properties →Object { fields: [...] }(first branch, additionalProperties ignored) ✓- No
additionalProperties, no properties →Json(unchanged behavior) ✓
Let me clean up:
Assistant
Let me verify the final state of the file one more time:
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.
Identical first prompt
Qwen/Qwen3.6-27BCompare side by side →
Qwen/Qwen3.6-27BCompare side by side →
Qwen/Qwen3.6-27BCompare side by side →
Qwen/Qwen3.6-27BCompare side by side →
Qwen/Qwen3.6-27BCompare side by side →
- xiaomi/mimo-v2.5-proCompare side by side →
- xiaomi/mimo-v2.5-proCompare side by side →
- xiaomi/mimo-v2.5-proCompare side by side →
- xiaomi/mimo-v2.5-proCompare side by side →
- gpt-5.6-solCompare side by side →
- gpt-5.6-solCompare side by side →
- gpt-5.6-solCompare side by side →