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.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 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
Now let's edit the schema import logic.
Assistant
Let's look at a test that checks Map shape, to model a new test after it.
Assistant
Now let's write a new test for additionalProperties handling. Let's check the end of the file to add a test there.
Assistant
Now let's add a new test that covers additionalProperties: false as closed object, true as Json, and schema-valued as Map.
Assistant
Now let's check the imports used in test file (IrTypeShape, IrScalarType, OutputCardinality) already available via
use super::*;.Assistant
Good, these should already be in scope since used elsewhere in the tests. Let's build/test now.
Assistant
All tests pass, including the new one. Now let's run full test suite for coral-spec to make sure nothing else broke.
Assistant
All 220 tests pass. Let's also check other crates that might depend on this to run broader test suite (like coral-mcp mentioned additionalProperties earlier), and check clippy for the edited file.
Assistant
No clippy warnings. Now let's check formatting.
Assistant
Formatting fixed. Let's re-run the tests to confirm everything still passes after formatting.
Assistant
Let's view the final diff for review.
Assistant
That's unrelated MCP tool JSON schema definitions (properties always present alongside additionalProperties:false), not part of the import path. Not related to this issue. Now let's check the workspace broadly builds fine.
Assistant
Workspace builds successfully. Let's finalize with a full test run across the workspace to make sure nothing else broke.
Assistant
Confirmed these failures are pre-existing and unrelated to my change (likely due to running as root in this sandbox, causing permission-based failure injection tests to not fail as expected). Let's restore my changes.
Assistant
Changes restored. Good - my fix is unrelated to those pre-existing failing tests (confirmed they fail even without my patch, likely due to running as root in the sandbox environment).
Now let's go through the checklist:
Assistant
All tests pass. Let me review the checklist items:
- If an error was reported in the issue description, I have successfully reproduced it. The issue describes a design/behavior gap (not a crash), so I reproduced it by writing a test with
additionalProperties: falseand confirmed it originally imported asIrTypeShape::Map(free-form map) instead of a closed object — verified by inspecting the pre-fix code path (theelse if let Some(additional) = resolved.get("additionalProperties")branch unconditionally treated presence as map-like).
- If an error was reported in the issue description, I have successfully reproduced it. The issue describes a design/behavior gap (not a crash), so I reproduced it by writing a test with
Assistant
This confirms the fix:
additionalProperties: falsenow maps toIrTypeShape::Object { fields: Vec::new() }(a closed object with no properties),additionalProperties: truemaps toIrTypeShape::Json(free-form, matching the "no constraint" semantics without being misrepresented as a schema-typed map), and schema-valuedadditionalPropertiesretains the original map behavior.Now let's go through the full checklist explicitly:
Assistant
All checklist items are satisfied. Let's do a final review of the diff before submitting.
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
claude-sonnet-5Compare side by side →
claude-sonnet-5Compare side by side →
claude-sonnet-5Compare side by side →
claude-sonnet-5Compare side by side →
Qwen/Qwen3.6-35B-A3BCompare side by side →
Qwen/Qwen3.6-35B-A3BCompare side by side →
Qwen/Qwen3.6-35B-A3BCompare side by side →
Qwen/Qwen3.6-35B-A3BCompare side by side →
Qwen/Qwen3.6-35B-A3BCompare side by side →
Qwen/Qwen3.5-35B-A3BCompare side by side →
Qwen/Qwen3.5-35B-A3BCompare side by side →