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.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 understanding the repository structure and the issue at hand.
The issue is about respecting
additionalProperties: falseduring v4 OpenAPI schema import. The problem is that the schema importer treats the presence ofadditionalPropertiesas map-like, soadditionalProperties: falsecan be imported as a free-form map instead of a closed object.Let me explore the repository structure first.
Assistant
That doesn't look like a Python repository. Let me check the actual structure.
Assistant
This is a Rust project. Let me explore the crates and find the relevant code for OpenAPI schema import and
additionalProperties.Assistant
Let me look at the relevant files. The main one appears to be in the
coral-speccrate for OpenAPI schema handlingAssistant
Let me try with the correct command format.
Assistant
Now I can see the issue clearly. Let me examine the problematic section more closely and look at the surrounding code:
Assistant
Let me look at the test files and the broader structure to understand how this is tested.
Assistant
Let me find the test files for the OpenAPI import functionality
Assistant
Let me look at the openapi_tests.rs file.
Assistant
Let me see the rest of the test file (it was truncated) and also look for more relevant context
Assistant
Let me see the rest of the test file after line 350 or so.
Assistant
Let me look at the IrTypeShape enum to understand all available shapes.
Assistant
Let me find the IR module.
Assistant
Let me see the IrTypeShape enum.
Assistant
Now I have a clear understanding of the issue. Let me look at the exact problematic code once more and then fix
Assistant
Now I understand the issue. The problem is at line 102: when
additionalPropertiesis present at all (includingfalse), the code treats it as a map. Let me fix this.The fix should:
additionalProperties: false→ closed object (IrTypeShape::Object { fields: vec![] })additionalProperties: true→ free-form JSON (IrTypeShape::Json)additionalProperties: <schema>→ map with value type (current behavior
Assistant
Let me open the file and make the edit
Assistant
Let me try the open command properly.
Assistant
Now I'll edit lines 102-111 to handle the boolean cases of
additionalPropertiesAssistant
Let me try running the edit command directly through bash.
Assistant
The edit looks correct. Now let me run the existing tests to make sure nothing is broken.
Assistant
All 12 existing tests pass. Let me also run the full test suite for the coral-spec crate to make sure nothing else is
Assistant
All 219 tests pass. Let me also run the coral-mcp tests since it also references additionalProperties
Assistant
All tests pass. Let me also quickly verify the final state of the edited file.
Assistant
The code looks good. Let me verify the changes with git
Assistant
The fix is clean and all tests pass. Let me verify the full test suite one more time to be sure.
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.