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
Let me start by exploring the repository structure to understand the
Assistant
Let me look at the existing tests for OpenAPI import:
Assistant
Now let me check the linked PR discussion to understand the issue more. Let me also look at the IrTypeShape definition.
Assistant
Now let me look at the existing tests for similar cases to understand the test patterns better:
Assistant
Let me look at the rest of the openapi_tests.rs file to understand the test patterns:
Assistant
Now I understand the structure. Let me also check the AGENTS.md and see if there are any conventions I should follow:
Assistant
Let me also check the PR linked in the issue to better understand the context:
Assistant
Let me also verify the current behavior by writing a quick reproduction:
Assistant
let me create a test to reproduce the bug. First, let me look at the structure of test imports:
Assistant
Now let me write a reproduction script to confirm the issue first:
Assistant
Let me create a temporary script to test the current behavior:
Assistant
Let me create a simple inline test to verify the current behavior:
Assistant
me check the existing tests once more to understand the existing patterns and then implement the fix:
Assistant
Now I have a clear picture of the existing code. Let me apply the fix:
Assistant
Now let me apply the fix:
Assistant
me try a more targeted approach with
edit:Assistant
see there's a duplicated
} else {line. Let me fix that:Assistant
me remove the duplicate lines:
Assistant
The file looks correct now. Let me view it to make sure it's
Assistant
The fix looks correct. Now let me build to make sure it compiles:
Assistant
Now let me run the existing tests to make sure nothing is broken:
Assistant
All existing tests pass. Now I need to add focused tests for the new behavior. Let me add them to the openapi_tests.rs file:
Assistant
Now let me add focused tests for the new behavior:
Assistant
me update the test to verify it's a Json-shaped type:
Assistant
The edit removed some lines. Let me re-add them properly:
Assistant
There's an issue with the indentation. Let me fix it:
Assistant
There's a duplicate line. Let me remove the duplicate:
Assistant
Still has the duplicate. Let me check the raw
Assistant
me directly fix the file with sed since the edit tool seems to be making things worse:
Assistant
Let me restore the test by recreating it. First, let me see what got cut:
Assistant
There are several issues. Let me rewrite the test completely:
Assistant
me find and remove the duplicate definitions:
Assistant
me look at the file to understand its state:
Assistant
I need to remove the first batch of tests since they're duplicates. Let me use sed:
Assistant
I have only one set of tests. Let me verify by running them:
Assistant
All 17 tests pass. Let me look at the warning to fix it:
Assistant
Let me fix the duplicate
#[test]attribute:Assistant
Let me remove the extra
}:Assistant
file is becoming corrupted. Let me reset it and try again:
Assistant
Good, the file is now back to its original state. Let me now append the tests carefully:
Assistant
Now let me run the tests:
Assistant
All 16 tests pass. Now let me run the full test suite to make sure I didn't break anything:
Assistant
All 223 tests pass (up from 219, 4 new tests added). Let me now also run the other crates' tests to make sure I didn't break anything:
Assistant
Let me check if these failures are related to my changes:
Assistant
is a pre-existing test failure unrelated to my changes. Let me restore my changes:
Assistant
Good. Now let me look at the test more carefully. Let me also think about edge cases more deeply:
Assistant
Now let me also look at the schema changes. Let me look at the final file:Let me verify the change in the schemas.rs file:]<]minimax[>[<tool_call> ]<]minimax[>[]<]minimax[>[cd /coral && git diff crates/coral-spec/src/v4/surfaces/openapi/schemas.rs]<]minimax[>[]<]minimax[>[ ]<]minimax[>[</tool_call>
Assistant
Let me verify the change in the schemas.rs file:
Assistant
Now let me also check the diff for the test file:
Assistant
Both files look correct. Now let me also think about edge cases:
- What if the schema is parsed as
additionalProperties: falseliterally (not just boolean) - this is the main fix. - What about
additionalPropertiesbeing a boolean other thanfalse(liketrue)? - Handled. - What about the case when there's
additionalPropertiesbut it's neither a bool nor an object? - Not directly tested but unlikely.
Let me run all the tests one more time to confirm everything passes:
- What if the schema is parsed as
Assistant
All 223 tests pass. Let me also verify the build still works for the full workspace:
Assistant
Now let me also run
make rust-checkssince the AGENTS.md says to run it before submitting:Assistant
cargo-nextest is not installed. Let me run with regular cargo test
Assistant
Let me check the schema-check:
Assistant
Schema check passed. Let me also verify the build works for the doc generation:
Assistant
Documentation builds without warnings. Now let me think about the issue more carefully:
Assistant
Let me also check if there are any documentation comments I should add for the new behavior:
Assistant
Let me check the AGENTS.md for the spec module:
Assistant
Let me run the tests one final time to confirm:
Assistant
All 223 tests pass. Let me also look at the final diff:
Assistant
Let me view the final schemas.rs change to make sure it's clean:
Assistant
The change is minimal and focused. Let me also verify the test file:
Assistant
Now let me clean up the temp files:
Assistant
Let me now go over the checklist:
Checklist Review:
-
If an error was reported in the issue description, I have successfully reproduced it.
-
Assistant
All 16 OpenAPI tests pass, including the 4 new ones I added. Let me also verify the final schemas.rs file once more:
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.