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
I’ll first locate the v4 OpenAPI schema importer and its existing focused tests, then reproduce the
additionalProperties: falsebehavior through the narrowest relevant test command before changing the implementation. - Assistant
rgis unavailable, so I’ll usegrepand inspect the workspace metadata to identify the importer crate and test layout. - Assistant
The problematic branch is in
coral-spec’s v4 OpenAPI surface importer. I’ll read that module and nearby module tests to understand the imported DSL representation and preserve schema-valued behavior precisely. - Assistant
The bug is confirmed in code: any present JSON value enters the map branch, including
false; recursively importingfalseyields a synthetic JSON type and therefore a map. I’ll inspect existing OpenAPI tests and IR serialization expectations, then run a focused existing test baseline. Per the environment constraint, I will not modify or add test files; I’ll validate the new cases with a temporary script or temporary in-module test that is removed before submission. - Assistant
The intended distinction is narrow and clear:
- object schema in
additionalProperties→ retain the current typedMap; true→ retain the current free-form map behavior;false→ import an empty-fieldObject, representing a closed object;- explicit
properties(including an empty map) already imports asObjectand should keep precedence.
I’ll implement this value-sensitive branch without altering recursive schema import for schema-valued entries.
- object schema in
- Assistant
The implementation now special-cases only boolean
false, so schema objects andtruestill follow the original map path. To verify behavior end-to-end without touching repository tests, I’ll create a temporary Cargo program under/tmpthat calls the public v4 importer on three response schemas (false, schema-valued, andtrue) and asserts their IR shapes. - Assistant
The needed importer, parser, and IR shape types are public, so the temporary harness can exercise exactly the production API. I’ll run it now; it will also ensure typed maps still point to an imported scalar value type and free-form maps remain maps.
- Assistant
The harness compiled, but its manifest included two legacy keys rejected by the v4 manifest validator; this is a harness setup error, not an importer failure. I’ll remove those keys and rerun the same assertions.
- Assistant
The end-to-end reproduction now passes all three assertions:
falsebecomes an empty-field object, schema-valued entries remain typed maps, andtrueremains a free-form map. I’ll run the completecoral-spectest suite and Clippy for the affected crate, then inspect the final diff and repository status.
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.