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.
Assistant
Now let's implement the fix in schemas.rs.
Assistant
Looks fine, no odd whitespace. Let's just use
editwith line range instead.Assistant
Now let's check the build compiles.
Assistant
Compiles fine. Now let's check existing tests for OpenAPI schema import to see test file structure.
Assistant
Now let's write focused tests for additionalProperties handling. Let's view end of test file to append new tests there.
Assistant
All new tests pass. Now let's run the full coral-spec test suite to make sure nothing broke.
Assistant
All 222 tests pass. Now let's check the diff and also check for clippy warnings related to this file.
Assistant
No warnings. Let's check the diff for final review.
Assistant
This is auto-generated by release tooling, no need to touch it. The fix looks complete. Let's do a final full test run across the workspace to be safe.
Assistant
All tests pass. Let's review the checklist.
Assistant
Checklist review:
-
If an error was reported in the issue description, I have successfully reproduced it. The issue describes a behavioral bug (not a crash/error message), so I reproduced it by tracing the code path:
additionalProperties: falsefell into theSome(additional)branch inimport_schema, which recursed intoimport_schemaon aValue::Bool(false), ultimately producing aJson-valued type and wrapping it inIrTypeShape::Map, i.e., treated as a free-form map instead of a closed object. I confirmed this by reading the code flow (resolve_ref returns the bool unchanged since it has no$ref; the recursive call then falls through all match arms toIrTypeShape::Json, and the outer call wraps it inMap), and I wrote a test (importer_treats_additional_properties_false_as_closed_object) that failed against the original code before my fix (I effectively verified this by understanding the code, and the fix changes the outcome to the correct closed-object behavior, verified by the new passing test).
-
Assistant
I need to verify against old schema code specifically (with new tests) to prove the test catches the bug.
Assistant
Confirmed: the test fails without the fix, exactly as expected. Now let's reapply the fix.
Assistant
Fix reapplied and all tests pass again.
Assistant
- I have thought about edge cases and made sure my fix handles them as well. Considered:
additionalProperties: false(closed object, nowObject{fields: []}),additionalProperties: true(free-form, nowJsoninstead of a needlessly-typedMapwrapping aJsonvalue type — semantically equivalent but simpler/clearer), and schema-valuedadditionalProperties(preserved existingMapbehavior with correct value type resolution, verified via test using{type: string}). Also verified this doesn't affect the case where bothpropertiesandadditionalPropertiesexist together (properties branch takes priority, unchanged), and the "no additionalProperties key at all" case remainsJson(unchanged, existing behavior for plain objects with no schema info).
- I have thought about edge cases and made sure my fix handles them as well. Considered:
Assistant
- I have run existing tests in the repository that might have been affected by the change I made and confirmed that they pass. Ran full
coral-spectest suite (222 tests) pluscoral-mcp— all pass. Also rancargo clippy -p coral-specwith no warnings.
The fix is complete, minimal, targeted at the exact issue (boolean
additionalProperties: false/truehandling while preserving schema-valued map behavior), and covered by three new focused tests. Submitting now.- I have run existing tests in the repository that might have been affected by the change I made and confirmed that they pass. Ran full
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.