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 OpenAPI schema import logic related to
additionalProperties. - Assistant
Let me search for additionalProperties handling in the codebase.
- Assistant
rg is not available, let me use grep.
- Assistant
The main logic is in
schemas.rs. I'll inspect that file and related tests. - Assistant
Let me see the rest of the file, particularly the additionalProperties handling.
- Assistant
I'll look for related tests and any PR discussion context next.
- Assistant
Let me look at openapi_tests.rs for relevant tests.
- Assistant
No tests for additionalProperties yet. Let me read the openapi_tests.rs structure and also check the IrTypeShape definition.
- Assistant
Let me look at a recent similar test for patterns, and also check what happens when import_schema is called with a boolean false.
- Assistant
I'll inspect recent openapi tests for schema-import patterns to mirror them.
- Assistant
I'll check how
resolve_refhandles boolean values and what the GitHub discussion details are. - Assistant
Let me read resolve_ref and also check AGENTS.md for testing instructions.
- Assistant
I'll check the v3 path and any comments for the intended additionalProperties behavior.
- Assistant
I have a clear picture of the bug. Next I'll implement the fix and add focused tests.
- Assistant
I'll look at an existing type-shape assertion test to mirror that pattern.
- Assistant
Implementing the
additionalProperties: falsehandling in the schemas importer. - Assistant
I introduced a duplicate
else— fixing that now. - Assistant
Adding a focused test that covers the new additionalProperties cases.
- Assistant
I'll check how type IDs are derived from
$refvalues so the test assertions match. - Assistant
Type IDs are lowercased — updating the test to match.
- Assistant
There's a trailing brace left over — removing it.
- Assistant
Running the new test and related openapi tests to verify the fix.
- Assistant
Debug failing test: checking which type IDs the importer actually produces.
- Assistant
Type IDs come from the operation path, not schema names—I'll check how responses import schemas.
- Assistant
Inspecting how
classify_response_schemashapes the row schema. - Assistant
I'll run the recursive schema test to confirm how type IDs are assigned.
- Assistant
Tracing where the response
$refgets passed to the importer. - Assistant
So select_json_response returns schema which may still have $ref. Then import_response does:
- Assistant
I'll re-read the recursive test's assertions carefully.
- Assistant
Checking the actual type_ref for the recursive schema import.
- Assistant
Checking how operation IDs are derived.
- Assistant
I'll dump import_response directly and add temporary logging around schema import.
- Assistant
Interesting - the
$refwas somewhere not expanded. Adding logging to resolve_ref. - Assistant
Logging what
resolve_refreturns after expansion. - Assistant
Adding logging in
import_responsearound the schema passed intoimport_schema. - Assistant
classifyis returning the original$refeven though it received an expanded schema — inspecting the compiled function. - Assistant
The fix works — type IDs come from operation names. Cleaning up debug patches and updating the test.
- Assistant
Reapplying the fix and rewriting the test to look up types via operation output.
- Assistant
I'll apply a clean fix without verbose comments to match file style.
- Assistant
Next I'll append a focused openapi import test for additionalProperties.
- Assistant
Good, file is back to 666 lines.
- Assistant
I'll write a cleaner test that uses inline schemas (not refs) to make type IDs simpler, or look up via operations.
- Assistant
Verifying the file end is clean, then running the tests.
- Assistant
Operation IDs may be normalized — checking what values are produced.
- Assistant
Operation IDs are normalized — updating the test lookups accordingly.
- Assistant
Updating the test to use the normalized operation IDs.
- Assistant
Test passed. Running the full openapi test suite and clippy on the changed code.
- Assistant
Checking how other long tests deal with the clippy lint.
- Assistant
I'll check the existing allow pattern and tighten the test to satisfy clippy.
- Assistant
Compacting the test and applying clippy fixes.
- Assistant
Re-running the focused test and clippy.
- Assistant
Switching the raw string to plain
r"to satisfy clippy. - Assistant
Also, does clippy still complain about too_many_lines with the shorter version? Let me check line count of the function - the expect might still be needed or maybe not.
- Assistant
Confirming the
too_many_linesexpect is still required and reviewing the final diff. - Assistant
All tests passed. Doing a final review of the changes, then submitting.
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.