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 issue. The problem is about OpenAPI schema import in what appears to be a Coral project. The issue says:
- The schema importer treats the presence of
additionalPropertiesas map-like - So
additionalProperties: falsecan be imported as a free-form map instead of a closed object - We need to handle boolean
additionalProperties: falseas a closed object - Preserve schema-valued
additionalPropertiesbehavior - Add focused schema import coverage
Let me explore the repository structure first to understand what we're dealing with.
- The schema importer treats the presence of
Assistant
Let me try one command at a time.
Assistant
This is a Rust project. Let me find the relevant files related to schema import and
additionalProperties.Assistant
Let me look at the key files and search for more
Assistant
Let me look at the key file, the schemas.rs:
Assistant
Let me see the rest of the file
Assistant
Now I can see the issue. Let me look at the surrounding code more carefully and find the test files
Assistant
Typo. Let me fix the path.
Assistant
Let me see the bottom of the file and find test
Assistant
Now I understand the issue. Let me find the existing tests for OpenAPI schema import.
Assistant
Let me look at the openapi tests and the import module:
Assistant
Let me search for tests related to
additionalPropertiesand also look at the IR types to understand `IrTypeShape::Assistant
Let me look at the IR types
Assistant
Let me see the IR model
Assistant
Now I have a clear understanding of the issue. Let me also look at the full test file to understand test patterns
Assistant
Let me view the test file in sections
Assistant
Let me look at the import module
Assistant
Let me see the rest of import.rs
Assistant
Let me look at the test_support to understand the test patterns
Assistant
Now I understand the issue. Let me first build and run existing tests to make sure things compile. Then I'll reproduce the issue
Assistant
Now let me run the existing open
Assistant
Now I understand the issue. Let me apply the fix. The problem is at lines 102-111 in schemas.rs. When
additionalPropertiesisfalse(boolean), the code should NOT treat it as a map but instead as a closed object.Assistant
Now let me apply the fix. I need to replace the block that handles
additionalPropertiesto check for boolean `falseAssistant
Let me navigate to that line first
Assistant
Now let me use the edit command to replace lines 102-111
Assistant
The fix looks correct. Let me build to make sure it compiles and run existing
Assistant
It compiles. Let me run the existing
Assistant
All tests pass. Now let me create a temporary reproduce script to verify the fix
Assistant
Let me check if there are any existing tests that test the
Mapshape behaviorAssistant
Let me look at the full test file to see its
Assistant
Let me see the last test to understand the
Assistant
Let me create a temporary script to verify the fix handles all cases
Assistant
The diff looks correct. Let me now run the full test suite for the coral-spec crate to ensure nothing
Assistant
All 219 tests pass. Let me also verify there aren't other places that need
Assistant
The only code that processes
additionalPropertiesis the file I fixed. The other occurrences are just JSON schema fixtures in tests. Let me clean up and verify the fix one moreAssistant
All tests pass. Let me verify the final state of the
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.