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
I'll start by exploring the repository structure and locating the v4 OpenAPI schema import logic related to
additionalProperties. - Assistant
Next I'll search the codebase for
additionalPropertieshandling in the schema importer. - Assistant
rg is not found, let me use grep instead.
- Assistant
Found it - the main file is
./crates/coral-spec/src/v4/surfaces/openapi/schemas.rs. Let me read that file. - Assistant
Let me read the rest of the file around the additionalProperties handling.
- Assistant
The bug is clear: boolean
additionalPropertiesis treated like a schema. I'll inspect IR shapes and existing tests next. - Assistant
Let me look at the openapi_tests.rs for existing patterns and also the PR discussion if possible.
- Assistant
Let me read the openapi_tests.rs to understand the test patterns, and also check IrTypeShape definition.
- Assistant
I'll inspect recent test patterns and
IrTypeShapeso the fix matches existing conventions. - Assistant
Let me look at a recent test that might be related - like the recursive schema assertions from the latest commit.
- Assistant
I'll check how
resolve_refand boolean schemas behave so we handleadditionalProperties: falsecorrectly. - Assistant
Let me read the resolve_ref function next.
- Assistant
I'll check AGENTS.md and any notes about this issue, then implement the fix.
- Assistant
Implementing the fix and reviewing how existing tests assert map vs object shapes.
- Assistant
Implementing the schema import fix for
additionalProperties: false. - Assistant
Next I'll add focused import coverage for boolean and schema-valued
additionalProperties. - Assistant
Checking type ID derivation from
$refso the test assertions match. - Assistant
Type IDs are lowercased, so I'll update the test expectations accordingly.
- Assistant
I'll open the failing assertion block and fix the type ID names.
- Assistant
Now I can replace.
- Assistant
Need to fix the other two as well.
- Assistant
One more for FreeFormMap
- Assistant
Running the new test and related OpenAPI importer tests.
- Assistant
The type ID lookup failed — I'll check how other tests name CamelCase component schemas.
- Assistant
Let me look at the status enum test around line 291 and issue around 355 - they use CamelCase component names. How do type ids end up?
- Assistant
I'll print the imported types to see why EmptyObject wasn't resolved.
- Assistant
Interesting — modes are using operation-scoped type IDs. I'll check how response schemas pass
$refinto import. - Assistant
I'll inspect
classify_response_schemato see how$reftype IDs are preserved. - Assistant
I'll run the recursive schema test to confirm how type IDs are assigned.
- Assistant
Looking at
select_json_response- maybe it returns the schema with$refstill preserved. - Assistant
I'll re-read the full recursive schema test for the expected type IDs.
- Assistant
Wait - import_schema:
rustI - Assistant
Let me re-read the full import_response carefully - something must preserve the
$ref. - Assistant
I'll check how operation IDs are normalized before schema import.
- Assistant
I'll add temporary debug logging inside
import_schemato see the actual type IDs being assigned. - Assistant
I'll add more debug around response import and resolution.
- Assistant
The fix works — type IDs follow operation names. Cleaning up debug code and correcting the test assertions.
- Assistant
I'll clean this up more carefully with a corrected script.
- Assistant
Running the test again with the corrected type ID assertions.
- Assistant
Test passed. Next I'll run the full openapi and coral-spec test suites.
- Assistant
All tests passed. Verifying the final diff is clean and correct.
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.